aboutsummaryrefslogtreecommitdiff
path: root/contrib/workdir
diff options
context:
space:
mode:
authorShawn O. Pearce <spearce@spearce.org>2007-08-21 21:50:12 -0400
committerJunio C Hamano <gitster@pobox.com>2007-08-22 15:18:13 -0700
commite301bfeea19e284344868840793c58d2e7529c74 (patch)
treec872b36d5882a16e9a736439b1c940b7837b5a46 /contrib/workdir
parenta475e8095aeb898c1ca60673b82df97d2300cc95 (diff)
downloadgit-e301bfeea19e284344868840793c58d2e7529c74.tar.gz
git-e301bfeea19e284344868840793c58d2e7529c74.tar.xz
Fix new-workdir (again) to work on bare repositories
My day-job workflow involves using multiple workdirs attached to a bunch of bare repositories. Such repositories are stored inside of a directory called "foo.git", which means `git rev-parse --git-dir` will return "." and not ".git". Under such conditions new-workdir was getting confused about where the Git repository it was supplied is actually located. If we get "." for the result of --git-dir query it means we should use the user supplied path as-is, and not attempt to perform any magic on it, as the path is directly to the repository. Signed-off-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'contrib/workdir')
-rwxr-xr-xcontrib/workdir/git-new-workdir10
1 files changed, 7 insertions, 3 deletions
diff --git a/contrib/workdir/git-new-workdir b/contrib/workdir/git-new-workdir
index 3ff6bd166..119cff985 100755
--- a/contrib/workdir/git-new-workdir
+++ b/contrib/workdir/git-new-workdir
@@ -24,10 +24,14 @@ 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
+case "$git_dir" in
+.git)
git_dir="$orig_git/.git"
-fi
+ ;;
+.)
+ git_dir=$orig_git
+ ;;
+esac
# don't link to a workdir
if test -L "$git_dir/config"