Teach all of log family --left-right output.
This makes reviewing git log --left-right --merge --no-merges -p a lot more pleasant. Signed-off-by: Junio C Hamano <junkio@cox.net>
Junio C Hamano committed
Dec 16, 2006 at 15:31 UTC
74bd9029732db28b2fff50de0a190229c6033e02
4 files changed
+28
-10
builtin-rev-list.c
+1
-6
@@ -45,7 +45,6 @@ static int bisect_list;
45
static int show_timestamp;
46
static int hdr_termination;
47
static const char *header_prefix;
48
-static int show_left_right;
48
49
static void show_commit(struct commit *commit)
50
{
@@ -55,7 +54,7 @@ static void show_commit(struct commit *commit)
54
fputs(header_prefix, stdout);
55
if (commit->object.flags & BOUNDARY)
56
putchar('-');
58
- else if (show_left_right) {
57
+ else if (revs.left_right) {
58
if (commit->object.flags & SYMMETRIC_LEFT)
59
putchar('<');
60
else
@@ -247,10 +246,6 @@ int cmd_rev_list(int argc, const char **argv, const char *prefix)
246
bisect_list = 1;
247
continue;
248
}
250
- if (!strcmp(arg, "--left-right")) {
251
- show_left_right = 1;
252
- continue;
253
- }
249
if (!strcmp(arg, "--stdin")) {
250
if (read_from_stdin++)
251
die("--stdin given twice?");
log-tree.c
+22
-4
@@ -114,6 +114,14 @@ void show_log(struct rev_info *opt, const char *sep)
114
115
opt->loginfo = NULL;
116
if (!opt->verbose_header) {
117
+ if (opt->left_right) {
118
+ if (commit->object.flags & BOUNDARY)
119
+ putchar('-');
120
+ else if (commit->object.flags & SYMMETRIC_LEFT)
121
+ putchar('<');
122
+ else
123
+ putchar('>');
124
+ }
125
fputs(diff_unique_abbrev(commit->object.sha1, abbrev_commit), stdout);
126
if (opt->parents)
127
show_parents(commit, abbrev_commit);
@@ -192,10 +200,20 @@ void show_log(struct rev_info *opt, const char *sep)
200
opt->diffopt.stat_sep = buffer;
201
}
202
} else {
195
- printf("%s%s%s",
196
- diff_get_color(opt->diffopt.color_diff, DIFF_COMMIT),
197
- opt->commit_format == CMIT_FMT_ONELINE ? "" : "commit ",
198
- diff_unique_abbrev(commit->object.sha1, abbrev_commit));
203
+ fputs(diff_get_color(opt->diffopt.color_diff, DIFF_COMMIT),
204
+ stdout);
205
+ if (opt->commit_format != CMIT_FMT_ONELINE)
206
+ fputs("commit ", stdout);
207
+ if (opt->left_right) {
208
+ if (commit->object.flags & BOUNDARY)
209
+ putchar('-');
210
+ else if (commit->object.flags & SYMMETRIC_LEFT)
211
+ putchar('<');
212
+ else
213
+ putchar('>');
214
+ }
215
+ fputs(diff_unique_abbrev(commit->object.sha1, abbrev_commit),
216
+ stdout);
217
if (opt->parents)
218
show_parents(commit, abbrev_commit);
219
if (parent)
revision.c
+4
@@ -853,6 +853,10 @@ 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;
858
+ continue;
859
+ }
860
if (!strcmp(arg, "--objects")) {
861
revs->tag_objects = 1;
862
revs->tree_objects = 1;
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
+ left_right:1,
45
parents:1;
46
47
/* Diff flags */