{"thread":{"id":"40513","subject":"[BUG] GIT_INDEX environment variable ignored?","startedAt":"2015-10-08T04:48:46Z","lastAt":"2015-10-08T07:56:17Z","messageCount":3,"participants":["McAuley, Ben","Matthieu Moy","Michael J Gruber"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"271293","messageId":"3316005380861448B5340D39CF27A7242F2375BE@us-voo-mb04.internal.sungard.corp","threadId":"40513","inReplyTo":null,"subject":"[BUG] GIT_INDEX environment variable ignored?","fromName":"McAuley, Ben","fromEmail":"ben.mcauley@sungard.com","sentAt":"2015-10-08T04:48:46Z","receivedAt":"2015-10-08T04:48:46Z","isPatch":false,"sender":{"key":"ben.mcauley@sungard.com","avatar":null},"body":"Hello,\n\nI was trying to use multiple indexes earlier, and ran into an issue which I've summarised into a test case:\n\n$ git init\n$ touch file1 && git add file1 && git commit -m \"file1\"\n$ git branch release \n$ touch file2 && git add file2 && git commit -m \"file2\"\n$ cp .git/index .git/indexMaster\n$ git checkout release\n$ touch file3 && git add file3 && git commit -m \"file3\"\n\nI then ran ls-files with the --stage option to look at what the index contains.\nAs expected file1 and file3 are present, we're on the 'release' branch still.\n\n$ git ls-files --stage\n100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0       file1\n100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0       file3\n\nHowever when I run the same command again, this time using the \nGIT_INDEX env variable to provide the index I previously saved on master,\nI don't see file2 like I'd expect...\n\n$ GIT_INDEX=.git/indexMaster git ls-files --stage\n100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0       file1\n100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0       file3\n\nIs this something going wrong, or am I misunderstanding the role of the index/GIT_INDEX variable?\n\nReplicated on 2.5.0.windows.1 and 2.6.1 (Linux).\n\nThanks,\nBen\n"},{"id":"271296","messageId":"vpqy4fd2500.fsf@grenoble-inp.fr","threadId":"40513","inReplyTo":"3316005380861448B5340D39CF27A7242F2375BE@us-voo-mb04.internal.sungard.corp","subject":"Re: [BUG] GIT_INDEX environment variable ignored?","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@grenoble-inp.fr","sentAt":"2015-10-08T07:28:47Z","receivedAt":"2015-10-08T07:28:47Z","isPatch":false,"sender":{"key":"matthieu.moy@grenoble-inp.fr","avatar":"https://gravatar.com/avatar/72c8a2705971a25dfaff23cece15130d405685845d911aedd5667ace277f3fc5?d=mp&s=160"},"body":"\"McAuley, Ben\" <Ben.McAuley@sungard.com> writes:\n\n> However when I run the same command again, this time using the \n> GIT_INDEX env variable to provide the index I previously saved on master,\n> I don't see file2 like I'd expect...\n\nThe variable name is GIT_INDEX_FILE (read 'man git' for details) ...\n\n-- \nMatthieu Moy\nhttp://www-verimag.imag.fr/~moy/\n"},{"id":"271298","messageId":"561621A1.8090609@drmicha.warpmail.net","threadId":"40513","inReplyTo":"3316005380861448B5340D39CF27A7242F2375BE@us-voo-mb04.internal.sungard.corp","subject":"Re: [BUG] GIT_INDEX environment variable ignored?","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2015-10-08T07:56:17Z","receivedAt":"2015-10-08T07:56:17Z","isPatch":false,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"McAuley, Ben venit, vidit, dixit 08.10.2015 06:48:\n> Hello,\n> \n> I was trying to use multiple indexes earlier, and ran into an issue which I've summarised into a test case:\n> \n> $ git init\n> $ touch file1 && git add file1 && git commit -m \"file1\"\n> $ git branch release \n> $ touch file2 && git add file2 && git commit -m \"file2\"\n> $ cp .git/index .git/indexMaster\n> $ git checkout release\n> $ touch file3 && git add file3 && git commit -m \"file3\"\n> \n> I then ran ls-files with the --stage option to look at what the index contains.\n> As expected file1 and file3 are present, we're on the 'release' branch still.\n> \n> $ git ls-files --stage\n> 100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0       file1\n> 100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0       file3\n> \n> However when I run the same command again, this time using the \n> GIT_INDEX env variable to provide the index I previously saved on master,\n> I don't see file2 like I'd expect...\n> \n> $ GIT_INDEX=.git/indexMaster git ls-files --stage\n> 100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0       file1\n> 100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0       file3\n> \n> Is this something going wrong, or am I misunderstanding the role of the index/GIT_INDEX variable?\n> \n> Replicated on 2.5.0.windows.1 and 2.6.1 (Linux).\n\nMaybe try GIT_INDEX_FILE instead of GIT_INDEX? ;)\n\nMichael\n"}]}