diff options
author | Sven Wegener <sven.wegener@stealer.net> | 2017-07-02 13:01:51 +0200 |
---|---|---|
committer | Sven Wegener <sven.wegener@stealer.net> | 2017-07-02 13:01:51 +0200 |
commit | 26ae65371141f723e42060bb6d36f55fdbc822f2 (patch) | |
tree | bd5a83edf8c7d92ff378f2fea2b4edfe0524b62d | |
parent | 935af805a6b1739ea0ebde61f1e6db9b16d4b8ab (diff) |
graph: Add ─┤ display
Signed-off-by: Sven Wegener <sven.wegener@stealer.net>
-rw-r--r-- | src/graph-v2.c | 34 | ||||
-rwxr-xr-x | test/graph/06-extra-bars-test | 10 | ||||
-rwxr-xr-x | test/graph/10-shorter-merge-than-branch-test | 2 | ||||
-rwxr-xr-x | test/graph/11-new-branch-in-middle-test | 2 | ||||
-rwxr-xr-x | test/graph/15-many-merges-test | 6 | ||||
-rwxr-xr-x | test/graph/17-more-merges-test | 4 | ||||
-rwxr-xr-x | test/graph/20-tig-all-long-test | 4 |
7 files changed, 48 insertions, 14 deletions
diff --git a/src/graph-v2.c b/src/graph-v2.c index b5ac4f84..034fa867 100644 --- a/src/graph-v2.c +++ b/src/graph-v2.c @@ -759,6 +759,30 @@ graph_symbol_forks(const struct graph_symbol *symbol) } static const bool +graph_symbol_vertical_merge(const struct graph_symbol *symbol) +{ + if (symbol->empty) + return false; + + if (!symbol->continued_up && !symbol->new_column && !symbol->below_commit) + return false; + + if (symbol->shift_left && symbol->continued_up_left) + return false; + + if (symbol->next_right) + return false; + + if (!symbol->matches_commit) + return false; + + if (symbol->merge && symbol->continued_up && symbol->continued_left && symbol->parent_down && !symbol->continued_right) + return true; + + return false; +} + +static const bool graph_symbol_cross_over(const struct graph_symbol *symbol) { if (symbol->empty) @@ -952,6 +976,9 @@ graph_symbol_to_utf8(const struct graph_symbol *symbol) return " ●"; } + if (graph_symbol_vertical_merge(symbol)) + return "─┤"; + if (graph_symbol_cross_over(symbol)) return "─│"; @@ -1002,6 +1029,10 @@ graph_symbol_to_chtype(const struct graph_symbol *symbol) graphics[1] = 'o'; //ACS_DIAMOND; //'*'; return graphics; + } else if (graph_symbol_vertical_merge(symbol)) { + graphics[0] = ACS_HLINE; + graphics[1] = ACS_RTEE; + } else if (graph_symbol_cross_over(symbol)) { graphics[0] = ACS_HLINE; graphics[1] = ACS_VLINE; @@ -1061,6 +1092,9 @@ graph_symbol_to_ascii(const struct graph_symbol *symbol) return " *"; } + if (graph_symbol_vertical_merge(symbol)) + return "-|"; + if (graph_symbol_cross_over(symbol)) return "-|"; diff --git a/test/graph/06-extra-bars-test b/test/graph/06-extra-bars-test index c9160154..56619427 100755 --- a/test/graph/06-extra-bars-test +++ b/test/graph/06-extra-bars-test @@ -138,29 +138,29 @@ assert_equals stdout <<EOF │ │ │ ● Commit O - after P ●─┴─╯ │ Commit B - merge Q and R │ ● ╭─╯ Commit R - after Q -●─╯ │ Commit Q - merge S and T +●─┤ │ Commit Q - merge S and T │ ● │ Commit T - after S │ │ ● Commit P - after U │ │ ● Commit U - after V │ │ ● Commit V - after W -●─╯ │ Commit S - merge X and Y +●─┤ │ Commit S - merge X and Y │ │ │ ● Commit Z - after 1 │ ● │ │ Commit Y - after X -●─╯ │ │ Commit X - merge 2 and 3 +●─┤ │ │ Commit X - merge 2 and 3 │ ● │ │ Commit 3 - after 2 │ │ │ │ ● Commit 4 - after 5 │ │ │ │ ● Commit 5 - after 6 │ │ ● │ │ Commit W - after 7 │ │ │ │ ● Commit 6 - after 8 │ │ ● │ │ Commit 7 - after 9 -●─╯ │ │ │ Commit 2 - merge 0 and a +●─┤ │ │ │ Commit 2 - merge 0 and a │ ● │ │ │ Commit a - after b │ ● │ │ │ Commit b - after c │ ●─│─│─│─╮ Commit c - merge d and 0 │ │ │ │ ● │ Commit 8 - after e │ │ │ │ ● │ Commit e - after f │ │ │ │ ● │ Commit f - after g -●─│─│─│─│─╯ Commit 0 - merge h and i +●─│─│─│─│─┤ Commit 0 - merge h and i │ │ │ │ ● │ Commit g - after j │ │ │ │ ● │ Commit j - after k │ │ │ │ ● │ Commit k - after l diff --git a/test/graph/10-shorter-merge-than-branch-test b/test/graph/10-shorter-merge-than-branch-test index ba4c1b25..10771944 100755 --- a/test/graph/10-shorter-merge-than-branch-test +++ b/test/graph/10-shorter-merge-than-branch-test @@ -37,7 +37,7 @@ assert_equals stdout <<EOF │ │ │ ● │ │ Commit D - after K │ │ │ │ │ ● Commit E - after F │ ●─│─╯ │ │ Commit K - after F -│ ●─│─╭─╯─╯ Commit F - merge G and H +│ ●─│─╭─╯─┤ Commit F - merge G and H │ ● │ │ ╭─╯ Commit G - after I ●─│─┴─│─╯ Commit H - after I ◎─┴───╯ Commit I diff --git a/test/graph/11-new-branch-in-middle-test b/test/graph/11-new-branch-in-middle-test index 6b8610c8..c2ee7d7d 100755 --- a/test/graph/11-new-branch-in-middle-test +++ b/test/graph/11-new-branch-in-middle-test @@ -30,7 +30,7 @@ assert_equals stdout <<EOF ● │ │ Commit B - after F │ ● │ Commit C - after F │ │ ● Commit E - after Z -●─╯ │ Commit F - merge G and I +●─┤ │ Commit F - merge G and I ●─│─│─╮ Commit G - merge H and I ● │ │ │ Commit H - after I ●─┴─│─╯ Commit I - after Z diff --git a/test/graph/15-many-merges-test b/test/graph/15-many-merges-test index 7d50d4b9..734d5e55 100755 --- a/test/graph/15-many-merges-test +++ b/test/graph/15-many-merges-test @@ -53,18 +53,18 @@ assert_equals stdout <<EOF ●─│─╮ Commit N - Merge M into L │ ●─╯ Commit M after K ●─│─╮ Commit L - Merge K into J -│ ●─╯ Commit K - Merge J into E +│ ●─┤ Commit K - Merge J into E ●─│─╯ Commit J - Merge F into I ●─│─│─╮ Commit I - Merge H into C │ │ │ ● Commit H after G │ │ ● │ Commit F after C │ ● │ │ Commit E after D -●─│─╯ │ Commit C - Merge B into A +●─│─┤ │ Commit C - Merge B into A │ ● │ │ Commit D after Q │ │ ● │ Commit B after R │ │ ● │ Commit R after A │ ● │ │ Commit Q after X -●─│─╯ │ Commit A - Merge T into S +●─│─┤ │ Commit A - Merge T into S │ │ ● │ Commit T after U │ │ ● │ Commit U after V │ │ ● │ Commit V after W diff --git a/test/graph/17-more-merges-test b/test/graph/17-more-merges-test index 0a3226ae..801b3c2a 100755 --- a/test/graph/17-more-merges-test +++ b/test/graph/17-more-merges-test @@ -84,7 +84,7 @@ assert_equals stdout <<EOF │ │ ● │ Commit D - after B │ ● │ │ Commit C - after F │ │ │ ● Commit E - after H -●─│─╯ │ Commit B - merge H and F +●─│─┤ │ Commit B - merge H and F │ ●─╯ │ Commit F - after G │ ● ╭─╯ Commit G - after H ●─┴─╯ Commit H - after I @@ -109,7 +109,7 @@ assert_equals stdout <<EOF ●─│───╯ Commit U - after 3 ●─│─┬─╮ Commit 3 - merge 4, 5, and 8 ●─│─│─│─╮ Commit 4 - merge 6 and 5 -│ │ ●─│─╯ Commit 5 - merge 7 and 9 +│ │ ●─│─┤ Commit 5 - merge 7 and 9 ●─│─│─│─│─╮ Commit 6 - merge A and 9 ◎ │ │ │ │ │ Commit A ◎─╯ │ │ │ │ Commit L diff --git a/test/graph/20-tig-all-long-test b/test/graph/20-tig-all-long-test index af3482bf..c4bf5e59 100755 --- a/test/graph/20-tig-all-long-test +++ b/test/graph/20-tig-all-long-test @@ -742,10 +742,10 @@ assert_equals stdout <<EOF ● │ Fix mistake in tigrc: line-graphic expects utf8, not utf-8 ●─│─╮ Merge pull request #37 from v0n/abbrev_commit_hash │ │ ● string_copy_rev: chop rev on first space (if any) -●─│─╯ Merge pull request #36 from tsibley/reload-diff-view-on-toggle +●─│─┤ Merge pull request #36 from tsibley/reload-diff-view-on-toggle │ │ ● Reload the view on a diff-like option change │ │ ● Doc typo -●─│─╯ Merge pull request #34 from tsibley/combined-diff-coloring +●─│─┤ Merge pull request #34 from tsibley/combined-diff-coloring │ │ ● [GH #32] Only color +/- in the second column when in a combined diff ●─│─╯ Only reload the view after changing diff options for diff-like views ● │ Document how to submit bugs |