diff options
author | Johannes Schindelin <Johannes.Schindelin@gmx.de> | 2007-01-23 13:30:20 +0100 |
---|---|---|
committer | Junio C Hamano <junkio@cox.net> | 2007-02-05 14:02:16 -0800 |
commit | 6d9ba67b0fc2f18c1d7a65514edbdcdf86429c1c (patch) | |
tree | ed60e9bec4aa2adc5aecde724614f3fa4a542971 /git-sh-setup.sh | |
parent | 98d47d4ccf76725e7833c1bbda1da82f7648925f (diff) | |
download | git-6d9ba67b0fc2f18c1d7a65514edbdcdf86429c1c.tar.gz |
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-x | git-sh-setup.sh | 3 |
1 files changed, 2 insertions, 1 deletions
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." } |