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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxx>
---
 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

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]