{"thread":{"id":"35191","subject":"Bug report: using git commit-tree with \"-F -\" adds trailing newlines","startedAt":"2013-10-24T12:22:12Z","lastAt":"2013-10-24T12:22:12Z","messageCount":1,"participants":["Mickey Killianey"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"229397","messageId":"CACAUoX6zT0wXxCLXK+sk0e4hgfD_A_EWWKvWnTOXK0-hzw7BUg@mail.gmail.com","threadId":"35191","inReplyTo":null,"subject":"Bug report: using git commit-tree with \"-F -\" adds trailing newlines","fromName":"Mickey Killianey","fromEmail":"mickey@killianey.com","sentAt":"2013-10-24T12:22:12Z","receivedAt":"2013-10-24T12:22:12Z","isPatch":false,"sender":{"key":"mickey@killianey.com","avatar":null},"body":"I believe I've stumbled across an inconsistency in how git commit-tree\nreads messages from stdin.  I would expect the behavior of these two\ncommands to be identical, and that neither would actually change any\ncommits:\n\n    git filter-branch --commit-filter 'git commit-tree $@'\n    git filter-branch --commit-filter 'git commit-tree -F - $@'\n\n(If that assumption is untrue, please feel free to correct me and\ndisregard the rest of this message.)\n\nWhat I'm observing is that if I add a commit with a message that\ndoesn't end in a trailing newline, like this:\n\n    git merge `echo -n \"No trailing newline\" | git commit-tree\nHEAD^{tree} -p HEAD`\n\nThen I get different behavior in different versions of Git on\ndifferent platforms.  On git 1.8.4 on Ubuntu 12.04 (build from\nhttps://launchpad.net/~git-core/+archive/ppa) under GNU bash, version\n4.2.25(1)-release (x86_64-pc-linux-gnu), using \"-F -\" seems to add a\nlinefeed to the body:\n\n    $ git log -n 1 --format=:%H:%B:\n    : 4a11052c110c3daea46c89ae1118b1a2c59cc01b:No trailing newline:\n    $ git filter-branch --commit-filter 'git commit-tree $@'\n    Rewrite 4a11052c110c3daea46c89ae1118b1a2c59cc01b (2/2)\n    WARNING: Ref 'refs/heads/master' is unchanged\n    $ git filter-branch --commit-filter 'git commit-tree -F - $@'\n    Rewrite 4a11052c110c3daea46c89ae1118b1a2c59cc01b (2/2)\n    Ref 'refs/heads/master' was rewritten\n    $ git log -n 1 --format=:%H:%B:\n    :5ecba0ff0ca1290f2a5e3a599622e2a59e311f67:No trailing newline\n    :\n\nOn git 1.7.12.4 (Apple Git-37) on Mac OS X 10.8.5 using GNU bash,\nversion 3.2.48(1)-release (x86_64-apple-darwin12), both commands (with\nand without the \"-F -\" add newlines to the body of the commits.\n\nThanks for your attention!\n\nMick\n"}]}