aboutsummaryrefslogtreecommitdiff
path: root/git-sh-setup.sh
diff options
context:
space:
mode:
authorJohannes Schindelin <Johannes.Schindelin@gmx.de>2007-01-23 13:30:20 +0100
committerJunio C Hamano <junkio@cox.net>2007-02-05 14:02:16 -0800
commit6d9ba67b0fc2f18c1d7a65514edbdcdf86429c1c (patch)
treeed60e9bec4aa2adc5aecde724614f3fa4a542971 /git-sh-setup.sh
parent98d47d4ccf76725e7833c1bbda1da82f7648925f (diff)
downloadgit-6d9ba67b0fc2f18c1d7a65514edbdcdf86429c1c.tar.gz
git-6d9ba67b0fc2f18c1d7a65514edbdcdf86429c1c.tar.xz
Commands requiring a work tree must not run in GIT_DIR
This patch helps when you accidentally run something like git-clean in the git directory instead of the work tree. Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'git-sh-setup.sh')
-rwxr-xr-xgit-sh-setup.sh3
1 files changed, 2 insertions, 1 deletions
diff --git a/git-sh-setup.sh b/git-sh-setup.sh
index b4aa4b2f4..f24c7f2d2 100755
--- a/git-sh-setup.sh
+++ b/git-sh-setup.sh
@@ -48,7 +48,8 @@ cd_to_toplevel () {
}
require_work_tree () {
- test $(is_bare_repository) = false ||
+ test $(is_bare_repository) = false &&
+ test $(git-rev-parse --is-inside-git-dir) = false ||
die "fatal: $0 cannot be used without a working tree."
}