rev-list --left-right
The output from "symmetric diff", i.e. A...B, does not
distinguish between commits that are reachable from A and the
ones that are reachable from B. In this picture, such a
symmetric diff includes commits marked with a and b.
x---b---b branch B
/ \ /
/ .
/ / \
o---x---a---a branch A
However, you cannot tell which ones are 'a' and which ones are
'b' from the output. Sometimes this is frustrating. This adds
an output option, --left-right, to rev-list.
rev-list --left-right A...B
would show ones reachable from A prefixed with '<' and the ones
reachable from B prefixed with '>'.
When combined with --boundary, boundary commits (the ones marked
with 'x' in the above picture) are shown with prefix '-', so you
would see list that looks like this:
git rev-list --left-right --boundary --pretty=oneline A...B
>bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb 3rd on b
>bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb 2nd on b
<aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 3rd on a
<aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 2nd on a
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 1st on b
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 1st on a
Signed-off-by: Junio C Hamano <junkio@cox.net>
This commit is contained in:
@ -344,6 +344,7 @@ static void try_to_simplify_commit(struct rev_info *revs, struct commit *commit)
|
||||
static void add_parents_to_list(struct rev_info *revs, struct commit *commit, struct commit_list **list)
|
||||
{
|
||||
struct commit_list *parent = commit->parents;
|
||||
unsigned left_flag;
|
||||
|
||||
if (commit->object.flags & ADDED)
|
||||
return;
|
||||
@ -388,6 +389,7 @@ static void add_parents_to_list(struct rev_info *revs, struct commit *commit, st
|
||||
if (revs->no_walk)
|
||||
return;
|
||||
|
||||
left_flag = (commit->object.flags & SYMMETRIC_LEFT);
|
||||
parent = commit->parents;
|
||||
while (parent) {
|
||||
struct commit *p = parent->item;
|
||||
@ -395,6 +397,7 @@ static void add_parents_to_list(struct rev_info *revs, struct commit *commit, st
|
||||
parent = parent->next;
|
||||
|
||||
parse_commit(p);
|
||||
p->object.flags |= left_flag;
|
||||
if (p->object.flags & SEEN)
|
||||
continue;
|
||||
p->object.flags |= SEEN;
|
||||
@ -640,7 +643,7 @@ int handle_revision_arg(const char *arg, struct rev_info *revs,
|
||||
add_pending_commit_list(revs, exclude,
|
||||
flags_exclude);
|
||||
free_commit_list(exclude);
|
||||
a->object.flags |= flags;
|
||||
a->object.flags |= flags | SYMMETRIC_LEFT;
|
||||
} else
|
||||
a->object.flags |= flags_exclude;
|
||||
b->object.flags |= flags;
|
||||
|
||||
Reference in New Issue
Block a user