Skip to content

Commit b02a94d

Browse files
committed
Merge branch 'mh/show-branch-topic'
"git show-branch --topics HEAD" (with no other arguments) did not do anything interesting. Instead, contrast the given revision against all the local branches by default. * mh/show-branch-topic: show-branch: show all local heads when only giving one rev along --topics
2 parents 8ff1ddd + 539d09c commit b02a94d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

builtin/show-branch.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -718,7 +718,7 @@ int cmd_show_branch(int ac, const char **av, const char *prefix)
718718
}
719719

720720
/* If nothing is specified, show all branches by default */
721-
if (ac + all_heads + all_remotes == 0)
721+
if (ac <= topics && all_heads + all_remotes == 0)
722722
all_heads = 1;
723723

724724
if (reflog) {
@@ -785,13 +785,13 @@ int cmd_show_branch(int ac, const char **av, const char *prefix)
785785
}
786786
free(ref);
787787
}
788-
else if (all_heads + all_remotes)
789-
snarf_refs(all_heads, all_remotes);
790788
else {
791789
while (0 < ac) {
792790
append_one_rev(*av);
793791
ac--; av++;
794792
}
793+
if (all_heads + all_remotes)
794+
snarf_refs(all_heads, all_remotes);
795795
}
796796

797797
head_p = resolve_ref_unsafe("HEAD", RESOLVE_REF_READING,

0 commit comments

Comments
 (0)