From 6d9ba67b0fc2f18c1d7a65514edbdcdf86429c1c Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Tue, 23 Jan 2007 13:30:20 +0100 Subject: 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 Signed-off-by: Junio C Hamano --- git-sh-setup.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'git-sh-setup.sh') diff --git a/git-sh-setup.sh b/git-sh-setup.sh index b4aa4b2f4e..f24c7f2d23 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." } -- cgit v1.3