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

Re: [PATCH v2] git-help: add "help.format" config variable.

From
Junio C Hamano <gitster@pobox.com>
Date
Dec 15, 2007, 05:20 UTC
Message-ID
<7vir30o7oi.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<20071215055728.857b1924.chriscool@tuxfamily.org>
Christian Couder <chriscool@tuxfamily.org> writes:
> Note that this patch also revert some recent changes in
> "git-browse-help" because they prevented to look for config
> variables in the global configuration file.

You are right, but I think git-sh-setup can further be simplified, as NONGIT_OK users would just rely on the default behaviour of underlying plumbing (most notably "git config").

I do not think your change to help.c is sufficient to work inside a subdirectory. Here is an attempt to fix it on top of yours.

---
 git-sh-setup.sh |    7 +------
 help.c          |    3 +++
 2 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/git-sh-setup.sh b/git-sh-setup.sh
index b366761..270d559 100755
--- a/git-sh-setup.sh
+++ b/git-sh-setup.sh
@@ -124,13 +124,8 @@ get_author_ident_from_commit () {
 
 # Make sure we are in a valid repository of a vintage we understand,
 # if we require to be in a git repository.
-if test -n "$NONGIT_OK"
+if test -z "$NONGIT_OK"
 then
-	if git rev-parse --git-dir >/dev/null 2>&1
-	then
-		: ${GIT_DIR=.git}
-	fi
-else
 	if [ -z "$SUBDIRECTORY_OK" ]
 	then
 		: ${GIT_DIR=.git}
diff --git a/help.c b/help.c
index af0a433..551b5b9 100644
--- a/help.c
+++ b/help.c
@@ -374,6 +374,9 @@ int cmd_help(int argc, const char **argv, const char *prefix)
 	}
 
 	else {
+		int nongit;
+
+		setup_git_directory_gently(&nongit);
 		git_config(git_help_config);
 		if (help_default_format)
 			parse_help_format(help_default_format);
Previous: Christian Couder
Message 2 of 2 in “git-help: add "help.format" config variable.”
  1. git-help: add "help.format" config variable.Christian Couder, Dec 15, 2007
  2. Junio C HamanoDec 15, 2007

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.