Skip to content

Commit 09381b4

Browse files
qurgitster
authored andcommitted
new-workdir: handle rev-parse --git-dir not always giving full path
rev-parse --git-dir outputs a full path - except for the single case of when the path would be $(pwd)/.git, in which case it outputs simply .git. Check for this special case and handle it. Signed-off-by: Julian Phillips <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent f58494b commit 09381b4

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

contrib/workdir/git-new-workdir

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ git_dir=$(cd "$orig_git" 2>/dev/null &&
2424
git rev-parse --git-dir 2>/dev/null) ||
2525
die "\"$orig_git\" is not a git repository!"
2626

27+
if test "$git_dir" == ".git"
28+
then
29+
git_dir="$orig_git/.git"
30+
fi
31+
2732
# don't link to a workdir
2833
if test -L "$git_dir/config"
2934
then

0 commit comments

Comments
 (0)