* [PATCH 2/2] Make left-right automatic.
@ 2006-12-17 0:12 Junio C Hamano
0 siblings, 0 replies; only message in thread
From: Junio C Hamano @ 2006-12-17 0:12 UTC (permalink / raw)
To: git
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>
---
* I think this would make life easier for merge-heavy people.
I'd push this out on 'next' soonish.
revision.c | 13 ++++++++++---
revision.h | 1 +
2 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/revision.c b/revision.c
index d84f46e..56819f8 100644
--- a/revision.c
+++ b/revision.c
@@ -853,8 +853,8 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, const ch
revs->boundary = 1;
continue;
}
- if (!strcmp(arg, "--left-right")) {
- revs->left_right = 1;
+ if (!strcmp(arg, "--no-left-right")) {
+ revs->no_left_right = 1;
continue;
}
if (!strcmp(arg, "--objects")) {
@@ -1055,13 +1055,18 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, const ch
void prepare_revision_walk(struct rev_info *revs)
{
int nr = revs->pending.nr;
+ int has_symmetric = 0;
struct object_array_entry *list = revs->pending.objects;
revs->pending.nr = 0;
revs->pending.alloc = 0;
revs->pending.objects = NULL;
while (--nr >= 0) {
- struct commit *commit = handle_commit(revs, list->item, list->name);
+ struct commit *commit;
+
+ if (list->item->flags & SYMMETRIC_LEFT)
+ has_symmetric = 1;
+ commit = handle_commit(revs, list->item, list->name);
if (commit) {
if (!(commit->object.flags & SEEN)) {
commit->object.flags |= SEEN;
@@ -1073,6 +1078,8 @@ void prepare_revision_walk(struct rev_info *revs)
if (revs->no_walk)
return;
+ if (!revs->no_left_right && has_symmetric)
+ revs->left_right = 1;
if (revs->limited)
limit_list(revs);
if (revs->topo_order)
diff --git a/revision.h b/revision.h
index 4585463..b2ab814 100644
--- a/revision.h
+++ b/revision.h
@@ -41,6 +41,7 @@ struct rev_info {
limited:1,
unpacked:1, /* see also ignore_packed below */
boundary:1,
+ no_left_right:1,
left_right:1,
parents:1;
--
1.4.4.2.g83c5
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2006-12-17 0:13 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-12-17 0:12 [PATCH 2/2] Make left-right automatic Junio C Hamano
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox