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

Re: [PATCH 1/5] Add 'df_name_compare()' helper function

From
David Kastrup <dak@gnu.org>
Date
Mar 6, 2008, 21:50 UTC
Message-ID
<85bq5r34kh.fsf@lola.goethe.zz>
In-Reply-To
<alpine.LFD.1.00.0803060743180.12253@woody.linux-foundation.org>
Linus Torvalds <torvalds@linux-foundation.org> writes:
Show 17 quoted lines
> On Thu, 6 Mar 2008, David Kastrup wrote:
>
>> Consider the case of a merge of
>> 
>> A:
>> blubb
>> blubb.hi
>> 
>> B:
>> blubb.hi
>> blubb/
>> 
>> Any traversal that is done reasonably efficiently will never compare
>> blubb to blubb/ and I don't see how to get around this.
>
> Correct. There _is_ no sort order that will find the conflict in a
> single pass,
[...]
Show 5 quoted lines
>> Basically, I think you need a special traversal routine.
>
> Yes, we need to handle it in two passes. Which is actually hopefully
> not all that hard, but it is totally impossible (at least for me) with
> the old code that was so hard to follow.

Well, as I said: a single pass is ok when additionally supported by a FIFO keeping x around until x/ (or its place in the order of things) passes by. This will be O(1) with regards to comparisons, and typically cheap with regard to memory requirements (things get unfriendly if there are billions of files or even directories obeying the pattern x.*, but only with regard to memory, not speed).

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum
Previous: Linus TorvaldsNext: Linus Torvalds
Message 5 of 12 in “Split-up "unpack_trees()" cleanup series”
  1. 0/5 Split-up "unpack_trees()" cleanup seriesLinus Torvalds, Mar 6, 2008
  2. 1/5 Add 'df_name_compare()' helper functionLinus Torvalds, Mar 6, 2008
  3. David KastrupMar 6, 2008
  4. Linus TorvaldsMar 6, 2008
  5. David KastrupMar 6, 2008
  6. 2/5 Make 'traverse_tree()' use linked structure rather than 'const char *base'Linus Torvalds, Mar 6, 2008
  7. 3/5 Add return value to 'traverse_tree()' callbackLinus Torvalds, Mar 6, 2008
  8. 4/5 Make 'traverse_trees()' traverse conflicting DF entries in parallelLinus Torvalds, Mar 6, 2008
  9. 5/5 Move 'unpack_trees()' over to 'traverse_trees()' interfaceLinus Torvalds, Mar 6, 2008
  10. Linus TorvaldsMar 6, 2008
  11. Daniel BarkalowMar 7, 2008
  12. Linus TorvaldsMar 7, 2008

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.