Skip to content

Commit

Permalink
log: show ^ for boundary
Browse files Browse the repository at this point in the history
Boundary commits are commits which are discarded by the revision walk,
i.e. they are no "positive part" of the specified revision set but show
nevertheless (because of `--boundary`).

So far, `log` shows them with a `-` prefix and `log --graph` with a `o`.
besides the obvious inconsistency, these choices are bad for other
reasons, too:

`-` is typically used in a diff whereas negative revs are denoted by
`^`.

`o` reminds of "origin/origo" at least as much as of "omitted";
visually, it's not clear that it "should not be present".

So, change both `log` and `log --graph` to use the same symbol `^` which
the revision parser uses for negative revs, too.
  • Loading branch information
mjg committed Jul 21, 2023
1 parent 1a74ef4 commit 858afca
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 20 deletions.
8 changes: 4 additions & 4 deletions Documentation/rev-list-options.txt
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ Under `--pretty=reference`, this information will not be shown at all.

--boundary::
Output excluded boundary commits. Boundary commits are
prefixed with `-`.
prefixed with `^`.

ifdef::git-rev-list[]
--use-bitmap-index::
Expand Down Expand Up @@ -1145,7 +1145,7 @@ endif::git-rev-list[]
Mark which side of a symmetric difference a commit is reachable from.
Commits from the left side are prefixed with `<` and those from
the right with `>`. If combined with `--boundary`, those
commits are prefixed with `-`.
commits are prefixed with `^`.
+
For example, if you have this topology:
+
Expand All @@ -1166,8 +1166,8 @@ you would get an output like this:
>bbbbbbb... 2nd on b
<aaaaaaa... 3rd on a
<aaaaaaa... 2nd on a
-yyyyyyy... 1st on b
-xxxxxxx... 1st on a
^yyyyyyy... 1st on b
^xxxxxxx... 1st on a
-----------------------------------------------------------------------

--graph::
Expand Down
4 changes: 2 additions & 2 deletions graph.c
Original file line number Diff line number Diff line change
Expand Up @@ -932,12 +932,12 @@ static void graph_output_pre_commit_line(struct git_graph *graph,
static void graph_output_commit_char(struct git_graph *graph, struct graph_line *line)
{
/*
* For boundary commits, print 'o'
* For boundary commits, print '^'
* (We should only see boundary commits when revs->boundary is set.)
*/
if (graph->commit->object.flags & BOUNDARY) {
assert(graph->revs->boundary);
graph_line_addch(line, 'o');
graph_line_addch(line, '^');
return;
}

Expand Down
2 changes: 1 addition & 1 deletion perl/Git/SVN/Log.pm
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ sub cmd_show_log {
my (@k, $c, $d, $stat);
my $esc_color = qr/(?:\033\[(?:(?:\d+;)*\d*)?m)*/;
while (<$log>) {
if (/^${esc_color}commit (?:- )?($::oid_short)/o) {
if (/^${esc_color}commit (?:\^ )?($::oid_short)/o) {
my $cmt = $1;
if ($c && cmt_showable($c) && $c->{r} != $r_last) {
$r_last = $c->{r};
Expand Down
2 changes: 1 addition & 1 deletion revision.c
Original file line number Diff line number Diff line change
Expand Up @@ -4363,7 +4363,7 @@ struct commit *get_revision(struct rev_info *revs)
const char *get_revision_mark(const struct rev_info *revs, const struct commit *commit)
{
if (commit->object.flags & BOUNDARY)
return "-";
return "^";
else if (commit->object.flags & UNINTERESTING)
return "U";
else if (commit->object.flags & PATCHSAME)
Expand Down
16 changes: 8 additions & 8 deletions t/t3430-rebase-merges.sh
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ test_expect_success 'with a branch tip that was cherry-picked already' '
| * A1
* | B1
|/
o A2
^ A2
EOF
'

Expand All @@ -256,7 +256,7 @@ test_expect_success '--no-rebase-merges countermands --rebase-merges' '
test_cmp_graph C.. <<-\EOF
* B
* D
o C
^ C
EOF
'

Expand All @@ -274,7 +274,7 @@ test_expect_success 'do not rebase cousins unless asked for' '
| * D
| * G
|/
o H
^ H
EOF
'

Expand All @@ -288,7 +288,7 @@ test_expect_success 'rebase.rebaseMerges=rebase-cousins is equivalent to --rebas
| * D
| * G
|/
o H
^ H
EOF
'

Expand All @@ -299,7 +299,7 @@ test_expect_success '--no-rebase-merges overrides rebase.rebaseMerges=no-rebase-
test_cmp_graph C.. <<-\EOF
* B
* D
o C
^ C
EOF
'

Expand Down Expand Up @@ -434,7 +434,7 @@ test_expect_success 'A root commit can be a cousin, treat it that way' '
* Merge branch '\''khnum'\'' into asherah
|\
| * yama
o shamkat
^ shamkat
EOF
test_tick &&
git rebase --rebase-merges=rebase-cousins HEAD^ &&
Expand All @@ -443,7 +443,7 @@ test_expect_success 'A root commit can be a cousin, treat it that way' '
|\
| * yama
|/
o shamkat
^ shamkat
EOF
'

Expand Down Expand Up @@ -493,7 +493,7 @@ test_expect_success 'octopus merges' '
| |/
* / one
|/
o before-octopus
^ before-octopus
EOF
'

Expand Down
8 changes: 4 additions & 4 deletions t/t6016-rev-list-graph-simplify-history.sh
Original file line number Diff line number Diff line change
Expand Up @@ -233,13 +233,13 @@ test_expect_success '--graph --boundary ^C3' '
| * | | B2
| * | | B1
* | | | A3
o | | | A2
^ | | | A2
|/ / /
o / / A1
^ / / A1
/ /
| o C3
| ^ C3
|/
o C2
^ C2
EOF
'

Expand Down

0 comments on commit 858afca

Please sign in to comment.