aboutsummaryrefslogtreecommitdiff
path: root/builtin-rev-list.c
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2006-10-22 17:32:47 -0700
committerJunio C Hamano <junkio@cox.net>2006-12-17 10:35:28 -0800
commit577ed5c20b4ca374626c104f90c88550cf415067 (patch)
tree189e4520aa6ce62ff387dbfa3690e5574a93e115 /builtin-rev-list.c
parentee6002aa429272871733b8fbc99a9e6df3e150f5 (diff)
downloadgit-577ed5c20b4ca374626c104f90c88550cf415067.tar.gz
git-577ed5c20b4ca374626c104f90c88550cf415067.tar.xz
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>
Diffstat (limited to 'builtin-rev-list.c')
-rw-r--r--builtin-rev-list.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/builtin-rev-list.c b/builtin-rev-list.c
index fb7fc9214..4364035e1 100644
--- a/builtin-rev-list.c
+++ b/builtin-rev-list.c
@@ -45,6 +45,7 @@ static int bisect_list;
static int show_timestamp;
static int hdr_termination;
static const char *header_prefix;
+static int show_left_right;
static void show_commit(struct commit *commit)
{
@@ -54,6 +55,12 @@ static void show_commit(struct commit *commit)
fputs(header_prefix, stdout);
if (commit->object.flags & BOUNDARY)
putchar('-');
+ else if (show_left_right) {
+ if (commit->object.flags & SYMMETRIC_LEFT)
+ putchar('<');
+ else
+ putchar('>');
+ }
if (revs.abbrev_commit && revs.abbrev)
fputs(find_unique_abbrev(commit->object.sha1, revs.abbrev),
stdout);
@@ -240,6 +247,10 @@ int cmd_rev_list(int argc, const char **argv, const char *prefix)
bisect_list = 1;
continue;
}
+ if (!strcmp(arg, "--left-right")) {
+ show_left_right = 1;
+ continue;
+ }
if (!strcmp(arg, "--stdin")) {
if (read_from_stdin++)
die("--stdin given twice?");