{"thread":{"id":"12760","subject":"\"git rev-parse --git-dir\" fails from inside .git/<any-subdir>","startedAt":"2008-03-18T23:38:28Z","lastAt":"2008-03-18T23:38:28Z","messageCount":1,"participants":["Jean-Luc Herren"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"72409","messageId":"47E05274.3070908@gmx.ch","threadId":"12760","inReplyTo":null,"subject":"\"git rev-parse --git-dir\" fails from inside .git/<any-subdir>","fromName":"Jean-Luc Herren","fromEmail":"jlh@gmx.ch","sentAt":"2008-03-18T23:38:28Z","receivedAt":"2008-03-18T23:38:28Z","isPatch":false,"sender":{"key":"jlh@gmx.ch","avatar":null},"body":"Hello list!\n\nI noticed that \"git rev-parse --git-dir\" doesn't work properly\nwhen called from inside a sub-directory of .git.  It seems\nsetup_git_directory_gently() is the problem, because it simply\ncalls chdir(\"..\") until \".\" is a valid git directory and it then\nsets GIT_DIR = \".\".  But this relative path only works as long as\nyou stay in the directory that setup_git_directory_gently() has\nput you in.  It won't work when git-sh-setup uses GIT_DIR=$(git\nrev-parse --git-dir).\n\nThis causes \"git repack -a -f\" to fail with \"Nothing new to pack.\"\nfrom inside .git/objects/pack, which would be handy to test\ndifferent parameters and compare the resulting pack files.\n\nI don't know whether setup_git_directory_gently() or rather\nbuiltin-rev-parse.c needs to be changed, I'll let someone else do\nthis as I don't know the code base well enough.\n\njlh\n"}]}