git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] require_work_tree broken with NONGIT_OK
@ 2010-02-15  3:51 Gabriel Filion
  2010-02-15  5:34 ` Jeff King
  2010-02-15  6:38 ` Junio C Hamano
  0 siblings, 2 replies; 6+ messages in thread
From: Gabriel Filion @ 2010-02-15  3:51 UTC (permalink / raw)
  To: git

When sourcing git-sh-setup after having set NONGIT_OK, calling the
function require_work_tree while outside of a git repository shows a
syntax error.

This is caused by the call to "git rev-parse --is-inside-work-tree"
printing a sentence when it is called outside of a git repository.
Relying on the return code is better.
---
 git-sh-setup.sh |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/git-sh-setup.sh b/git-sh-setup.sh
index d56426d..8de2f03 100755
--- a/git-sh-setup.sh
+++ b/git-sh-setup.sh
@@ -128,7 +128,7 @@ cd_to_toplevel () {
 }
  require_work_tree () {
-	test $(git rev-parse --is-inside-work-tree) = true ||
+	test git rev-parse --is-inside-work-tree >/dev/null 2>&1 ||
 	die "fatal: $0 cannot be used without a working tree."
 }
 -- 1.6.6

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2010-02-15 15:15 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-15  3:51 [PATCH] require_work_tree broken with NONGIT_OK Gabriel Filion
2010-02-15  5:34 ` Jeff King
2010-02-15  6:38 ` Junio C Hamano
2010-02-15  7:24   ` Gabriel Filion
2010-02-15  7:49   ` Jeff King
2010-02-15 15:14     ` Gabriel Filion

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).