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

Re: [PATCH v3 00/14] Clean up how fetch_pack() handles the heads list

From
Michael Haggerty <mhagger@alum.mit.edu>
Date
Sep 17, 2012, 12:55 UTC
Message-ID
<50571DC9.2030602@alum.mit.edu>
In-Reply-To
<7vhar5leal.fsf@alter.siamese.dyndns.org>
On 09/11/2012 12:10 AM, Junio C Hamano wrote:
Show 16 quoted lines
> Michael Haggerty <mhagger@alum.mit.edu> writes:
> 
>>> OK.  As long as the sort order matches the order string-list
>>> internally uses for its bisection search, it won't be a problem,
>>> then.
>>
>> The sorting is crucial but there is no bisection involved.  The sorted
>> linked-list of references available from the remote and the sorted
>> string_list of requested references are iterated through in parallel.
> 
> What I meant was that the order used by string-list is pretty much
> internal to string-list implementation for its "quickly locate where
> to insert" bisection.  It happens to be the byte value order, I
> think, but the point is whatever order it is, that has to match the
> order we keep references in the other data source you walk in
> parallel to match (i.e. the linked list of references).

Yes, your point is good that the two sort orders have to agree. Currently, they both use strcmp() order, so the situation is OK.

It is interesting that you consider the sort order of string_list to be somewhat of an internal implementation detail. I had thought of its current behavior as being the obvious thing and considered it part of the API's contract. For example, the current sort order is already observable via the API through iteration or by calling print_string_list(). Therefore I think that we should document the strcmp() sort order as part of the string_list contract. Patch coming soon.

If, at some future time, somebody wants a string_list that is sorted by a different criterion, then the order should be determined via a callback function specified by the user. The callback function could even be stored in the string_list header, to allow such lists to be used in combination with the "functions for sorted lists only".

Michael
-- 
Michael Haggerty
mhagger@alum.mit.edu
http://softwareswirl.blogspot.com/
Previous: Junio C HamanoNext: Junio C Hamano
Message 30 of 32 in “Clean up how fetch_pack() handles the heads list”
  1. 00/14 Clean up how fetch_pack() handles the heads listMichael Haggerty, Sep 9, 2012
  2. 01/14 t5500: add tests of error output for missing refsMichael Haggerty, Sep 9, 2012
  3. 02/14 t5500: add tests of fetch-pack --all --depth=N $URL $REFMichael Haggerty, Sep 9, 2012
  4. Junio C HamanoSep 10, 2012
  5. Michael HaggertySep 10, 2012
  6. Philip OakleySep 18, 2012
  7. 03/14 Rename static function fetch_pack() to http_fetch_pack()Michael Haggerty, Sep 9, 2012
  8. 04/14 fetch_pack(): reindent function decl and defnMichael Haggerty, Sep 9, 2012
  9. 05/14 Change fetch_pack() and friends to take string_list argumentsMichael Haggerty, Sep 9, 2012
  10. Junio C HamanoSep 10, 2012
  11. Michael HaggertySep 17, 2012
  12. Junio C HamanoSep 17, 2012
  13. Jeff KingSep 17, 2012
  14. Junio C HamanoSep 18, 2012
  15. 06/14 filter_refs(): do not check the same sought_pos twiceMichael Haggerty, Sep 9, 2012
  16. 07/14 fetch_pack(): update sought->nr to reflect number of unique entriesMichael Haggerty, Sep 9, 2012
  17. 08/14 filter_refs(): delete matched refs from sought listMichael Haggerty, Sep 9, 2012
  18. 09/14 filter_refs(): build refs list as we goMichael Haggerty, Sep 9, 2012
  19. Junio C HamanoSep 10, 2012
  20. 10/14 filter_refs(): simplify logicMichael Haggerty, Sep 9, 2012
  21. 11/14 cmd_fetch_pack(): return early if finish_connect() failsMichael Haggerty, Sep 9, 2012
  22. 12/14 fetch-pack: report missing refs even if no existing refs were receivedMichael Haggerty, Sep 9, 2012
  23. 13/14 cmd_fetch_pack(): simplify computation of return valueMichael Haggerty, Sep 9, 2012
  24. 14/14 fetch-pack: eliminate spurious error messagesMichael Haggerty, Sep 9, 2012
  25. Junio C HamanoSep 9, 2012
  26. Jeff KingSep 9, 2012
  27. Junio C HamanoSep 9, 2012
  28. Michael HaggertySep 10, 2012
  29. Junio C HamanoSep 10, 2012
  30. Michael HaggertySep 17, 2012
  31. Junio C HamanoSep 17, 2012
  32. Junio C HamanoSep 10, 2012

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.