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

Re: [BUG] GIT_INDEX environment variable ignored?

From
Michael J Gruber <git@drmicha.warpmail.net>
Date
Oct 8, 2015, 07:56 UTC
Message-ID
<561621A1.8090609@drmicha.warpmail.net>
In-Reply-To
<3316005380861448B5340D39CF27A7242F2375BE@us-voo-mb04.internal.sungard.corp>
McAuley, Ben venit, vidit, dixit 08.10.2015 06:48:
Show 30 quoted lines
> Hello,
> 
> I was trying to use multiple indexes earlier, and ran into an issue which I've summarised into a test case:
> 
> $ git init
> $ touch file1 && git add file1 && git commit -m "file1"
> $ git branch release 
> $ touch file2 && git add file2 && git commit -m "file2"
> $ cp .git/index .git/indexMaster
> $ git checkout release
> $ touch file3 && git add file3 && git commit -m "file3"
> 
> I then ran ls-files with the --stage option to look at what the index contains.
> As expected file1 and file3 are present, we're on the 'release' branch still.
> 
> $ git ls-files --stage
> 100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0       file1
> 100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0       file3
> 
> However when I run the same command again, this time using the 
> GIT_INDEX env variable to provide the index I previously saved on master,
> I don't see file2 like I'd expect...
> 
> $ GIT_INDEX=.git/indexMaster git ls-files --stage
> 100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0       file1
> 100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0       file3
> 
> Is this something going wrong, or am I misunderstanding the role of the index/GIT_INDEX variable?
> 
> Replicated on 2.5.0.windows.1 and 2.6.1 (Linux).
Maybe try GIT_INDEX_FILE instead of GIT_INDEX? ;)
Michael
Previous: Matthieu Moy
Message 3 of 3 in “[BUG] GIT_INDEX environment variable ignored?”
  1. McAuley, BenOct 8, 2015
  2. Matthieu MoyOct 8, 2015
  3. Michael J GruberOct 8, 2015

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.