[PATCH 2/2] revision: implement --show-linear-break for --graph

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



where <barrier> sets rev_info.break_revision_mark, the revision mark
used for root commits.

Signed-off-by: Kyle Marek <kmarek@xxxxxxxx>
---
 Documentation/rev-list-options.txt | 7 +++++++
 log-tree.c                         | 2 +-
 revision.c                         | 8 ++++----
 revision.h                         | 1 +
 4 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/Documentation/rev-list-options.txt b/Documentation/rev-list-options.txt
index 002379056a..93adb77c19 100644
--- a/Documentation/rev-list-options.txt
+++ b/Documentation/rev-list-options.txt
@@ -1104,6 +1104,13 @@ This implies the `--topo-order` option by default, but the
 	do not belong to a linear branch. This option puts a barrier
 	in between them in that case. If `<barrier>` is specified, it
 	is the string that will be shown instead of the default one.
++
+When --graph is used with --oneline, there is usually no vertical
+space between commits, so the graph edge is not drawn. This can make
+it hard to see that a history may end at one commit, while an
+unrelated history starts at the next commit. This option changes the
+revision mark for root commits. If `<barrier>` is specified, it is
+used as the new revision mark instead of the default one.
 
 ifdef::git-rev-list[]
 --count::
diff --git a/log-tree.c b/log-tree.c
index fd0dde97ec..f62300e404 100644
--- a/log-tree.c
+++ b/log-tree.c
@@ -962,7 +962,7 @@ int log_tree_commit(struct rev_info *opt, struct commit *commit)
 	if (opt->line_level_traverse)
 		return line_log_print(opt, commit);
 
-	if (opt->track_linear && !opt->linear && !opt->reverse_output_stage)
+	if (!opt->graph && opt->track_linear && !opt->linear && !opt->reverse_output_stage)
 		fprintf(opt->diffopt.file, "\n%s\n", opt->break_bar);
 	shown = log_tree_diff(opt, commit, &log);
 	if (!shown && opt->loginfo && opt->always_show_header) {
diff --git a/revision.c b/revision.c
index 8556923de8..51deab2326 100644
--- a/revision.c
+++ b/revision.c
@@ -2402,10 +2402,12 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg
 		revs->show_signature = 0;
 	} else if (!strcmp(arg, "--show-linear-break")) {
 		revs->break_bar = "                    ..........";
+		revs->break_revision_mark = "#";
 		revs->track_linear = 1;
 		revs->track_first_time = 1;
 	} else if (skip_prefix(arg, "--show-linear-break=", &optarg)) {
 		revs->break_bar = xstrdup(optarg);
+		revs->break_revision_mark = xstrdup(optarg);
 		revs->track_linear = 1;
 		revs->track_first_time = 1;
 	} else if (skip_prefix(arg, "--show-notes=", &optarg) ||
@@ -2530,8 +2532,6 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg
 			unkv[(*unkc)++] = arg;
 		return opts;
 	}
-	if (revs->graph && revs->track_linear)
-		die("--show-linear-break and --graph are incompatible");
 
 	return 1;
 }
@@ -4192,8 +4192,8 @@ const char *get_revision_mark(const struct rev_info *revs, const struct commit *
 		else
 			return ">";
 	} else if (revs->graph) {
-		if (!commit->parents)
-			return "#";
+		if (revs->break_revision_mark && !commit->parents)
+			return revs->break_revision_mark;
 		return "*";
 	} else if (revs->cherry_mark)
 		return "+";
diff --git a/revision.h b/revision.h
index 086ff10280..83b2ecef56 100644
--- a/revision.h
+++ b/revision.h
@@ -297,6 +297,7 @@ struct rev_info {
 
 	struct commit_list *previous_parents;
 	const char *break_bar;
+	const char *break_revision_mark;
 
 	struct revision_sources *sources;
 
-- 
2.29.2




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux