Code

Fix new-workdir (again) to work on bare repositories
[git.git] / contrib / workdir / git-new-workdir
index f2a3615bbc44ed4edbee4014683621a91c1a7ab9..119cff98597f6539e88327bcafaa0bd5a88c020e 100755 (executable)
@@ -24,6 +24,15 @@ git_dir=$(cd "$orig_git" 2>/dev/null &&
   git rev-parse --git-dir 2>/dev/null) ||
   die "\"$orig_git\" is not a git repository!"
 
+case "$git_dir" in
+.git)
+       git_dir="$orig_git/.git"
+       ;;
+.)
+       git_dir=$orig_git
+       ;;
+esac
+
 # don't link to a workdir
 if test -L "$git_dir/config"
 then