@matheusbsbs / matheus-bagliano / commits / 5761231975
Fork 0

Make left-right automatic.

When using symmetric differences, I think the user almost always would want to know which side of the symmetry each commit came from. So this removes --left-right option from the command line, and turns it on automatically when a symmetric difference is used ("git log --merge" counts as a symmetric difference between HEAD and MERGE_HEAD). Just in case, a new option --no-left-right is provided to defeat this, but I do not know if it would be useful. Signed-off-by: Junio C Hamano <junkio@cox.net>

Junio C Hamano committed Dec 16, 2006 at 16:07 UTC 5761231975ceffa531d86d9bab0f9a9a370674f6
2 files changed +11 -3
revision.c
+10 -3
@@ -853,8 +853,8 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, const ch
853 revs->boundary = 1;
854 continue;
855 }
856 - if (!strcmp(arg, "--left-right")) {
857 - revs->left_right = 1;
856 + if (!strcmp(arg, "--no-left-right")) {
857 + revs->no_left_right = 1;
858 continue;
859 }
860 if (!strcmp(arg, "--objects")) {
@@ -1055,13 +1055,18 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, const ch
1055 void prepare_revision_walk(struct rev_info *revs)
1056 {
1057 int nr = revs->pending.nr;
1058 + int has_symmetric = 0;
1059 struct object_array_entry *list = revs->pending.objects;
1060
1061 revs->pending.nr = 0;
1062 revs->pending.alloc = 0;
1063 revs->pending.objects = NULL;
1064 while (--nr >= 0) {
1064 - struct commit *commit = handle_commit(revs, list->item, list->name);
1065 + struct commit *commit;
1066 +
1067 + if (list->item->flags & SYMMETRIC_LEFT)
1068 + has_symmetric = 1;
1069 + commit = handle_commit(revs, list->item, list->name);
1070 if (commit) {
1071 if (!(commit->object.flags & SEEN)) {
1072 commit->object.flags |= SEEN;
@@ -1073,6 +1078,8 @@ void prepare_revision_walk(struct rev_info *revs)
1078
1079 if (revs->no_walk)
1080 return;
1081 + if (!revs->no_left_right && has_symmetric)
1082 + revs->left_right = 1;
1083 if (revs->limited)
1084 limit_list(revs);
1085 if (revs->topo_order)
revision.h
+1
@@ -41,6 +41,7 @@ struct rev_info {
41 limited:1,
42 unpacked:1, /* see also ignore_packed below */
43 boundary:1,
44 + no_left_right:1,
45 left_right:1,
46 parents:1;
47