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

git diff-tree commit detail bug in 2.0.2 and 2.0.3

From
Bryan Turner <bturner@atlassian.com>
Date
Jul 28, 2014, 09:42 UTC
Message-ID
<CAGyf7-HKpfyi5OqXS9BhtfXUEZXbisawpTPK9UFOQObz1qhRUw@mail.gmail.com>

Using git diff-tree --stdin on 2.0.2 and 2.0.3 produces incorrect commit messages.

Here's an example to reproduce the issue:
bturner@ubuntu:/tmp$ git init --bare test.git
Initialized empty Git repository in /tmp/test.git/
bturner@ubuntu:/tmp$ git clone test.git
Cloning into 'test'...
warning: You appear to have cloned an empty repository.
done.
bturner@ubuntu:/tmp$ cd test
bturner@ubuntu:/tmp/test$ echo "Hello" > file.txt
bturner@ubuntu:/tmp/test$ git add file.txt
bturner@ubuntu:/tmp/test$ git commit -m "Initial commit"
[master (root-commit) c5e16f3] Initial commit
 1 file changed, 1 insertion(+)
 create mode 100644 file.txt
bturner@ubuntu:/tmp/test$ echo "World" >> file.txt
bturner@ubuntu:/tmp/test$ git commit -am "Second commit"
[master 9214ac7] Second commit
 1 file changed, 1 insertion(+)
bturner@ubuntu:/tmp/test$ git push origin HEAD
Counting objects: 6, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (6/6), 446 bytes | 0 bytes/s, done.
Total 6 (delta 0), reused 0 (delta 0)
To /tmp/test.git
 * [new branch]      HEAD -> master
bturner@ubuntu:/tmp/test$ cd ../test.git/
bturner@ubuntu:/tmp/test.git$ git rev-list -1
--format="%H|%h|%P|%p|%aN|%aE|%at%n%B%n" 9214ac7
commit 9214ac79728424a971244c34432c6d948754198d
9214ac79728424a971244c34432c6d948754198d|9214ac7|c5e16f37164f1b7411685def64d7390775437f07|c5e16f3|Bryan
Turner|bturner@atlassian.com|1406539558
Second commit

bturner@ubuntu:/tmp/test.git$ /opt/git/2.0.3/bin/git diff-tree --no-renames --always --format="commit %H%n%H|%h|%P|%p|%aN|%aE|%at|%B%n" --root 9214ac79728424a971244c34432c6d948754198d commit 9214ac79728424a971244c34432c6d948754198d 9214ac79728424a971244c34432c6d948754198d|9214ac79728424a971244c34432c6d948754198d|c5e16f37164f1b7411685def64d7390775437f07|c5e16f37164f1b7411685def64d7390775437f07|Bryan Turner|bturner@atlassian.com|1406539558|Second commit

:100644 100644 e965047ad7c57865823c7d992b1d046ea66edf78 f9264f7fbd31ae7a18b7931ed8946fb0aebb0af3 M file.txt bturner@ubuntu:/tmp/test.git$ /opt/git/2.0.3/bin/git diff-tree --no-renames --always --format="commit %H%n%H|%h|%P|%p|%aN|%aE|%at|%B%n" --root --stdin --9214ac79728424a971244c34432c6d948754198d commit 9214ac79728424a971244c34432c6d948754198d 9214ac79728424a971244c34432c6d948754198d|9214ac79728424a971244c34432c6d948754198d|c5e16f37164f1b7411685def64d7390775437f07|c5e16f37164f1b7411685def64d7390775437f07|Bryan Turner|bturner@atlassian.com|1406539543|Initial commit

:100644 100644 e965047ad7c57865823c7d992b1d046ea66edf78 f9264f7fbd31ae7a18b7931ed8946fb0aebb0af3 M file.txt bturner@ubuntu:/tmp/test.git$

Running a git bisect between v2.0.1, which does not manifest this
issue, and v2.0.2 fingers the following commit:
bturner@ubuntu:~/Development/oss/git/git$ git bisect bad
c1b3c71f4b4571abb2b2a457122fd100dc9f7eb0 is the first bad commit
commit c1b3c71f4b4571abb2b2a457122fd100dc9f7eb0
Author: Jeff King <peff@peff.net>
Date:   Tue Jun 10 17:43:02 2014 -0400
    commit: convert commit->buffer to a slab
Bryan Turner
Next: Ramsay Jones
Message 1 of 14 in “git diff-tree commit detail bug in 2.0.2 and 2.0.3”
  1. Bryan TurnerJul 28, 2014
  2. Ramsay JonesJul 28, 2014
  3. Jeff KingJul 28, 2014
  4. Jeff KingJul 28, 2014
  5. Bryan TurnerJul 28, 2014
  6. Junio C HamanoJul 28, 2014
  7. Jeff KingJul 28, 2014
  8. Junio C HamanoJul 28, 2014
  9. Jeff KingJul 28, 2014
  10. Jeff KingJul 28, 2014
  11. Junio C HamanoJul 28, 2014
  12. Junio C HamanoJul 29, 2014
  13. Bryan TurnerJul 29, 2014
  14. Jeff KingJul 29, 2014

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.