X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;ds=sidebyside;f=show-branch.c;h=ccb0c73bf991bf6faeb8de25d0c0c176c8a5b9e1;hb=2f0f8b71ee45bcf91c2de480474a26030596fe3c;hp=958a5e884afdf8bc21d672242d6bbee8d3c7340a;hpb=7a034337420a45395b3f68a1f12ca53d8b0652be;p=git.git diff --git a/show-branch.c b/show-branch.c index 958a5e88..ccb0c73b 100644 --- a/show-branch.c +++ b/show-branch.c @@ -4,7 +4,7 @@ #include "refs.h" static const char show_branch_usage[] = -"git-show-branch [--all] [--heads] [--tags] [--more=count] [...]"; +"git-show-branch [--all] [--heads] [--tags] [--more=count] [--merge-base] [...]"; #define UNINTERESTING 01 @@ -291,6 +291,7 @@ static int show_merge_base(struct commit_list *seen, int num_rev) { int all_mask = ((1u << (REV_SHIFT + num_rev)) - 1); int all_revs = all_mask & ~((1u << REV_SHIFT) - 1); + int exit_status = 1; while (seen) { struct commit *commit = pop_one_commit(&seen); @@ -298,10 +299,11 @@ static int show_merge_base(struct commit_list *seen, int num_rev) if (!(flags & UNINTERESTING) && ((flags & all_revs) == all_revs)) { puts(sha1_to_hex(commit->object.sha1)); - return 0; + exit_status = 0; + commit->object.flags |= UNINTERESTING; } } - return 1; + return exit_status; } int main(int ac, char **av) @@ -317,6 +319,8 @@ int main(int ac, char **av) int merge_base = 0; char **label; + setup_git_directory(); + while (1 < ac && av[1][0] == '-') { char *arg = av[1]; if (!strcmp(arg, "--all"))