aboutsummaryrefslogtreecommitdiffstats
path: root/git.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2025-08-05 11:53:55 -0700
committerJunio C Hamano <gitster@pobox.com>2025-08-05 11:53:56 -0700
commit2823d928b4adf4083e846385a7045bdd24eb926b (patch)
tree06c2f96a83ccc228c7fdd651081d44721d3d6af8 /git.c
parent4ce0caa7cc27d50ee1bedf1dff03f13be4c54c1f (diff)
parent161e895e42f4fad83828c1c954adb9375f4b0092 (diff)
downloadgit-2823d928b4adf4083e846385a7045bdd24eb926b.tar.gz
Merge branch 'rs/tighten-alias-help'
"git -c alias.foo=bar foo -h baz" reported "'foo' is aliased to 'bar'" and then went on to run "git foo -h baz", which was unexpected. Tighten the rule so that alias expansion is reported only when "-h" is the sole option. * rs/tighten-alias-help: git: show alias info only with lone -h
Diffstat (limited to 'git.c')
-rw-r--r--git.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/git.c b/git.c
index 07a5fe39fb..83eac0aeab 100644
--- a/git.c
+++ b/git.c
@@ -371,7 +371,7 @@ static int handle_alias(struct strvec *args)
alias_command = args->v[0];
alias_string = alias_lookup(alias_command);
if (alias_string) {
- if (args->nr > 1 && !strcmp(args->v[1], "-h"))
+ if (args->nr == 2 && !strcmp(args->v[1], "-h"))
fprintf_ln(stderr, _("'%s' is aliased to '%s'"),
alias_command, alias_string);
if (alias_string[0] == '!') {