git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v3 1/2] list-objects-filter: only parse sparse OID when 'have_git_dir'

From
JHJeff Hostetler <git@jeffhostetler.com>
Date
Sep 9, 2019, 13:54 UTC
Message-ID
<f32d2e8c-abec-0ec1-daa7-4c10470c5553@jeffhostetler.com>
In-Reply-To
<xmqqv9u6po4j.fsf@gitster-ct.c.googlers.com>
On 9/5/2019 2:57 PM, Junio C Hamano wrote:
Show 28 quoted lines
> Jeff King <peff@peff.net> writes:
> 
>> So these patches are punting on the greater question of why we want to
>> parse so early, and are not making anything worse. AFAICT, "clone
>> --filter=sparse:oid" has never worked (even though our tests did cover
>> the underlying rev-list and pack-objects code paths).
>> ...
>> TBH, I'm not sure why the original is so eager to parse early. I guess
>> it allows:
>>
>>    - a dual use of the options parser; we can use it both to sanity-check
>>      the options before sending them to a server, and to actually use the
>>      filter ourselves.
>>
>>    - earlier detection maybe gives us a cleaner error path (e.g.,
>>      rev-list can do its own error handling). But I'd think doing it when
>>      we actually initialize the filter would be enough.
>>
>> I.e., if we want to go all the way, I think this two-patch series could
>> basically be replaced with something like the (totally untested)
>> approach below, which just pushes the parsing closer to the
>> point-of-use.
>>
>> Adding Jeff Hostetler to the cc, in case he recalls any reason not to
>> use that approach.
> 
> Thanks.
> 
I think both of Peff's guesses are correct.

IIRC I wrote the original parse_list_objects_filter() and friends to syntax check the command line arguments of rev-list. In hindsight, this looks a bit aggressive at that layer, or rather now that it is being used by various places in other commands (such as parsing messages from the wire), it shouldn't call die() as Peff suggests.

I like the code Peff suggests. Making parse_list_objects_filter() a bit simpler and not call die(). Callers should then check the function return value as necessary.

It would be nice if we could continue to let parse_list_objects_filter() do the syntax checking -- that is, we can still check that we received a ulong in "blob:limit:<nr>" and that "sparse:oid:<oid>" looks like a hex value, for example. Just save the actual <oid> lookup to the higher layer, if and when that makes sense.

Jeff
Previous: Junio C HamanoNext: Jeff King
Message 6 of 19 in “partial-clone: fix two issues with sparse filter handling”
  1. 0/2 partial-clone: fix two issues with sparse filter handlingJon Simons, Aug 29, 2019
  2. 1/2 list-objects-filter: only parse sparse OID when 'have_git_dir'Jon Simons, Aug 29, 2019
  3. Junio C HamanoAug 30, 2019
  4. Jeff KingSep 4, 2019
  5. Junio C HamanoSep 5, 2019
  6. Jeff HostetlerSep 9, 2019
  7. Jeff KingSep 9, 2019
  8. Jeff HostetlerSep 9, 2019
  9. 0/3 clone --filter=sparse:oid bugsJeff King, Sep 15, 2019
  10. 1/3 t5616: test cloning/fetching with sparse:oid=<oid> filterJeff King, Sep 15, 2019
  11. 2/3 list-objects-filter: delay parsing of sparse oidJeff King, Sep 15, 2019
  12. Jeff KingSep 15, 2019
  13. Junio C HamanoSep 17, 2019
  14. 3/3 list-objects-filter: give a more specific error sparse parsing errorJeff King, Sep 15, 2019
  15. 4/3 list-objects-filter: use empty string instead of NULL for sparse "base"Jeff King, Sep 15, 2019
  16. Jeff HostetlerSep 16, 2019
  17. Junio C HamanoSep 9, 2019
  18. Jeff HostetlerSep 9, 2019
  19. 2/2 list-objects-filter: handle unresolved sparse filter OIDJon Simons, Aug 29, 2019

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.