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, 13:03 UTC
Message-ID
<8563w03sxv.fsf@lola.goethe.zz>
In-Reply-To
<b1cd18fa986c63bea6d0a20ac580b993e5fffaa2.1204777699.git.torvalds@linux-foundation.org>
Linus Torvalds <torvalds@linux-foundation.org> writes:
Show 7 quoted lines
> This new helper is identical to base_name_compare(), except it compares
> conflicting directory/file entries as equal in order to help handling DF
> conflicts (thus the name).
>
> Note that while a directory name compares as equal to a regular file
> with the new helper, they then individually compare _differently_ to a
> filename that has a dot after the basename (because '\0' < '.' < '/').

Uh, that screams just bloody murder at me with regard to working on sorted material. You'll never even get into the situation where the conflicting "equal" entries will be compared if you presorted them with something in between. 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.

Basically, I think you need a special traversal routine. This routine will push all non-directory entries during a parallel traverse into a might-conflict-queue, appending a slash in the course. The front of this queue then gets compared with the next processed entry. If it is larger, it is kept at the front, if it is equal, the conflict gets treated/resolved, if it is smaller, it gets popped (since it can't conflict anymore).

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum
Previous: Linus TorvaldsNext: Linus Torvalds
Message 3 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.