Don't allow contrib/workdir/git-new-workdir to trash existing dirs
[gitweb.git] / contrib / workdir / git-new-workdir
index c6e154a84fb5bdd4ed456ac3fdf94c54466fc5f0..2838546d16073f29b3a87ce9126d92b0f640be5e 100755 (executable)
@@ -48,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)