{"thread":{"id":"27839","subject":"Bug Report: Creating a hardlink to any of the file in git repo cause the source file to show up in git commit message editor under \"Changes not staged for commit\" section.","startedAt":"2011-07-18T03:24:50Z","lastAt":"2011-07-18T20:12:18Z","messageCount":2,"participants":["Michael","Andreas Schwab"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"171536","messageId":"6f37875d70623e2b8966653b067a2149@mail.mxes.net","threadId":"27839","inReplyTo":null,"subject":"Bug Report: Creating a hardlink to any of the file in git repo cause the source file to show up in git commit message editor under \"Changes not staged for commit\" section.","fromName":"Michael","fromEmail":"git-scm@webhippo.net","sentAt":"2011-07-18T03:24:50Z","receivedAt":"2011-07-18T03:24:50Z","isPatch":false,"sender":{"key":"git-scm@webhippo.net","avatar":null},"body":" Creating a hardlink to any of the file in git repo cause the source \n file\n to show up in git commit message editor under \"Changes not staged for \n commit\"\n section.\n\n Reproduced on:\n Ubuntu 10.04, Gentoo, FreeBSD\n Git version: 1.7.6\n\n Bug has been observed by atleast 3 people.\n\n Follow these steps to reproduce:\n\n # create test repo\n cd /tmp\n mkdir -p test-repo/repo\n cd test-repo/repo\n git init\n git config user.name \"Foo\"\n git config user.email \"foo@example.com\"\n\n # put some files in the repo\n touch FILE1 FILE2 FILE3 FILE4 FILE5\n git add -A\n git commit -m \"initial commit\"\n\n # create git hook that hardlink FILE2 and FILE3 and remove the \n hardlinks\n # right then and there\n echo \"ln -vf FILE2 ../HARDLINK_TO_FILE2\" >| .git/hooks/pre-commit\n echo \"rm -vf ../HARDLINK_TO_FILE2\" >> .git/hooks/pre-commit\n echo \"ln -vf FILE3 ../HARDLINK_TO_FILE3\" >> .git/hooks/pre-commit\n echo \"rm -vf ../HARDLINK_TO_FILE3\" >> .git/hooks/pre-commit\n\n # make pre-commit executable\n chmod u+x .git/hooks/pre-commit\n\n # modify FILE1\n echo \"hello world\" >> FILE1\n\n # run git status\n git status\n -------------------------------------------------------------------------------\n # On branch master\n # Changes not staged for commit:\n #   (use \"git add <file>...\" to update what will be committed)\n #   (use \"git checkout -- <file>...\" to discard changes in working \n directory)\n #\n #       modified:   FILE1\n #\n no changes added to commit (use \"git add\" and/or \"git commit -a\")\n -------------------------------------------------------------------------------\n\n # try commit using nano as commit editor and without usin -a flag\n VISUAL=nano git commit FILE1\n\n # Despite the fact that they are modified FILE2 and FILE3 will show in \n the\n # commit message, under \"Changes not staged for commit\" section\n # like so:\n\n --------------------------------------------------------------------------------\n # Please enter the commit message for your changes. Lines starting\n # with '#' will be ignored, and an empty message aborts the commit.\n # Explicit paths specified without -i nor -o; assuming --only paths...\n # On branch master\n # Changes to be committed:\n #   (use \"git reset HEAD <file>...\" to unstage)\n #\n #       modified:   FILE1\n #\n # Changes not staged for commit:\n #   (use \"git add <file>...\" to update what will be committed)\n #   (use \"git checkout -- <file>...\" to discard changes in working \n directory)\n #\n #       modified:   FILE2\n #       modified:   FILE3\n #\n --------------------------------------------------------------------------------\n\n\n In case anyone interested, tor me this happens when I do a python EGG \n build\n which hardlinks files in order to build.\n\n\n -- Michael\n"},{"id":"171606","messageId":"m28vrvfivx.fsf@igel.home","threadId":"27839","inReplyTo":"6f37875d70623e2b8966653b067a2149@mail.mxes.net","subject":"Re: Bug Report: Creating a hardlink to any of the file in git repo cause the source file to show up in git commit message editor under \"Changes not staged for commit\" section.","fromName":"Andreas Schwab","fromEmail":"schwab@linux-m68k.org","sentAt":"2011-07-18T20:12:18Z","receivedAt":"2011-07-18T20:12:18Z","isPatch":false,"sender":{"key":"schwab@linux-m68k.org","avatar":"https://avatars.githubusercontent.com/u/2175493?v=4"},"body":"Michael <git-scm@webhippo.net> writes:\n\n> In case anyone interested, tor me this happens when I do a python EGG\n> build\n> which hardlinks files in order to build.\n\nTry \"git config core.trustctime false\".  Adding a link changes ctime.\n\nAndreas.\n\n-- \nAndreas Schwab, schwab@linux-m68k.org\nGPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5\n\"And now for something completely different.\"\n"}]}