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>
This commit is contained in:
@ -45,7 +45,6 @@ static int bisect_list;
|
|||||||
static int show_timestamp;
|
static int show_timestamp;
|
||||||
static int hdr_termination;
|
static int hdr_termination;
|
||||||
static const char *header_prefix;
|
static const char *header_prefix;
|
||||||
static int show_left_right;
|
|
||||||
|
|
||||||
static void show_commit(struct commit *commit)
|
static void show_commit(struct commit *commit)
|
||||||
{
|
{
|
||||||
@ -55,7 +54,7 @@ static void show_commit(struct commit *commit)
|
|||||||
fputs(header_prefix, stdout);
|
fputs(header_prefix, stdout);
|
||||||
if (commit->object.flags & BOUNDARY)
|
if (commit->object.flags & BOUNDARY)
|
||||||
putchar('-');
|
putchar('-');
|
||||||
else if (show_left_right) {
|
else if (revs.left_right) {
|
||||||
if (commit->object.flags & SYMMETRIC_LEFT)
|
if (commit->object.flags & SYMMETRIC_LEFT)
|
||||||
putchar('<');
|
putchar('<');
|
||||||
else
|
else
|
||||||
@ -247,10 +246,6 @@ int cmd_rev_list(int argc, const char **argv, const char *prefix)
|
|||||||
bisect_list = 1;
|
bisect_list = 1;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!strcmp(arg, "--left-right")) {
|
|
||||||
show_left_right = 1;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (!strcmp(arg, "--stdin")) {
|
if (!strcmp(arg, "--stdin")) {
|
||||||
if (read_from_stdin++)
|
if (read_from_stdin++)
|
||||||
die("--stdin given twice?");
|
die("--stdin given twice?");
|
||||||
|
26
log-tree.c
26
log-tree.c
@ -114,6 +114,14 @@ void show_log(struct rev_info *opt, const char *sep)
|
|||||||
|
|
||||||
opt->loginfo = NULL;
|
opt->loginfo = NULL;
|
||||||
if (!opt->verbose_header) {
|
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);
|
fputs(diff_unique_abbrev(commit->object.sha1, abbrev_commit), stdout);
|
||||||
if (opt->parents)
|
if (opt->parents)
|
||||||
show_parents(commit, abbrev_commit);
|
show_parents(commit, abbrev_commit);
|
||||||
@ -192,10 +200,20 @@ void show_log(struct rev_info *opt, const char *sep)
|
|||||||
opt->diffopt.stat_sep = buffer;
|
opt->diffopt.stat_sep = buffer;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
printf("%s%s%s",
|
fputs(diff_get_color(opt->diffopt.color_diff, DIFF_COMMIT),
|
||||||
diff_get_color(opt->diffopt.color_diff, DIFF_COMMIT),
|
stdout);
|
||||||
opt->commit_format == CMIT_FMT_ONELINE ? "" : "commit ",
|
if (opt->commit_format != CMIT_FMT_ONELINE)
|
||||||
diff_unique_abbrev(commit->object.sha1, abbrev_commit));
|
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)
|
if (opt->parents)
|
||||||
show_parents(commit, abbrev_commit);
|
show_parents(commit, abbrev_commit);
|
||||||
if (parent)
|
if (parent)
|
||||||
|
@ -853,6 +853,10 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, const ch
|
|||||||
revs->boundary = 1;
|
revs->boundary = 1;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (!strcmp(arg, "--left-right")) {
|
||||||
|
revs->left_right = 1;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (!strcmp(arg, "--objects")) {
|
if (!strcmp(arg, "--objects")) {
|
||||||
revs->tag_objects = 1;
|
revs->tag_objects = 1;
|
||||||
revs->tree_objects = 1;
|
revs->tree_objects = 1;
|
||||||
|
@ -41,6 +41,7 @@ struct rev_info {
|
|||||||
limited:1,
|
limited:1,
|
||||||
unpacked:1, /* see also ignore_packed below */
|
unpacked:1, /* see also ignore_packed below */
|
||||||
boundary:1,
|
boundary:1,
|
||||||
|
left_right:1,
|
||||||
parents:1;
|
parents:1;
|
||||||
|
|
||||||
/* Diff flags */
|
/* Diff flags */
|
||||||
|
Reference in New Issue
Block a user