"git rev-parse --git-dir" fails from inside .git/<any-subdir>
- From
- Jean-Luc Herren <jlh@gmx.ch>
- Date
- Mar 18, 2008, 23:38 UTC
- Message-ID
- <47E05274.3070908@gmx.ch>
Hello list!
I noticed that "git rev-parse --git-dir" doesn't work properly when called from inside a sub-directory of .git. It seems setup_git_directory_gently() is the problem, because it simply calls chdir("..") until "." is a valid git directory and it then sets GIT_DIR = ".". But this relative path only works as long as you stay in the directory that setup_git_directory_gently() has put you in. It won't work when git-sh-setup uses GIT_DIR=$(git rev-parse --git-dir).
This causes "git repack -a -f" to fail with "Nothing new to pack." from inside .git/objects/pack, which would be handy to test different parameters and compare the resulting pack files.
I don't know whether setup_git_directory_gently() or rather builtin-rev-parse.c needs to be changed, I'll let someone else do this as I don't know the code base well enough.
jlh