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

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

From
Junio C Hamano <junkio@cox.net>
Date
May 20, 2005, 14:56 UTC
Message-ID
<7vacmquet3.fsf@assigned-by-dhcp.cox.net>

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

I personally don't care about the difference of the order these are output, but it affects the stability of the test, and also is inconsistent --- everybody else sorts the entries in the cache order.

Although I do not see practical problems in this inconsistency, I am asking you just in case if you care about it. If there is a downstream consumer that relies on the ordering of the entries this may cause problems (diff-helper is OK).

[Footnote] *1* The trees are taken from t1000-read-tree-m-3way.sh test.

Next: Linus Torvalds
Message 1 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.