Skip to content

Commit 2823d92

Browse files
committed
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
2 parents 4ce0caa + 161e895 commit 2823d92

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

git.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ static int handle_alias(struct strvec *args)
371371
alias_command = args->v[0];
372372
alias_string = alias_lookup(alias_command);
373373
if (alias_string) {
374-
if (args->nr > 1 && !strcmp(args->v[1], "-h"))
374+
if (args->nr == 2 && !strcmp(args->v[1], "-h"))
375375
fprintf_ln(stderr, _("'%s' is aliased to '%s'"),
376376
alias_command, alias_string);
377377
if (alias_string[0] == '!') {

0 commit comments

Comments
 (0)