summaryrefslogtreecommitdiff
path: root/git-sh-setup.sh
diff options
context:
space:
mode:
authorGabriel Filion <lelutin@gmail.com>2010-02-17 04:18:50 (GMT)
committerJunio C Hamano <gitster@pobox.com>2010-02-17 18:55:12 (GMT)
commitab62677b1424d4e53cf222c973b841d3dada4cf3 (patch)
treeeea1673f92c67a29dfc94c016b31ba935936e473 /git-sh-setup.sh
parente90fdc39b6903502192b2dd11e5503cea721a1ad (diff)
downloadgit-ab62677b1424d4e53cf222c973b841d3dada4cf3.zip
git-ab62677b1424d4e53cf222c973b841d3dada4cf3.tar.gz
git-ab62677b1424d4e53cf222c973b841d3dada4cf3.tar.bz2
require_work_tree broken with NONGIT_OK
With NONGIT_OK set, require_work_tree function outside a git repository gives a syntax error. This is caused by an incorrect use of "test" that didn't anticipate $(git rev-parse --is-inside-work-tree) may return an empty string. Properly quote the argument to "test", and send the standard error stream to /dev/null to avoid giving duplicate error messages. Signed-off-by: Gabriel Filion <lelutin@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-sh-setup.sh')
-rwxr-xr-xgit-sh-setup.sh2
1 files changed, 1 insertions, 1 deletions
diff --git a/git-sh-setup.sh b/git-sh-setup.sh
index 7bef43f..d278941 100755
--- a/git-sh-setup.sh
+++ b/git-sh-setup.sh
@@ -59,7 +59,7 @@ cd_to_toplevel () {
}
require_work_tree () {
- test $(git rev-parse --is-inside-work-tree) = true ||
+ test "$(git rev-parse --is-inside-work-tree 2>/dev/null)" = true ||
die "fatal: $0 cannot be used without a working tree."
}