X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=contrib%2Fworkdir%2Fgit-new-workdir;h=7959eab902d28bb3307c542514ca4c5f49deee0f;hb=5fc3e67ac0241c491dcf1c0c9dcd4a4d83e7c243;hp=119cff98597f6539e88327bcafaa0bd5a88c020e;hpb=e301bfeea19e284344868840793c58d2e7529c74;p=git.git diff --git a/contrib/workdir/git-new-workdir b/contrib/workdir/git-new-workdir index 119cff985..7959eab90 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 @@ -40,6 +48,12 @@ then "a complete repository." fi +# don't recreate a workdir over an existing repository +if test -e "$new_workdir" +then + die "destination directory '$new_workdir' already exists." +fi + # make sure the the links use full paths git_dir=$(cd "$git_dir"; pwd) @@ -49,7 +63,7 @@ mkdir -p "$new_workdir/.git" || die "unable to create \"$new_workdir\"!" # create the links to the original repo. explictly exclude index, HEAD and # logs/HEAD from the list since they are purely related to the current working # directory, and should not be shared. -for x in config refs logs/refs objects info hooks packed-refs remotes rr-cache +for x in config refs logs/refs objects info hooks packed-refs remotes rr-cache svn do case $x in */*)