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

Re: "git-diff-tree -R A B == git-diff-tree B A"?

From
Junio C Hamano <junkio@cox.net>
Date
May 20, 2005, 15:29 UTC
Message-ID
<7v64xdvru5.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<Pine.LNX.4.58.0505200806150.2206@ppc970.osdl.org>
>>>>> "LT" == Linus Torvalds <torvalds@osdl.org> writes:
LT> On Fri, 20 May 2005, Junio C Hamano wrote:
Show 20 quoted lines
>> 
>> I was preparing a set of tests for diff family because I wanted
>> to have something that catches screwups I am going to inflict
>> upon them during the coming couple of days.  One of the tests
>> accidentally found out that the above is not true in the current
>> implementation.  Just an excerpt of relevant lines [*1*]:
>> 
>> $ git-diff-tree -r $tree_B $tree_A
>> 
>> +100644 blob 7e426fb079479fd67f6d81f984e4ec649a44bc25 AN
>> +100644 blob 68a6d8b91da11045cf4aa3a5ab9f2a781c701249 DF/DF
>> -100644 blob 71420ab81e254145d26d6fc0cddee64c1acd4787 DF
>> -100644 blob 3c4d8de5fbad08572bab8e10eef8dbb264cf0231 DM
>> 
>> $ git-diff-tree -R $tree_A $tree_B
>> 
>> +100644 blob 7e426fb079479fd67f6d81f984e4ec649a44bc25 AN
>> -100644 blob 71420ab81e254145d26d6fc0cddee64c1acd4787 DF
>> +100644 blob 68a6d8b91da11045cf4aa3a5ab9f2a781c701249 DF/DF
>> -100644 blob 3c4d8de5fbad08572bab8e10eef8dbb264cf0231 DM
LT> Ahh.. "diff-tree" uses the wrong algorithm for selecting name ordering.

LT> It thinks that "DF" and "DF/" sort equally because it just looks at the LT> name, not the type. So then, becuse the names sort the same, it will sort LT> them according to where they come from, and you get the behaviour you see.

LT> It doesn't really matter, but you're right, I should fix it to be LT> consistent.

Don't bother.  I already have a fix with the test case.
Previous: Linus TorvaldsNext: Junio C Hamano
Message 3 of 9 in “"git-diff-tree -R A B == git-diff-tree B A"?”
  1. Junio C HamanoMay 20, 2005
  2. Linus TorvaldsMay 20, 2005
  3. Junio C HamanoMay 20, 2005
  4. Junio C HamanoMay 20, 2005
  5. Linus TorvaldsMay 20, 2005
  6. Linus TorvaldsMay 20, 2005
  7. Linus TorvaldsMay 20, 2005
  8. Junio C HamanoMay 20, 2005
  9. Simplify "reverse-diff" logic in the diff core.Junio C Hamano, May 20, 2005

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.