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

[PATCH 3/3] help: Add 'help.follow-alias' config item

From
Namhyung Kim <namhyung.kim@lge.com>
Date
Mar 15, 2012, 02:52 UTC
Message-ID
<1331779969-8641-3-git-send-email-namhyung.kim@lge.com>
In-Reply-To
<1331779969-8641-1-git-send-email-namhyung.kim@lge.com>

The 'help.follow-alias' config option is used to determine the default value of '--follow-alias' option. To do this, move some codes to honor the priority of command line options.

Signed-off-by: Namhyung Kim <namhyung.kim@lge.com>
---
 Documentation/git-help.txt |    8 ++++++++
 builtin/help.c             |   16 ++++++++--------
 2 files changed, 16 insertions(+), 8 deletions(-)
diff --git a/Documentation/git-help.txt b/Documentation/git-help.txt
index debf293..9725e9f 100644
--- a/Documentation/git-help.txt
+++ b/Documentation/git-help.txt
@@ -80,6 +80,14 @@ line option:
 * "info" corresponds to '-i|--info',
 * "web" or "html" correspond to '-w|--web'.
 
+help.follow-alias
+~~~~~~~~~~~~~~~~~
+
+If --[no-]follow-alias command line option is not passed, the
+'help.follow-alias' configuration variable will be checked. If it's
+set to true, alias name will be resolved to its original command and
+then will be displayed.
+
 help.browser, web.browser and browser.<tool>.path
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
diff --git a/builtin/help.c b/builtin/help.c
index 00392ea..bf782ee 100644
--- a/builtin/help.c
+++ b/builtin/help.c
@@ -260,6 +260,10 @@ static int git_help_config(const char *var, const char *value, void *cb)
 		help_format = parse_help_format(value);
 		return 0;
 	}
+	if (!strcmp(var, "help.follow-alias")) {
+		follow_alias = git_config_bool(var, value);
+		return 0;
+	}
 	if (!strcmp(var, "man.viewer")) {
 		if (!value)
 			return config_error_nonbool(var);
@@ -420,12 +424,14 @@ int cmd_help(int argc, const char **argv, const char *prefix)
 	int nongit;
 	const char *cmd;
 	const char *alias;
-	enum help_format parsed_help_format;
+
 	load_command_list("git-", &main_cmds, &other_cmds);
 
+	setup_git_directory_gently(&nongit);
+	git_config(git_help_config, NULL);
+
 	argc = parse_options(argc, argv, prefix, builtin_help_options,
 			builtin_help_usage, 0);
-	parsed_help_format = help_format;
 
 	if (show_all) {
 		printf("usage: %s\n\n", git_usage_string);
@@ -441,12 +447,6 @@ int cmd_help(int argc, const char **argv, const char *prefix)
 		return 0;
 	}
 
-	setup_git_directory_gently(&nongit);
-	git_config(git_help_config, NULL);
-
-	if (parsed_help_format != HELP_FORMAT_NONE)
-		help_format = parsed_help_format;
-
 	cmd = argv[0];
 	alias = alias_lookup(argv[0]);
 	if (alias && !is_git_command(argv[0])) {
-- 
1.7.9
Previous: Junio C HamanoNext: Junio C Hamano
Message 8 of 16 in “help: Fix help message for aliases”
  1. 1/3 help: Fix help message for aliasesNamhyung Kim, Mar 15, 2012
  2. 2/3 help: Add '--follow-alias' optionNamhyung Kim, Mar 15, 2012
  3. Junio C HamanoMar 15, 2012
  4. 김남형Mar 15, 2012
  5. Junio C HamanoMar 15, 2012
  6. Namhyung KimMar 15, 2012
  7. Junio C HamanoMar 15, 2012
  8. 3/3 help: Add 'help.follow-alias' config itemNamhyung Kim, Mar 15, 2012
  9. Junio C HamanoMar 15, 2012
  10. Namhyung KimMar 15, 2012
  11. Jeff KingMar 15, 2012
  12. 김남형Mar 15, 2012
  13. Jeff KingMar 15, 2012
  14. Junio C HamanoMar 15, 2012
  15. 김남형Mar 15, 2012
  16. Junio C HamanoMar 15, 2012

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.