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

[PATCH] builtin-help: always load_command_list() in cmd_help()

From
Miklos Vajna <vmiklos@frugalware.org>
Date
Jul 30, 2008, 22:38 UTC
Message-ID
<1217457487-6509-1-git-send-email-vmiklos@frugalware.org>
In-Reply-To
<C0DB03B0-8AF5-4B6A-A9DB-16608128EB31@sb.org>

When cmd_help() is called, we always need the list of main and other commands, not just when the list of all commands is shown. Before this patch 'git help diff' invoked 'man gitdiff' because cmd_to_page() thought 'diff' is not a git command.

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
---
On Wed, Jul 30, 2008 at 01:52:26PM -0700, Kevin Ballard <kevin@sb.org> wrote:
> `git help diff` no longer finds the git-diff manpage (as of tip of
> next branch). I haven't tested, but I suspect
> 940208a771066229bc6a486f6a058e332b71cfe4 is responsible.
This fixed the issue for me.
Thanks!
 help.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/help.c b/help.c
index 88c0d5b..968f368 100644
--- a/help.c
+++ b/help.c
@@ -690,6 +690,7 @@ int cmd_help(int argc, const char **argv, const char *prefix)
 {
 	int nongit;
 	const char *alias;
+	unsigned int longest = load_command_list("git-", &main_cmds, &other_cmds);
 
 	setup_git_directory_gently(&nongit);
 	git_config(git_help_config, NULL);
@@ -698,7 +699,6 @@ int cmd_help(int argc, const char **argv, const char *prefix)
 			builtin_help_usage, 0);
 
 	if (show_all) {
-		unsigned int longest = load_command_list("git-", &main_cmds, &other_cmds);
 		printf("usage: %s\n\n", git_usage_string);
 		list_commands("git commands", longest, &main_cmds, &other_cmds);
 		printf("%s\n", git_more_info_string);
-- 
1.6.0.rc0.14.g95f8.dirty
Previous: Kevin BallardNext: Kevin Ballard
Message 2 of 13 in “git help broken”
  1. Kevin BallardJul 30, 2008
  2. builtin-help: always load_command_list() in cmd_help()Miklos Vajna, Jul 30, 2008
  3. Kevin BallardJul 30, 2008
  4. Johannes SchindelinJul 30, 2008
  5. Johannes SchindelinJul 30, 2008
  6. Miklos VajnaJul 31, 2008
  7. Christian CouderAug 1, 2008
  8. Miklos VajnaAug 1, 2008
  9. Builtin git-help.Miklos Vajna, Aug 2, 2008
  10. Christian CouderAug 21, 2008
  11. Fix 'git help help'Miklos Vajna, Aug 21, 2008
  12. Christian CouderAug 22, 2008
  13. Kevin BallardJul 30, 2008

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.