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>
Gabriel Filion committed
Feb 16, 2010 at 23:18 UTC
ab62677b1424d4e53cf222c973b841d3dada4cf3
1 file changed
+1
-1
git-sh-setup.sh
+1
-1
@@ -59,7 +59,7 @@ cd_to_toplevel () {
59
}
60
61
require_work_tree () {
62
- test $(git rev-parse --is-inside-work-tree) = true ||
62
+ test "$(git rev-parse --is-inside-work-tree 2>/dev/null)" = true ||
63
die "fatal: $0 cannot be used without a working tree."
64
}
65