aboutsummaryrefslogtreecommitdiff
path: root/contrib/workdir
diff options
context:
space:
mode:
authorShawn O. Pearce <spearce@spearce.org>2007-08-22 01:33:49 -0400
committerJunio C Hamano <gitster@pobox.com>2007-08-22 15:18:13 -0700
commit8fa0ee3b50736eb869a3e13375bb041c1bf5aa12 (patch)
tree45210e42e398f44d74c983383d808800614cdfdf /contrib/workdir
parente301bfeea19e284344868840793c58d2e7529c74 (diff)
downloadgit-8fa0ee3b50736eb869a3e13375bb041c1bf5aa12.tar.gz
git-8fa0ee3b50736eb869a3e13375bb041c1bf5aa12.tar.xz
Suggest unsetting core.bare when using new-workdir on a bare repository
If core.bare is set to true in the config file of a repository that the user is trying to create a working directory from we should abort and suggest to the user that they remove the option first. If we leave the core.bare=true setting in the config file then working tree operations will get confused when they attempt to execute in the new workdir, as it shares its config file with the bare repository. The working tree operations will assume that the workdir is bare and abort, which is not what the user wants. If we changed core.bare to be false then working tree operations will function in the workdir but other operations may fail in the bare repository, as it claims to not be bare. If we remove core.bare from the config then Git can fallback on the legacy guessing behavior. This allows operations in the bare repository to work as though it were bare, while operations in the workdirs to act as though they are not bare. 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-workdir8
1 files changed, 8 insertions, 0 deletions
diff --git a/contrib/workdir/git-new-workdir b/contrib/workdir/git-new-workdir
index 119cff985..c6e154a84 100755
--- a/contrib/workdir/git-new-workdir
+++ b/contrib/workdir/git-new-workdir
@@ -33,6 +33,14 @@ case "$git_dir" in
;;
esac
+# don't link to a configured bare repository
+isbare=$(git --git-dir="$git_dir" config --bool --get core.bare)
+if test ztrue = z$isbare
+then
+ die "\"$git_dir\" has core.bare set to true," \
+ " remove from \"$git_dir/config\" to use $0"
+fi
+
# don't link to a workdir
if test -L "$git_dir/config"
then