{"thread":{"id":"28225","subject":"Files that cannot be added to the index","startedAt":"2011-08-26T12:26:57Z","lastAt":"2011-08-27T21:44:33Z","messageCount":10,"participants":["seanh","Michael J Gruber","Shaun Ruffell","Jeff King"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"174312","messageId":"CAMvu5bLuRWinMYNc4NoRKQKiLCWLcwkpowEFT4GQ0mcJYj6eOg@mail.gmail.com","threadId":"28225","inReplyTo":null,"subject":"Files that cannot be added to the index","fromName":"seanh","fromEmail":"snhmnd@gmail.com","sentAt":"2011-08-26T12:26:57Z","receivedAt":"2011-08-26T12:26:57Z","isPatch":false,"sender":{"key":"snhmnd@gmail.com","avatar":null},"body":"Can anyone guess what's going on when I have a modified file that\nshows up in `git status`, but the file cannot be added to the index\n(or committed)? `git add FILE` does nothing, the file still shows as\nmodified but not added in `git status`.\n\nI have two different repos that have each developed this problem with\ntwo different files. I don't know how it happened. The problem occurs\nwherever the repos are cloned. Even if I delete the local copy (where\nI'm seeing the problem) and clone the repo again from elsewhere,\nproblem persists.\n"},{"id":"174320","messageId":"4E57A93A.6090405@drmicha.warpmail.net","threadId":"28225","inReplyTo":"CAMvu5bLuRWinMYNc4NoRKQKiLCWLcwkpowEFT4GQ0mcJYj6eOg@mail.gmail.com","subject":"Re: Files that cannot be added to the index","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2011-08-26T14:10:02Z","receivedAt":"2011-08-26T14:10:02Z","isPatch":false,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"seanh venit, vidit, dixit 26.08.2011 14:26:\n> Can anyone guess what's going on when I have a modified file that\n> shows up in `git status`, but the file cannot be added to the index\n> (or committed)? `git add FILE` does nothing, the file still shows as\n> modified but not added in `git status`.\n> \n> I have two different repos that have each developed this problem with\n> two different files. I don't know how it happened. The problem occurs\n> wherever the repos are cloned. Even if I delete the local copy (where\n> I'm seeing the problem) and clone the repo again from elsewhere,\n> problem persists.\n\nA log of your commands (or access to the repo) would help diagnose that,\nalong with information about the system and the git version.\n\nDo you \"clone\" by making a copy, by any chance?\n\nMichael\n"},{"id":"174347","messageId":"20110826205919.GB8107@sooty-2.local","threadId":"28225","inReplyTo":"4E57A93A.6090405@drmicha.warpmail.net","subject":"Re: Files that cannot be added to the index","fromName":"seanh","fromEmail":"snhmnd@gmail.com","sentAt":"2011-08-26T20:59:19Z","receivedAt":"2011-08-26T20:59:19Z","isPatch":false,"sender":{"key":"snhmnd@gmail.com","avatar":null},"body":"Unfortunately I can't share the repos, but I've pasted actual output\nshowing the problem below. I'm using git version 1.7.4.4 on OSX Lion,\nfrom macports. (I was having the problem on Snow Leopard too.) I am\nusing `git clone` to make the clone, but it's possible that at some\npoint the repo was moved or copied with things like mv, cp, rsync, maybe\nmoving across different filesystems.\n\nseanh@sooty-2:~ % cd /tmp \nseanh@sooty-2:/tmp % git clone ~/Dotfiles/home \nCloning into home...\ndone.\nseanh@sooty-2:/tmp % cd home \nseanh@sooty-2:/tmp/home % git status\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 directory)\n#\n# modified:   Text/LOG.txt\n#\nno changes added to commit (use \"git add\" and/or \"git commit -a\")\nseanh@sooty-2:/tmp/home % git diff\ndiff --git a/Text/LOG.txt b/Text/LOG.txt\nindex 317c80b..13edf26 100644\n--- a/Text/LOG.txt\n+++ b/Text/LOG.txt\n@@ -1,2 +1,21 @@\nCONTENTS OF DIFF SNIPPED\nseanh@sooty-2:/tmp/home % git add Text/LOG.txt \nseanh@sooty-2:/tmp/home % git status\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 directory)\n#\n# modified:   Text/LOG.txt\n#\nno changes added to commit (use \"git add\" and/or \"git commit -a\")\nseanh@sooty-2:/tmp/home % git add .; git commit\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 directory)\n#\n# modified:   Text/LOG.txt\n#\nno changes added to commit (use \"git add\" and/or \"git commit -a\")\nseanh@sooty-2:/tmp/home % (1) :(\n\nOn Fri, Aug 26, 2011 at 04:10:02PM +0200, Michael J Gruber wrote:\n> seanh venit, vidit, dixit 26.08.2011 14:26:\n> > Can anyone guess what's going on when I have a modified file that\n> > shows up in `git status`, but the file cannot be added to the index\n> > (or committed)? `git add FILE` does nothing, the file still shows as\n> > modified but not added in `git status`.\n> > \n> > I have two different repos that have each developed this problem with\n> > two different files. I don't know how it happened. The problem occurs\n> > wherever the repos are cloned. Even if I delete the local copy (where\n> > I'm seeing the problem) and clone the repo again from elsewhere,\n> > problem persists.\n> \n> A log of your commands (or access to the repo) would help diagnose that,\n> along with information about the system and the git version.\n> \n> Do you \"clone\" by making a copy, by any chance?\n> \n> Michael\n"},{"id":"174349","messageId":"20110826211233.GB3093@digium.com","threadId":"28225","inReplyTo":"20110826205919.GB8107@sooty-2.local","subject":"Re: Files that cannot be added to the index","fromName":"Shaun Ruffell","fromEmail":"sruffell@digium.com","sentAt":"2011-08-26T21:12:33Z","receivedAt":"2011-08-26T21:12:33Z","isPatch":false,"sender":{"key":"sruffell@digium.com","avatar":"https://gravatar.com/avatar/98c1f3cf2916ed758ad0b73c5ed830886447638dae3d3369d6eb852f0bf4d20e?d=mp&s=160"},"body":"On Fri, Aug 26, 2011 at 10:59:19PM +0200, seanh wrote:\n> I'm using git version 1.7.4.4 on OSX Lion, from macports. (I was\n> having the problem on Snow Leopard too.)\n\nNot sure if this is your problem exactly but awhile back I ran into\nsomething similar to what you describe and tracked it down to the\nfact that my filesystem was case insensitive. i.e.\n\n  $ git clone git://github.com/sruffell/dahdi-linux\n  Cloning into dahdi-linux...\n  done.\n\n  $ cd dahdi-linux/\n  $ ls\n  LICENSE      Makefile     UPGRADE.txt  drivers\n  LICENSE.LGPL README       build_tools  include\n\n  $ git ls-files -m\n  $ rm Makefile \n  $ touch makefile\n  $ git add makefile \n  $ git ls-files -m\n  Makefile\n\n  $ git commit\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 directory)\n  #\n  #\tmodified:   Makefile\n  #\n  no changes added to commit (use \"git add\" and/or \"git commit -a\")\n\n  $ git add makefile \n  $ git commit\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 directory)\n  #\n  #\tmodified:   Makefile\n  #\n  no changes added to commit (use \"git add\" and/or \"git commit -a\")\n"},{"id":"174371","messageId":"20110827060718.GA28136@sigill.intra.peff.net","threadId":"28225","inReplyTo":"20110826211233.GB3093@digium.com","subject":"Re: Files that cannot be added to the index","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2011-08-27T06:07:18Z","receivedAt":"2011-08-27T06:07:18Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Fri, Aug 26, 2011 at 04:12:33PM -0500, Shaun Ruffell wrote:\n\n> On Fri, Aug 26, 2011 at 10:59:19PM +0200, seanh wrote:\n> > I'm using git version 1.7.4.4 on OSX Lion, from macports. (I was\n> > having the problem on Snow Leopard too.)\n> \n> Not sure if this is your problem exactly but awhile back I ran into\n> something similar to what you describe and tracked it down to the\n> fact that my filesystem was case insensitive. i.e.\n> [...]\n>   $ git commit\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 directory)\n>   #\n>   #\tmodified:   Makefile\n>   #\n>   no changes added to commit (use \"git add\" and/or \"git commit -a\")\n> \n>   $ git add makefile \n>   $ git commit\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 directory)\n>   #\n>   #\tmodified:   Makefile\n>   #\n>   no changes added to commit (use \"git add\" and/or \"git commit -a\")\n\nI think both of you may be seeing the same bug I tracked down here:\n\n  http://thread.gmane.org/gmane.comp.version-control.git/173612/focus=174634\n\nDoes the patch from the very end of the thread solve the problem for\nyou? I should probably clean it up for inclusion in git.\n\n-Peff\n"},{"id":"174381","messageId":"20110827153536.GA291@sooty-2.local","threadId":"28225","inReplyTo":"20110826211233.GB3093@digium.com","subject":"Re: Files that cannot be added to the index","fromName":"seanh","fromEmail":"snhmnd@gmail.com","sentAt":"2011-08-27T15:35:36Z","receivedAt":"2011-08-27T15:35:36Z","isPatch":false,"sender":{"key":"snhmnd@gmail.com","avatar":null},"body":"On Fri, Aug 26, 2011 at 04:12:33PM -0500, Shaun Ruffell wrote:\n> Not sure if this is your problem exactly but awhile back I ran into\n> something similar to what you describe and tracked it down to the\n> fact that my filesystem was case insensitive. i.e.\n\nMy filesystem (HFS+ on OSX Lion) is case-insensitive, yeah. I bet you're\nright, because in one repo the modified file shows up in `git status` as\nLOG.txt but in the output from `ls` it is called `Log.txt`. It's the\nsame in the other repo that has the problem, the case of the filename\nthat is having the problem is different in `git status` and `ls`.\n\nPerhaps the problem might have been introduced by moving the repo from a\ncase-sensitive to an insensitive filesystem? Or by originally starting\nthe repo on a sensitive fs and then using git clone to clone it onto an\ninsensitive one. Or, maybe at some point I committed a change to the\ncase of the filename and that introduced a problem on case-insenstive\nfilesystems.\n\nDid you find a way around the problem? I guess that the repo does not\nreally have any uncommitted changes, so I just want to convince `git\nstatus` and `git diff` of this.\n"},{"id":"174382","messageId":"20110827153942.GB291@sooty-2.local","threadId":"28225","inReplyTo":"20110827060718.GA28136@sigill.intra.peff.net","subject":"Re: Files that cannot be added to the index","fromName":"seanh","fromEmail":"snhmnd@gmail.com","sentAt":"2011-08-27T15:39:42Z","receivedAt":"2011-08-27T15:39:42Z","isPatch":false,"sender":{"key":"snhmnd@gmail.com","avatar":null},"body":"On Sat, Aug 27, 2011 at 02:07:18AM -0400, Jeff King wrote:\n> I think both of you may be seeing the same bug I tracked down here:\n> \n>   http://thread.gmane.org/gmane.comp.version-control.git/173612/focus=174634\n\nI don't think it's the same problem. For me the problem does not occur\nwith any git repo, only with two repos in particular. Also, the output\nis not different every time, there are two files in particular that\nalways show up with phantom modifications in git status and git diff.\n"},{"id":"174384","messageId":"20110827184009.GA12767@digium.com","threadId":"28225","inReplyTo":"20110827060718.GA28136@sigill.intra.peff.net","subject":"Re: Files that cannot be added to the index","fromName":"Shaun Ruffell","fromEmail":"sruffell@digium.com","sentAt":"2011-08-27T18:40:09Z","receivedAt":"2011-08-27T18:40:09Z","isPatch":false,"sender":{"key":"sruffell@digium.com","avatar":"https://gravatar.com/avatar/98c1f3cf2916ed758ad0b73c5ed830886447638dae3d3369d6eb852f0bf4d20e?d=mp&s=160"},"body":"On Sat, Aug 27, 2011 at 02:07:18AM -0400, Jeff King wrote:\n> On Fri, Aug 26, 2011 at 04:12:33PM -0500, Shaun Ruffell wrote:\n> \n> > On Fri, Aug 26, 2011 at 10:59:19PM +0200, seanh wrote:\n> > > I'm using git version 1.7.4.4 on OSX Lion, from macports. (I was\n> > > having the problem on Snow Leopard too.)\n> > \n> > Not sure if this is your problem exactly but awhile back I ran into\n> > something similar to what you describe and tracked it down to the\n> > fact that my filesystem was case insensitive. i.e.\n> \n> I think both of you may be seeing the same bug I tracked down here:\n> \n>   http://thread.gmane.org/gmane.comp.version-control.git/173612/focus=174634\n> \n> Does the patch from the very end of the thread solve the problem for\n> you? I should probably clean it up for inclusion in git.\n\nI was going to apply the patch and see what happens, however when I\nbuilt and tested 1.7.6 as a baseline I no longer could reproduce the\nissue.\n\n  $ git commit -m \"Makefile\"\n  [master a931b27] Makefile\n   1 files changed, 0 insertions(+), 222 deletions(-)\n   delete mode 100644 Makefile\n   create mode 100644 makefile\n  $ git ls-files -m\n\nThe previous version I had installed from one of the OSX package\nmanagers (not sure if it was fink or Macports) was 1.6.5.3.\n\nNOTE: I had to compile git from source like \"NO_FINK=1 make\" in\norder to avoid the \"ld: warning: in /sw/lib/libiconv.dylib, file is\nnot of required architecture\" error message.\n\nSo, in summary, it looks like this is fixed.\n\nThanks,\nShaun\n"},{"id":"174390","messageId":"20110827192655.GA14333@digium.com","threadId":"28225","inReplyTo":"20110827184009.GA12767@digium.com","subject":"Re: Files that cannot be added to the index","fromName":"Shaun Ruffell","fromEmail":"sruffell@digium.com","sentAt":"2011-08-27T19:26:55Z","receivedAt":"2011-08-27T19:26:55Z","isPatch":false,"sender":{"key":"sruffell@digium.com","avatar":"https://gravatar.com/avatar/98c1f3cf2916ed758ad0b73c5ed830886447638dae3d3369d6eb852f0bf4d20e?d=mp&s=160"},"body":"On Sat, Aug 27, 2011 at 01:40:09PM -0500, Shaun Ruffell wrote:\n> \n> So, in summary, it looks like this is fixed.\n\nActually, after playing with it a little more on OSX, I think it was\njust operator error on my part and that, for this, the versions are\nbehaving the same.\n\nAdding a non-existent file produces an error:\n  $ git add adjaskdj\n  fatal: pathspec 'adjaskdj' did not match any files\n\nAdding a file that is on the filesystem but only differs in case with a\nfile in the index silently fails:\n\n  $ mv Makefile makefile\n  $ echo \"hello\" >> makefile\n  $ git ls-files -m\n  Makefile\n  $ git add makefile\n\nAnd then when you try to commit the file you just added it fails:\n\n  $ git commit\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 directory)\n  #\n  #\tmodified:   Makefile\n  #\n  no changes added to commit (use \"git add\" and/or \"git commit -a\")\n\nAdding a file that is in the index, but only differs by case with a file\nin the filesystem works:\n\n  $ git add Makefile\n  $ git commit -m \"test\"\n  [master 8de0bd6] test\n   1 files changed, 1 insertions(+), 0 deletions(-)\n"},{"id":"174397","messageId":"20110827214433.GA347@maru.local","threadId":"28225","inReplyTo":"20110827153536.GA291@sooty-2.local","subject":"Re: Files that cannot be added to the index","fromName":"seanh","fromEmail":"snhmnd@gmail.com","sentAt":"2011-08-27T21:44:33Z","receivedAt":"2011-08-27T21:44:33Z","isPatch":false,"sender":{"key":"snhmnd@gmail.com","avatar":null},"body":"On Sat, Aug 27, 2011 at 05:35:36PM +0200, seanh wrote:\n> On Fri, Aug 26, 2011 at 04:12:33PM -0500, Shaun Ruffell wrote:\n> > Not sure if this is your problem exactly but awhile back I ran into\n> > something similar to what you describe and tracked it down to the\n> > fact that my filesystem was case insensitive. i.e.\n> \n> My filesystem (HFS+ on OSX Lion) is case-insensitive, yeah. I bet you're\n> right, because in one repo the modified file shows up in `git status` as\n> LOG.txt but in the output from `ls` it is called `Log.txt`. It's the\n> same in the other repo that has the problem, the case of the filename\n> that is having the problem is different in `git status` and `ls`.\n> \n> Perhaps the problem might have been introduced by moving the repo from a\n> case-sensitive to an insensitive filesystem? Or by originally starting\n> the repo on a sensitive fs and then using git clone to clone it onto an\n> insensitive one. Or, maybe at some point I committed a change to the\n> case of the filename and that introduced a problem on case-insenstive\n> filesystems.\n> \n> Did you find a way around the problem? I guess that the repo does not\n> really have any uncommitted changes, so I just want to convince `git\n> status` and `git diff` of this.\n\nI think I fixed it like this:\n\n  git config core.ignorecase false\n\nthen backup the LOG.txt file and:\n\n  git rm Text/Log.txt\n  git rm Text/LOG.txt\n  git commit\n\nthen copy the LOG.txt file back again and add and commit it. Seems to be\nokay now.\n"}]}