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>
This commit is contained in:

committed by
Junio C Hamano

parent
98d47d4ccf
commit
6d9ba67b0f
@ -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."
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user