Git development
 help / color / mirror / Atom feed
From: Junio C Hamano <junkio@cox.net>
To: git@vger.kernel.org
Subject: [PATCH 1/2] Teach all of log family --left-right output.
Date: Sat, 16 Dec 2006 16:12:47 -0800	[thread overview]
Message-ID: <7vmz5n8jnk.fsf@assigned-by-dhcp.cox.net> (raw)

This makes reviewing

     git log --left-right --merge --no-merges -p

a lot more pleasant.

Signed-off-by: Junio C Hamano <junkio@cox.net>
---

 * This is on the tip of jc/leftright topic, currently only in
   'pu'.  Earlier I had this only for git-rev-list.  Now log
   family knows about this.

 builtin-rev-list.c |    7 +------
 log-tree.c         |   26 ++++++++++++++++++++++----
 revision.c         |    4 ++++
 revision.h         |    1 +
 4 files changed, 28 insertions(+), 10 deletions(-)

diff --git a/builtin-rev-list.c b/builtin-rev-list.c
index 4364035..1bb3a06 100644
--- a/builtin-rev-list.c
+++ b/builtin-rev-list.c
@@ -45,7 +45,6 @@ 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)
 {
@@ -55,7 +54,7 @@ static void show_commit(struct commit *commit)
 		fputs(header_prefix, stdout);
 	if (commit->object.flags & BOUNDARY)
 		putchar('-');
-	else if (show_left_right) {
+	else if (revs.left_right) {
 		if (commit->object.flags & SYMMETRIC_LEFT)
 			putchar('<');
 		else
@@ -247,10 +246,6 @@ 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?");
diff --git a/log-tree.c b/log-tree.c
index 8787df5..35be33a 100644
--- a/log-tree.c
+++ b/log-tree.c
@@ -114,6 +114,14 @@ void show_log(struct rev_info *opt, const char *sep)
 
 	opt->loginfo = NULL;
 	if (!opt->verbose_header) {
+		if (opt->left_right) {
+			if (commit->object.flags & BOUNDARY)
+				putchar('-');
+			else if (commit->object.flags & SYMMETRIC_LEFT)
+				putchar('<');
+			else
+				putchar('>');
+		}
 		fputs(diff_unique_abbrev(commit->object.sha1, abbrev_commit), stdout);
 		if (opt->parents)
 			show_parents(commit, abbrev_commit);
@@ -192,10 +200,20 @@ void show_log(struct rev_info *opt, const char *sep)
 			opt->diffopt.stat_sep = buffer;
 		}
 	} else {
-		printf("%s%s%s",
-		       diff_get_color(opt->diffopt.color_diff, DIFF_COMMIT),
-		       opt->commit_format == CMIT_FMT_ONELINE ? "" : "commit ",
-		       diff_unique_abbrev(commit->object.sha1, abbrev_commit));
+		fputs(diff_get_color(opt->diffopt.color_diff, DIFF_COMMIT),
+		      stdout);
+		if (opt->commit_format != CMIT_FMT_ONELINE)
+			fputs("commit ", stdout);
+		if (opt->left_right) {
+			if (commit->object.flags & BOUNDARY)
+				putchar('-');
+			else if (commit->object.flags & SYMMETRIC_LEFT)
+				putchar('<');
+			else
+				putchar('>');
+		}
+		fputs(diff_unique_abbrev(commit->object.sha1, abbrev_commit),
+		      stdout);
 		if (opt->parents)
 			show_parents(commit, abbrev_commit);
 		if (parent)
diff --git a/revision.c b/revision.c
index 3d989c3..d84f46e 100644
--- a/revision.c
+++ b/revision.c
@@ -853,6 +853,10 @@ 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;
+				continue;
+			}
 			if (!strcmp(arg, "--objects")) {
 				revs->tag_objects = 1;
 				revs->tree_objects = 1;
diff --git a/revision.h b/revision.h
index f92a4d4..4585463 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,
+			left_right:1,
 			parents:1;
 
 	/* Diff flags */
-- 
1.4.4.2.g83c5


                 reply	other threads:[~2006-12-17  0:12 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7vmz5n8jnk.fsf@assigned-by-dhcp.cox.net \
    --to=junkio@cox.net \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox