{"thread":{"id":"49521","subject":"[PATCH v6] log: fix coloring of certain octupus merge shapes","startedAt":"2018-10-10T00:38:25Z","lastAt":"2018-10-12T03:22:45Z","messageCount":4,"participants":["Noam Postavsky","Junio C Hamano"],"isPatch":true,"patchVersion":6,"patchTotal":null},"messages":[{"id":"359967","messageId":"20181010003743.17198-1-npostavs@users.sourceforge.net","threadId":"49521","inReplyTo":null,"subject":"[PATCH v6] log: fix coloring of certain octupus merge shapes","fromName":"Noam Postavsky","fromEmail":"npostavs@users.sourceforge.net","sentAt":"2018-10-10T00:37:43Z","receivedAt":"2018-10-10T00:38:25Z","isPatch":true,"sender":{"key":"npostavs@users.sourceforge.net","avatar":"https://avatars.githubusercontent.com/u/287742?v=4"},"body":"For octopus merges where the first parent edge immediately merges into\nthe next column to the left:\n\n| *-.\n| |\\ \\\n|/ / /\n\nthen the number of columns should be one less than the usual case:\n\n| *-.\n| |\\ \\\n| | | *\n\nAlso refactor the code to iterate over columns rather than dashes,\nbuilding from an initial patch suggestion by Jeff King.\n\nSigned-off-by: Noam Postavsky <npostavs@users.sourceforge.net>\nReviewed-by: Jeff King <peff@peff.net>\n---\n graph.c                      |  56 +++++++++++++++++-------\n t/t4214-log-graph-octopus.sh | 102 +++++++++++++++++++++++++++++++++++++++++++\n 2 files changed, 143 insertions(+), 15 deletions(-)\n create mode 100755 t/t4214-log-graph-octopus.sh\n\ndiff --git a/graph.c b/graph.c\nindex e1f6d3bddb..a3366f6dac 100644\n--- a/graph.c\n+++ b/graph.c\n@@ -842,27 +842,53 @@ static void graph_output_commit_char(struct git_graph *graph, struct strbuf *sb)\n }\n \n /*\n- * Draw an octopus merge and return the number of characters written.\n+ * Draw the horizontal dashes of an octopus merge and return the number of\n+ * characters written.\n  */\n static int graph_draw_octopus_merge(struct git_graph *graph,\n \t\t\t\t    struct strbuf *sb)\n {\n \t/*\n-\t * Here dashless_commits represents the number of parents\n-\t * which don't need to have dashes (because their edges fit\n-\t * neatly under the commit).\n-\t */\n-\tconst int dashless_commits = 2;\n-\tint col_num, i;\n-\tint num_dashes =\n-\t\t((graph->num_parents - dashless_commits) * 2) - 1;\n-\tfor (i = 0; i < num_dashes; i++) {\n-\t\tcol_num = (i / 2) + dashless_commits + graph->commit_index;\n-\t\tstrbuf_write_column(sb, &graph->new_columns[col_num], '-');\n+\t * Here dashless_parents represents the number of parents which don't\n+\t * need to have dashes (the edges labeled \"0\" and \"1\").  And\n+\t * dashful_parents are the remaining ones.\n+\t *\n+\t * | *---.\n+\t * | |\\ \\ \\\n+\t * | | | | |\n+\t * x 0 1 2 3\n+\t *\n+\t */\n+\tconst int dashless_parents = 2;\n+\tint dashful_parents = graph->num_parents - dashless_parents;\n+\n+\t/*\n+\t * Usually, each parent gets its own column, like the diagram above, but\n+\t * sometimes the first parent goes into an existing column, like this:\n+\t *\n+\t * | *---.\n+\t * | |\\ \\ \\\n+\t * |/ / / /\n+\t * x 0 1 2\n+\t *\n+\t * In which case there will be more parents than the delta of columns.\n+\t */\n+\tint delta_cols = (graph->num_new_columns - graph->num_columns);\n+\tint parent_in_old_cols = graph->num_parents - delta_cols;\n+\n+\t/*\n+\t * In both cases, commit_index corresponds to the edge labeled \"0\".\n+\t */\n+\tint first_col = graph->commit_index + dashless_parents\n+\t    - parent_in_old_cols;\n+\n+\tint i;\n+\tfor (i = 0; i < dashful_parents; i++) {\n+\t\tstrbuf_write_column(sb, &graph->new_columns[i+first_col], '-');\n+\t\tstrbuf_write_column(sb, &graph->new_columns[i+first_col],\n+\t\t\t\t    i == dashful_parents-1 ? '.' : '-');\n \t}\n-\tcol_num = (i / 2) + dashless_commits + graph->commit_index;\n-\tstrbuf_write_column(sb, &graph->new_columns[col_num], '.');\n-\treturn num_dashes + 1;\n+\treturn 2 * dashful_parents;\n }\n \n static void graph_output_commit_line(struct git_graph *graph, struct strbuf *sb)\ndiff --git a/t/t4214-log-graph-octopus.sh b/t/t4214-log-graph-octopus.sh\nnew file mode 100755\nindex 0000000000..dab96c89aa\n--- /dev/null\n+++ b/t/t4214-log-graph-octopus.sh\n@@ -0,0 +1,102 @@\n+#!/bin/sh\n+\n+test_description='git log --graph of skewed left octopus merge.'\n+\n+. ./test-lib.sh\n+\n+test_expect_success 'set up merge history' '\n+\tcat >expect.uncolored <<-\\EOF &&\n+\t* left\n+\t| *---.   octopus-merge\n+\t| |\\ \\ \\\n+\t|/ / / /\n+\t| | | * 4\n+\t| | * | 3\n+\t| | |/\n+\t| * | 2\n+\t| |/\n+\t* | 1\n+\t|/\n+\t* initial\n+\tEOF\n+\tcat >expect.colors <<-\\EOF &&\n+\t* left\n+\t<RED>|<RESET> *<BLUE>-<RESET><BLUE>-<RESET><MAGENTA>-<RESET><MAGENTA>.<RESET>   octopus-merge\n+\t<RED>|<RESET> <RED>|<RESET><YELLOW>\\<RESET> <BLUE>\\<RESET> <MAGENTA>\\<RESET>\n+\t<RED>|<RESET><RED>/<RESET> <YELLOW>/<RESET> <BLUE>/<RESET> <MAGENTA>/<RESET>\n+\t<RED>|<RESET> <YELLOW>|<RESET> <BLUE>|<RESET> * 4\n+\t<RED>|<RESET> <YELLOW>|<RESET> * <MAGENTA>|<RESET> 3\n+\t<RED>|<RESET> <YELLOW>|<RESET> <MAGENTA>|<RESET><MAGENTA>/<RESET>\n+\t<RED>|<RESET> * <MAGENTA>|<RESET> 2\n+\t<RED>|<RESET> <MAGENTA>|<RESET><MAGENTA>/<RESET>\n+\t* <MAGENTA>|<RESET> 1\n+\t<MAGENTA>|<RESET><MAGENTA>/<RESET>\n+\t* initial\n+\tEOF\n+\ttest_commit initial &&\n+\tfor i in 1 2 3 4 ; do\n+\t\tgit checkout master -b $i || return $?\n+\t\t# Make tag name different from branch name, to avoid\n+\t\t# ambiguity error when calling checkout.\n+\t\ttest_commit $i $i $i tag$i || return $?\n+\tdone &&\n+\tgit checkout 1 -b merge &&\n+\ttest_tick &&\n+\tgit merge -m octopus-merge 1 2 3 4 &&\n+\tgit checkout 1 -b L &&\n+\ttest_commit left\n+'\n+\n+test_expect_success 'log --graph with tricky octopus merge with colors' '\n+\ttest_config log.graphColors red,green,yellow,blue,magenta,cyan &&\n+\tgit log --color=always --graph --date-order --pretty=tformat:%s --all >actual.colors.raw &&\n+\ttest_decode_color <actual.colors.raw | sed \"s/ *\\$//\" >actual.colors &&\n+\ttest_cmp expect.colors actual.colors\n+'\n+\n+test_expect_success 'log --graph with tricky octopus merge, no color' '\n+\tgit log --color=never --graph --date-order --pretty=tformat:%s --all >actual.raw &&\n+\tsed \"s/ *\\$//\" actual.raw >actual &&\n+\ttest_cmp expect.uncolored actual\n+'\n+\n+# Repeat the previous two tests with \"normal\" octopus merge (i.e.,\n+# without the first parent skewing to the \"left\" branch column).\n+\n+test_expect_success 'log --graph with normal octopus merge, no color' '\n+\tcat >expect.uncolored <<-\\EOF &&\n+\t*---.   octopus-merge\n+\t|\\ \\ \\\n+\t| | | * 4\n+\t| | * | 3\n+\t| | |/\n+\t| * | 2\n+\t| |/\n+\t* | 1\n+\t|/\n+\t* initial\n+\tEOF\n+\tgit log --color=never --graph --date-order --pretty=tformat:%s merge >actual.raw &&\n+\tsed \"s/ *\\$//\" actual.raw >actual &&\n+\ttest_cmp expect.uncolored actual\n+'\n+\n+test_expect_success 'log --graph with normal octopus merge with colors' '\n+\tcat >expect.colors <<-\\EOF &&\n+\t*<YELLOW>-<RESET><YELLOW>-<RESET><BLUE>-<RESET><BLUE>.<RESET>   octopus-merge\n+\t<RED>|<RESET><GREEN>\\<RESET> <YELLOW>\\<RESET> <BLUE>\\<RESET>\n+\t<RED>|<RESET> <GREEN>|<RESET> <YELLOW>|<RESET> * 4\n+\t<RED>|<RESET> <GREEN>|<RESET> * <BLUE>|<RESET> 3\n+\t<RED>|<RESET> <GREEN>|<RESET> <BLUE>|<RESET><BLUE>/<RESET>\n+\t<RED>|<RESET> * <BLUE>|<RESET> 2\n+\t<RED>|<RESET> <BLUE>|<RESET><BLUE>/<RESET>\n+\t* <BLUE>|<RESET> 1\n+\t<BLUE>|<RESET><BLUE>/<RESET>\n+\t* initial\n+\tEOF\n+\ttest_config log.graphColors red,green,yellow,blue,magenta,cyan &&\n+\tgit log --color=always --graph --date-order --pretty=tformat:%s merge >actual.colors.raw &&\n+\ttest_decode_color <actual.colors.raw | sed \"s/ *\\$//\" >actual.colors &&\n+\ttest_cmp expect.colors actual.colors\n+'\n+test_done\n-- \n2.11.0\n\n"},{"id":"359973","messageId":"xmqqzhvmmv8v.fsf@gitster-ct.c.googlers.com","threadId":"49521","inReplyTo":"20181010003743.17198-1-npostavs@users.sourceforge.net","subject":"Re: [PATCH v6] log: fix coloring of certain octupus merge shapes","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2018-10-10T01:43:44Z","receivedAt":"2018-10-10T01:43:51Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Noam Postavsky <npostavs@users.sourceforge.net> writes:\n\n> For octopus merges where the first parent edge immediately merges into\n> the next column to the left:\n>\n> | *-.\n> | |\\ \\\n> |/ / /\n>\n> then the number of columns should be one less than the usual case:\n>\n> | *-.\n> | |\\ \\\n> | | | *\n\nI had a bit hard time parsing the above, especially with \"then\",\nwhich probably would make it easier to read if it is not there.\n\n> Also refactor the code to iterate over columns rather than dashes,\n> building from an initial patch suggestion by Jeff King.\n\ns/suggestion/suggested/ perhaps?\n\n>\n> Signed-off-by: Noam Postavsky <npostavs@users.sourceforge.net>\n> Reviewed-by: Jeff King <peff@peff.net>\n> ---\n\nThanks, both.\n\n>  /*\n> + * Draw the horizontal dashes of an octopus merge and return the number of\n> + * characters written.\n>   */\n>  static int graph_draw_octopus_merge(struct git_graph *graph,\n>  \t\t\t\t    struct strbuf *sb)\n>  {\n>  \t/*\n> +\t * Here dashless_parents represents the number of parents which don't\n> +\t * need to have dashes (the edges labeled \"0\" and \"1\").  And\n> +\t * dashful_parents are the remaining ones.\n\nHere \"dash\" refers to that horizontal line on the same line as the\nresulting merge.  A very clearly explained definition.  OK.\n\n> +\t * | *---.\n> +\t * | |\\ \\ \\\n> +\t * | | | | |\n> +\t * x 0 1 2 3\n> +\t *\n> +\t */\n> +\tconst int dashless_parents = 2;\n\nThat counts parent #0 (the first parent) and parent #1.\n\n> +\tint dashful_parents = graph->num_parents - dashless_parents;\n\nWhen a mistaken caller calls this function on a commit that is not\nan octopus, this can underflow.  dashful_parents would be -1 for a\nnon-merge, dashful_parents would be 0 for a normal merge, and then\ndashful_parents would be 1 for a merge of three histories.  OK.\n\n> +\t/*\n> +\t * Usually, each parent gets its own column, like the diagram above, but\n> +\t * sometimes the first parent goes into an existing column, like this:\n> +\t *\n> +\t * | *---.\n> +\t * | |\\ \\ \\\n> +\t * |/ / / /\n> +\t * x 0 1 2\n> +\t *\n> +\t * In which case there will be more parents than the delta of columns.\n> +\t */\n\nIt is unclear to me what \"delta of columns\" means here.  Is this\nbecause I am unfamiliar with the internal of graph.[ch] API (and\n'delta of columns' is used elsewhere in the API internals already)?\n\n> +\tint delta_cols = (graph->num_new_columns - graph->num_columns);\n\nSo in the second picture above, new-columns (which is the columns\nused after showing the current line) is narrower (because 'x' reuses\nan already allocated column without getting a new one) than columns\n(which is the columns for the octopus merge we are showing)?\n\nI am not sure I follow what is going on around here, sorry.\n\n> +\tint parent_in_old_cols = graph->num_parents - delta_cols;\n> +\t/*\n> +\t * In both cases, commit_index corresponds to the edge labeled \"0\".\n> +\t */\n> +\tint first_col = graph->commit_index + dashless_parents\n> +\t    - parent_in_old_cols;\n> +\n> +\tint i;\n> +\tfor (i = 0; i < dashful_parents; i++) {\n> +\t\tstrbuf_write_column(sb, &graph->new_columns[i+first_col], '-');\n> +\t\tstrbuf_write_column(sb, &graph->new_columns[i+first_col],\n> +\t\t\t\t    i == dashful_parents-1 ? '.' : '-');\n\nDraw a dash-dash for each, except we show dash-dot only for the last\none.  OK.  It is interesting that dashful_parents does not have to\nchange between the two examples you gave above, and it is\nunderstandable because it only depends on the shape of the graph\nnear the octopus merge itself (in other words, the placement of the\nparent commits does not contribute to it at all).  Makes sense.\n\n>  \t}\n> -\tcol_num = (i / 2) + dashless_commits + graph->commit_index;\n> -\tstrbuf_write_column(sb, &graph->new_columns[col_num], '.');\n> -\treturn num_dashes + 1;\n> +\treturn 2 * dashful_parents;\n\nThis is natural, as we showed either dash-dash or dash-dot only for\ndashful_parents after the merge itself. OK.\n\nThanks, will queue.\n\n"},{"id":"360258","messageId":"CAM-tV--Jzq6DOAfWtvk3FVX3=TT8X6bvu_4VfaJQY=M0mSQV4w@mail.gmail.com","threadId":"49521","inReplyTo":"xmqqzhvmmv8v.fsf@gitster-ct.c.googlers.com","subject":"Re: [PATCH v6] log: fix coloring of certain octupus merge shapes","fromName":"Noam Postavsky","fromEmail":"npostavs@users.sourceforge.net","sentAt":"2018-10-12T00:23:46Z","receivedAt":"2018-10-12T00:24:04Z","isPatch":true,"sender":{"key":"npostavs@users.sourceforge.net","avatar":"https://avatars.githubusercontent.com/u/287742?v=4"},"body":"On Tue, 9 Oct 2018 at 21:43, Junio C Hamano <gitster@pobox.com> wrote:\n\n> I had a bit hard time parsing the above, especially with \"then\",\n> which probably would make it easier to read if it is not there.\n\nOkay, I guess better to separate the explanation from the diagrams,\nrather than weaving them together:\n\n    For octopus merges where the first parent edge immediately merges into\n    the next column to the left, the number of columns should be one less\n    than the usual case.\n\n    First parent to the left case:\n\n    | *-.\n    | |\\ \\\n    |/ / /\n\n    The usual case:\n\n    | *-.\n    | |\\ \\\n    | | | *\n\n> > Also refactor the code to iterate over columns rather than dashes,\n> > building from an initial patch suggestion by Jeff King.\n>\n> s/suggestion/suggested/ perhaps?\n\nOk.\n\n> It is unclear to me what \"delta of columns\" means here.  Is this\n> because I am unfamiliar with the internal of graph.[ch] API (and\n> 'delta of columns' is used elsewhere in the API internals already)?\n\nNo, I just meant difference in number of columns from the previous\nline to the next. Actually, I had kind of wanted to use \"new columns\",\nbut that would be confusing with the num_new_columns variable actually\nmeaning the total number of columns in the next line.\n\n> > +     int delta_cols = (graph->num_new_columns - graph->num_columns);\n>\n> So in the second picture above, new-columns (which is the columns\n> used after showing the current line) is narrower (because 'x' reuses\n> an already allocated column without getting a new one) than columns\n> (which is the columns for the octopus merge we are showing)?\n>\n> I am not sure I follow what is going on around here, sorry.\n\nMaybe it's clearer by saying \"added columns\" (also expanded the comments a bit)?\n\n    /*\n     * Usually, we add one new column for each parent (like the diagram\n     * above) but sometimes the first parent goes into an existing column,\n     * like this:\n     *\n     * | *---.\n     * | |\\ \\ \\\n     * |/ / / /\n     * x 0 1 2\n     *\n     * In which case the number of parents will be one greater than the\n     * number of added columns.\n     */\n    int added_cols = (graph->num_new_columns - graph->num_columns);\n    int parent_in_old_cols = graph->num_parents - added_cols;\n\n\nFrom a9c90605c062b30273dad35adbf319905028cacc Mon Sep 17 00:00:00 2001\nFrom: Noam Postavsky <npostavs@users.sourceforge.net>\nDate: Sat, 1 Sep 2018 20:07:16 -0400\nSubject: [PATCH v7] log: fix coloring of certain octupus merge shapes\n\nFor octopus merges where the first parent edge immediately merges into\nthe next column to the left, the number of columns should be one less\nthan the usual case.\n\nFirst parent to the left case:\n\n| *-.\n| |\\ \\\n|/ / /\n\nThe usual case:\n\n| *-.\n| |\\ \\\n| | | *\n\nAlso refactor the code to iterate over columns rather than dashes,\nbuilding from an initial patch suggested by Jeff King.\n\nSigned-off-by: Noam Postavsky <npostavs@users.sourceforge.net>\nReviewed-by: Jeff King <peff@peff.net>\n---\n graph.c                      |  58 +++++++++++++++++-------\n t/t4214-log-graph-octopus.sh | 102 +++++++++++++++++++++++++++++++++++++++++++\n 2 files changed, 145 insertions(+), 15 deletions(-)\n create mode 100755 t/t4214-log-graph-octopus.sh\n\ndiff --git a/graph.c b/graph.c\nindex e1f6d3bddb..f53135485f 100644\n--- a/graph.c\n+++ b/graph.c\n@@ -842,27 +842,55 @@ static void graph_output_commit_char(struct git_graph *graph, struct strbuf *sb)\n }\n \n /*\n- * Draw an octopus merge and return the number of characters written.\n+ * Draw the horizontal dashes of an octopus merge and return the number of\n+ * characters written.\n  */\n static int graph_draw_octopus_merge(struct git_graph *graph,\n \t\t\t\t    struct strbuf *sb)\n {\n \t/*\n-\t * Here dashless_commits represents the number of parents\n-\t * which don't need to have dashes (because their edges fit\n-\t * neatly under the commit).\n-\t */\n-\tconst int dashless_commits = 2;\n-\tint col_num, i;\n-\tint num_dashes =\n-\t\t((graph->num_parents - dashless_commits) * 2) - 1;\n-\tfor (i = 0; i < num_dashes; i++) {\n-\t\tcol_num = (i / 2) + dashless_commits + graph->commit_index;\n-\t\tstrbuf_write_column(sb, &graph->new_columns[col_num], '-');\n+\t * Here dashless_parents represents the number of parents which don't\n+\t * need to have dashes (the edges labeled \"0\" and \"1\").  And\n+\t * dashful_parents are the remaining ones.\n+\t *\n+\t * | *---.\n+\t * | |\\ \\ \\\n+\t * | | | | |\n+\t * x 0 1 2 3\n+\t *\n+\t */\n+\tconst int dashless_parents = 2;\n+\tint dashful_parents = graph->num_parents - dashless_parents;\n+\n+\t/*\n+\t * Usually, we add one new column for each parent (like the diagram\n+\t * above) but sometimes the first parent goes into an existing column,\n+\t * like this:\n+\t *\n+\t * | *---.\n+\t * | |\\ \\ \\\n+\t * |/ / / /\n+\t * x 0 1 2\n+\t *\n+\t * In which case the number of parents will be one greater than the\n+\t * number of added columns.\n+\t */\n+\tint added_cols = (graph->num_new_columns - graph->num_columns);\n+\tint parent_in_old_cols = graph->num_parents - added_cols;\n+\n+\t/*\n+\t * In both cases, commit_index corresponds to the edge labeled \"0\".\n+\t */\n+\tint first_col = graph->commit_index + dashless_parents\n+\t    - parent_in_old_cols;\n+\n+\tint i;\n+\tfor (i = 0; i < dashful_parents; i++) {\n+\t\tstrbuf_write_column(sb, &graph->new_columns[i+first_col], '-');\n+\t\tstrbuf_write_column(sb, &graph->new_columns[i+first_col],\n+\t\t\t\t    i == dashful_parents-1 ? '.' : '-');\n \t}\n-\tcol_num = (i / 2) + dashless_commits + graph->commit_index;\n-\tstrbuf_write_column(sb, &graph->new_columns[col_num], '.');\n-\treturn num_dashes + 1;\n+\treturn 2 * dashful_parents;\n }\n \n static void graph_output_commit_line(struct git_graph *graph, struct strbuf *sb)\ndiff --git a/t/t4214-log-graph-octopus.sh b/t/t4214-log-graph-octopus.sh\nnew file mode 100755\nindex 0000000000..dab96c89aa\n--- /dev/null\n+++ b/t/t4214-log-graph-octopus.sh\n@@ -0,0 +1,102 @@\n+#!/bin/sh\n+\n+test_description='git log --graph of skewed left octopus merge.'\n+\n+. ./test-lib.sh\n+\n+test_expect_success 'set up merge history' '\n+\tcat >expect.uncolored <<-\\EOF &&\n+\t* left\n+\t| *---.   octopus-merge\n+\t| |\\ \\ \\\n+\t|/ / / /\n+\t| | | * 4\n+\t| | * | 3\n+\t| | |/\n+\t| * | 2\n+\t| |/\n+\t* | 1\n+\t|/\n+\t* initial\n+\tEOF\n+\tcat >expect.colors <<-\\EOF &&\n+\t* left\n+\t<RED>|<RESET> *<BLUE>-<RESET><BLUE>-<RESET><MAGENTA>-<RESET><MAGENTA>.<RESET>   octopus-merge\n+\t<RED>|<RESET> <RED>|<RESET><YELLOW>\\<RESET> <BLUE>\\<RESET> <MAGENTA>\\<RESET>\n+\t<RED>|<RESET><RED>/<RESET> <YELLOW>/<RESET> <BLUE>/<RESET> <MAGENTA>/<RESET>\n+\t<RED>|<RESET> <YELLOW>|<RESET> <BLUE>|<RESET> * 4\n+\t<RED>|<RESET> <YELLOW>|<RESET> * <MAGENTA>|<RESET> 3\n+\t<RED>|<RESET> <YELLOW>|<RESET> <MAGENTA>|<RESET><MAGENTA>/<RESET>\n+\t<RED>|<RESET> * <MAGENTA>|<RESET> 2\n+\t<RED>|<RESET> <MAGENTA>|<RESET><MAGENTA>/<RESET>\n+\t* <MAGENTA>|<RESET> 1\n+\t<MAGENTA>|<RESET><MAGENTA>/<RESET>\n+\t* initial\n+\tEOF\n+\ttest_commit initial &&\n+\tfor i in 1 2 3 4 ; do\n+\t\tgit checkout master -b $i || return $?\n+\t\t# Make tag name different from branch name, to avoid\n+\t\t# ambiguity error when calling checkout.\n+\t\ttest_commit $i $i $i tag$i || return $?\n+\tdone &&\n+\tgit checkout 1 -b merge &&\n+\ttest_tick &&\n+\tgit merge -m octopus-merge 1 2 3 4 &&\n+\tgit checkout 1 -b L &&\n+\ttest_commit left\n+'\n+\n+test_expect_success 'log --graph with tricky octopus merge with colors' '\n+\ttest_config log.graphColors red,green,yellow,blue,magenta,cyan &&\n+\tgit log --color=always --graph --date-order --pretty=tformat:%s --all >actual.colors.raw &&\n+\ttest_decode_color <actual.colors.raw | sed \"s/ *\\$//\" >actual.colors &&\n+\ttest_cmp expect.colors actual.colors\n+'\n+\n+test_expect_success 'log --graph with tricky octopus merge, no color' '\n+\tgit log --color=never --graph --date-order --pretty=tformat:%s --all >actual.raw &&\n+\tsed \"s/ *\\$//\" actual.raw >actual &&\n+\ttest_cmp expect.uncolored actual\n+'\n+\n+# Repeat the previous two tests with \"normal\" octopus merge (i.e.,\n+# without the first parent skewing to the \"left\" branch column).\n+\n+test_expect_success 'log --graph with normal octopus merge, no color' '\n+\tcat >expect.uncolored <<-\\EOF &&\n+\t*---.   octopus-merge\n+\t|\\ \\ \\\n+\t| | | * 4\n+\t| | * | 3\n+\t| | |/\n+\t| * | 2\n+\t| |/\n+\t* | 1\n+\t|/\n+\t* initial\n+\tEOF\n+\tgit log --color=never --graph --date-order --pretty=tformat:%s merge >actual.raw &&\n+\tsed \"s/ *\\$//\" actual.raw >actual &&\n+\ttest_cmp expect.uncolored actual\n+'\n+\n+test_expect_success 'log --graph with normal octopus merge with colors' '\n+\tcat >expect.colors <<-\\EOF &&\n+\t*<YELLOW>-<RESET><YELLOW>-<RESET><BLUE>-<RESET><BLUE>.<RESET>   octopus-merge\n+\t<RED>|<RESET><GREEN>\\<RESET> <YELLOW>\\<RESET> <BLUE>\\<RESET>\n+\t<RED>|<RESET> <GREEN>|<RESET> <YELLOW>|<RESET> * 4\n+\t<RED>|<RESET> <GREEN>|<RESET> * <BLUE>|<RESET> 3\n+\t<RED>|<RESET> <GREEN>|<RESET> <BLUE>|<RESET><BLUE>/<RESET>\n+\t<RED>|<RESET> * <BLUE>|<RESET> 2\n+\t<RED>|<RESET> <BLUE>|<RESET><BLUE>/<RESET>\n+\t* <BLUE>|<RESET> 1\n+\t<BLUE>|<RESET><BLUE>/<RESET>\n+\t* initial\n+\tEOF\n+\ttest_config log.graphColors red,green,yellow,blue,magenta,cyan &&\n+\tgit log --color=always --graph --date-order --pretty=tformat:%s merge >actual.colors.raw &&\n+\ttest_decode_color <actual.colors.raw | sed \"s/ *\\$//\" >actual.colors &&\n+\ttest_cmp expect.colors actual.colors\n+'\n+test_done\n-- \n2.11.0\n\n"},{"id":"360269","messageId":"xmqqlg73df28.fsf@gitster-ct.c.googlers.com","threadId":"49521","inReplyTo":"CAM-tV--Jzq6DOAfWtvk3FVX3=TT8X6bvu_4VfaJQY=M0mSQV4w@mail.gmail.com","subject":"Re: [PATCH v6] log: fix coloring of certain octupus merge shapes","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2018-10-12T03:22:39Z","receivedAt":"2018-10-12T03:22:45Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"I'll do the s/octu/octo/; again on the title while queuing.\n\nLet's merge this to 'next'.\n\nThanks.\n\n"}]}