Show all merge-base candidates from show-branch --merge-base
This would make things easier to use for Octopus. Signed-off-by: Junio C Hamano <junkio@cox.net>
This commit is contained in:
parent
35ef3a4c63
commit
2f0f8b71ee
@ -33,8 +33,8 @@ OPTIONS
|
|||||||
|
|
||||||
--merge-base::
|
--merge-base::
|
||||||
Instead of showing the commit list, just act like the
|
Instead of showing the commit list, just act like the
|
||||||
'git-merge-base' command except that it can accept more
|
'git-merge-base -a' command, except that it can accept
|
||||||
than two heads.
|
more than two heads.
|
||||||
|
|
||||||
|
|
||||||
OUTPUT
|
OUTPUT
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
#include "refs.h"
|
#include "refs.h"
|
||||||
|
|
||||||
static const char show_branch_usage[] =
|
static const char show_branch_usage[] =
|
||||||
"git-show-branch [--all] [--heads] [--tags] [--more=count] [<refs>...]";
|
"git-show-branch [--all] [--heads] [--tags] [--more=count] [--merge-base] [<refs>...]";
|
||||||
|
|
||||||
#define UNINTERESTING 01
|
#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_mask = ((1u << (REV_SHIFT + num_rev)) - 1);
|
||||||
int all_revs = all_mask & ~((1u << REV_SHIFT) - 1);
|
int all_revs = all_mask & ~((1u << REV_SHIFT) - 1);
|
||||||
|
int exit_status = 1;
|
||||||
|
|
||||||
while (seen) {
|
while (seen) {
|
||||||
struct commit *commit = pop_one_commit(&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) &&
|
if (!(flags & UNINTERESTING) &&
|
||||||
((flags & all_revs) == all_revs)) {
|
((flags & all_revs) == all_revs)) {
|
||||||
puts(sha1_to_hex(commit->object.sha1));
|
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)
|
int main(int ac, char **av)
|
||||||
|
Loading…
Reference in New Issue
Block a user