Skip to contentSkip to conversation

update-index: allow "-h" to also display options

PATCH In review Antoine Pelisse 2 participants 3 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 update-index: allow "-h" to also display options

Currently, when running "git update-index -h", you only have usage displayed, but no options. That is not consistent with the behavior of other commands. It also means that the only way to display options is to use an unknown argument (or use the man page).

Display usage with options when "git update-index -h" is invoked.

---
 builtin/update-index.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
builtin/update-index.c +1 -1
index ada1dff..3071ee6 100644
@@ -796,7 +796,7 @@ int cmd_update_index(int argc, const char **argv, const char *prefix)
 	};
 
 	if (argc == 2 && !strcmp(argv[1], "-h"))
-		usage(update_index_usage[0]);
+		usage_with_options(&update_index_usage[0], options);
 
 	git_config(git_default_config, NULL);
 
Signature · 1 line
1.7.9.5
#1 lore raw

builtin/update-index.c int cmd_update_index(int argc, const char **argv, const char *prefix) · line 802

Quoted 13 lines
builtin/update-index.c +1 -1
index ada1dff..3071ee6 100644
@@ -796,7 +796,7 @@ int cmd_update_index(int argc, const char **argv, const char *prefix)
        };
 
        if (argc == 2 && !strcmp(argv[1], "-h"))
-               usage(update_index_usage[0]);
+               usage_with_options(&update_index_usage[0], options);
 
        git_config(git_default_config, NULL);
 

Ok I just realized that

    usage_with_options(update_index_usage, options);

would be better...

Antoine,

#2 lore raw
Quoted 11 lines · Antoine Pelisse
Quoted 11 lines
builtin/update-index.c +1 -1
index ada1dff..3071ee6 100644
@@ -796,7 +796,7 @@ int cmd_update_index(int argc, const char **argv, const char *prefix)
        };
 
        if (argc == 2 && !strcmp(argv[1], "-h"))
-               usage(update_index_usage[0]);
+               usage_with_options(&update_index_usage[0], options);
 
Quoted 8 lines

builtin/update-index.c int cmd_update_index(int argc, const char **argv, const char *prefix) · line 802

Quoted 2 lines
builtin/update-index.c +0 -0
        git_config(git_default_config, NULL);
 

Ok I just realized that

    usage_with_options(update_index_usage, options);

would be better...

Yeah, that probably is easier on the eyes, even though they are equivalent.

Thanks, will queue.