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 <julian@quantumfyre.co.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Julian Phillips committed
Jun 19, 2007 at 12:44 UTC
09381b458f5f1ac1a78df1aaeeb53aa79fcf2c4f
1 file changed
+5
contrib/workdir/git-new-workdir
+5
@@ -24,6 +24,11 @@ git_dir=$(cd "$orig_git" 2>/dev/null &&
24
git rev-parse --git-dir 2>/dev/null) ||
25
die "\"$orig_git\" is not a git repository!"
26
27
+if test "$git_dir" == ".git"
28
+then
29
+ git_dir="$orig_git/.git"
30
+fi
31
+
32
# don't link to a workdir
33
if test -L "$git_dir/config"
34
then