Skip to content

Commit

Permalink
new-workdir: handle rev-parse --git-dir not always giving full path
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
qur authored and gitster committed Jun 24, 2007
1 parent f58494b commit 09381b4
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions contrib/workdir/git-new-workdir
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ git_dir=$(cd "$orig_git" 2>/dev/null &&
git rev-parse --git-dir 2>/dev/null) ||
die "\"$orig_git\" is not a git repository!"

if test "$git_dir" == ".git"
then
git_dir="$orig_git/.git"
fi

# don't link to a workdir
if test -L "$git_dir/config"
then
Expand Down

0 comments on commit 09381b4

Please sign in to comment.