git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v2] require_work_tree broken with NONGIT_OK

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 16, 2010, 06:46 UTC
Message-ID
<7vhbphd6eh.fsf@alter.siamese.dyndns.org>
In-Reply-To
<4B796BF8.7000408@gmail.com>
Gabriel Filion <lelutin@gmail.com> writes:
Show 9 quoted lines
> 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.
> ---
Sign-off?
Show 20 quoted lines
>
> This is a fixup rollout after discussion on the patch:
>  - Commit message better identifies the cause of the problem
>  - the test was not working in v1. fixed this up
>
>  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
Previous: Gabriel Filion
Message 2 of 2 in “Re: [PATCH v2] require_work_tree broken with NONGIT_OK”
  1. Gabriel FilionFeb 15, 2010
  2. Junio C HamanoFeb 16, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.