git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Gabriel Filion <lelutin@gmail.com>
To: git@vger.kernel.org
Cc: Junio C Hamano <gitster@pobox.com>, Jeff King <peff@peff.net>
Subject: Re: [PATCH v2] require_work_tree broken with NONGIT_OK
Date: Tue, 16 Feb 2010 23:18:50 -0500	[thread overview]
Message-ID: <4B7B6E2A.3050704@gmail.com> (raw)

Sourcing git-sh-setup: After having set NONGIT_OK, when 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 nothing when it is called outside of a git repository.

Quoting the call removes the syntax error and sending stderr to
/dev/null removes duplicate error messages.

Signed-off-by: Gabriel Filion <lelutin@gmail.com>
---
 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..5e22440 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 2>/dev/null)" = true ||
 	die "fatal: $0 cannot be used without a working tree."
 }
 -- 1.6.6

             reply	other threads:[~2010-02-17  4:19 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-17  4:18 Gabriel Filion [this message]
  -- strict thread matches above, loose matches on Subject: below --
2010-02-15 15:44 [PATCH v2] require_work_tree broken with NONGIT_OK Gabriel Filion
2010-02-16  6:46 ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4B7B6E2A.3050704@gmail.com \
    --to=lelutin@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=peff@peff.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).