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

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.

From
MMichael <git-scm@webhippo.net>
Date
Jul 18, 2011, 03:24 UTC
Message-ID
<6f37875d70623e2b8966653b067a2149@mail.mxes.net>
 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.
 Reproduced on:
 Ubuntu 10.04, Gentoo, FreeBSD
 Git version: 1.7.6
 Bug has been observed by atleast 3 people.
 Follow these steps to reproduce:
 # create test repo
 cd /tmp
 mkdir -p test-repo/repo
 cd test-repo/repo
 git init
 git config user.name "Foo"
 git config user.email "foo@example.com"
 # put some files in the repo
 touch FILE1 FILE2 FILE3 FILE4 FILE5
 git add -A
 git commit -m "initial commit"
 # create git hook that hardlink FILE2 and FILE3 and remove the 
 hardlinks
 # right then and there
 echo "ln -vf FILE2 ../HARDLINK_TO_FILE2" >| .git/hooks/pre-commit
 echo "rm -vf ../HARDLINK_TO_FILE2" >> .git/hooks/pre-commit
 echo "ln -vf FILE3 ../HARDLINK_TO_FILE3" >> .git/hooks/pre-commit
 echo "rm -vf ../HARDLINK_TO_FILE3" >> .git/hooks/pre-commit
 # make pre-commit executable
 chmod u+x .git/hooks/pre-commit
 # modify FILE1
 echo "hello world" >> FILE1
 # run git status
 git status
 -------------------------------------------------------------------------------
 # On branch master
 # Changes not staged for commit:
 #   (use "git add <file>..." to update what will be committed)
 #   (use "git checkout -- <file>..." to discard changes in working 
 directory)
 #
 #       modified:   FILE1
 #
 no changes added to commit (use "git add" and/or "git commit -a")
 -------------------------------------------------------------------------------
 # try commit using nano as commit editor and without usin -a flag
 VISUAL=nano git commit FILE1
 # Despite the fact that they are modified FILE2 and FILE3 will show in 
 the
 # commit message, under "Changes not staged for commit" section
 # like so:
 --------------------------------------------------------------------------------
 # Please enter the commit message for your changes. Lines starting
 # with '#' will be ignored, and an empty message aborts the commit.
 # Explicit paths specified without -i nor -o; assuming --only paths...
 # On branch master
 # Changes to be committed:
 #   (use "git reset HEAD <file>..." to unstage)
 #
 #       modified:   FILE1
 #
 # Changes not staged for commit:
 #   (use "git add <file>..." to update what will be committed)
 #   (use "git checkout -- <file>..." to discard changes in working 
 directory)
 #
 #       modified:   FILE2
 #       modified:   FILE3
 #
 --------------------------------------------------------------------------------
 In case anyone interested, tor me this happens when I do a python EGG 
 build
 which hardlinks files in order to build.
 -- Michael
Next: Andreas Schwab
Message 1 of 2 in “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.”
  1. MichaelJul 18, 2011
  2. Andreas SchwabJul 18, 2011

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.