{"thread":{"id":"13643","subject":"bug in \"git log --graph\" at the tail end?","startedAt":"2008-05-23T20:42:56Z","lastAt":"2008-05-25T06:49:51Z","messageCount":15,"participants":["Junio C Hamano","Reece Dunn","Adam Simpkins","Teemu Likonen"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"77600","messageId":"7vve14rbu7.fsf@gitster.siamese.dyndns.org","threadId":"13643","inReplyTo":null,"subject":"bug in \"git log --graph\" at the tail end?","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-05-23T20:42:56Z","receivedAt":"2008-05-23T20:42:56Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"It appears that \"log --graph\" output has a bug at its tail end.\n\n    $ git log --pretty=oneline --abbrev-commit --graph 9d88058^..1af8bca\n    M   1af8bca... Merge branch 'maint'\n    |\\  \n    | M   008442f... Merge branch 'maint-1.5.4' into maint\n    | |\\  \n    | * e77b0b5... git-am: fix typo in usage message\n    | * 74190d2... doc/git-daemon: s/uploadarchive/uploadarch/\n    M   9d88058... Merge branch 'ar/add-unreadable'\n    |\\  \n    * dad25e4... Add a config option to ignore errors for git-add\n    * 8959743... Add a test for git-add --ignore-errors\n    * 984b83e... Add --ignore-errors to git-add to allow it to sk...\n    * 7ae02a3... Extend interface of add_files_to_cache to allow ...\n    * 960b8ad... Make the exit code of add_file_to_index actually...\n\nIdeally, I think the output should look like this:\n\n    M   1af8bca... Merge branch 'maint'\n    |\\  \n    | M   008442f... Merge branch 'maint-1.5.4' into maint\n    | |\\  \n    | * e77b0b5... git-am: fix typo in usage message\n    | * 74190d2... doc/git-daemon: s/uploadarchive/uploadarch/\n    M   9d88058... Merge branch 'ar/add-unreadable'\n    |\\  \n    | * dad25e4... Add a config option to ignore errors for git-add\n    | * 8959743... Add a test for git-add --ignore-errors\n    | * 984b83e... Add --ignore-errors to git-add to allow it to sk...\n    | * 7ae02a3... Extend interface of add_files_to_cache to allow ...\n    | * 960b8ad... Make the exit code of add_file_to_index actually...\n\nThis is purely cosmetic, but because --graph is only about the cosmetics,\nwe may want to do something about it.\n\nThoughts?\n"},{"id":"77601","messageId":"3f4fd2640805231402n72aaed52l7a163168e9258f25@mail.gmail.com","threadId":"13643","inReplyTo":"7vve14rbu7.fsf@gitster.siamese.dyndns.org","subject":"Re: bug in \"git log --graph\" at the tail end?","fromName":"Reece Dunn","fromEmail":"msclrhd@googlemail.com","sentAt":"2008-05-23T21:02:10Z","receivedAt":"2008-05-23T21:02:10Z","isPatch":false,"sender":{"key":"msclrhd@googlemail.com","avatar":null},"body":"2008/5/23 Junio C Hamano <gitster@pobox.com>:\n> It appears that \"log --graph\" output has a bug at its tail end.\n>\n>    $ git log --pretty=oneline --abbrev-commit --graph 9d88058^..1af8bca\n>    M   1af8bca... Merge branch 'maint'\n>    |\\\n>    | M   008442f... Merge branch 'maint-1.5.4' into maint\n>    | |\\\n>    | * e77b0b5... git-am: fix typo in usage message\n>    | * 74190d2... doc/git-daemon: s/uploadarchive/uploadarch/\n\nShouldn't this be:\n>    | M   008442f... Merge branch 'maint-1.5.4' into maint\n>    | |\\\n>    | | * e77b0b5... git-am: fix typo in usage message\n>    | | * 74190d2... doc/git-daemon: s/uploadarchive/uploadarch/\n\nas well?\n\n> This is purely cosmetic, but because --graph is only about the cosmetics,\n> we may want to do something about it.\n>\n> Thoughts?\n\nIt is also consistent and makes the output easier to scan, so +1.\n\n- Reece\n"},{"id":"77628","messageId":"20080524010555.GA5385@adamsimpkins.net","threadId":"13643","inReplyTo":"7vve14rbu7.fsf@gitster.siamese.dyndns.org","subject":"Re: bug in \"git log --graph\" at the tail end?","fromName":"Adam Simpkins","fromEmail":"adam@adamsimpkins.net","sentAt":"2008-05-24T01:05:56Z","receivedAt":"2008-05-24T01:05:56Z","isPatch":false,"sender":{"key":"adam@adamsimpkins.net","avatar":"https://gravatar.com/avatar/d3fd2c0b3e2d2136b56e95726ee03227bee4eb562f627dcd3ebca0623fa05054?d=mp&s=160"},"body":"On Fri, May 23, 2008 at 01:42:56PM -0700, Junio C Hamano wrote:\n> It appears that \"log --graph\" output has a bug at its tail end.\n> \n>     $ git log --pretty=oneline --abbrev-commit --graph 9d88058^..1af8bca\n>     M   1af8bca... Merge branch 'maint'\n>     |\\  \n>     | M   008442f... Merge branch 'maint-1.5.4' into maint\n>     | |\\  \n>     | * e77b0b5... git-am: fix typo in usage message\n>     | * 74190d2... doc/git-daemon: s/uploadarchive/uploadarch/\n>     M   9d88058... Merge branch 'ar/add-unreadable'\n>     |\\  \n>     * dad25e4... Add a config option to ignore errors for git-add\n>     * 8959743... Add a test for git-add --ignore-errors\n>     * 984b83e... Add --ignore-errors to git-add to allow it to sk...\n>     * 7ae02a3... Extend interface of add_files_to_cache to allow ...\n>     * 960b8ad... Make the exit code of add_file_to_index actually...\n> \n> Ideally, I think the output should look like this:\n> \n>     M   1af8bca... Merge branch 'maint'\n>     |\\  \n>     | M   008442f... Merge branch 'maint-1.5.4' into maint\n>     | |\\  \n>     | * e77b0b5... git-am: fix typo in usage message\n>     | * 74190d2... doc/git-daemon: s/uploadarchive/uploadarch/\n>     M   9d88058... Merge branch 'ar/add-unreadable'\n>     |\\  \n>     | * dad25e4... Add a config option to ignore errors for git-add\n>     | * 8959743... Add a test for git-add --ignore-errors\n>     | * 984b83e... Add --ignore-errors to git-add to allow it to sk...\n>     | * 7ae02a3... Extend interface of add_files_to_cache to allow ...\n>     | * 960b8ad... Make the exit code of add_file_to_index actually...\n> \n> This is purely cosmetic, but because --graph is only about the cosmetics,\n> we may want to do something about it.\n\nYes, you're right.  There are a couple bugs in handling commits with\nparents flagged as UNINTERESTING.  There are two problems:\n\n- The code that determines where each branch line should go in the next\n  commit completely ignores the uninteresting parent.  Instead, it\n  really should use two blank spaces in its computation, to account for\n  where the parent would have been.\n\n  This is more than just a cosmetic issue, since it results in branch\n  lines being mis-aligned.  This makes the graph show incorrect parent\n  child relationships.\n\n  For example, the code should draw this:\n\n  | * | <- commit with uninteresting parent\n  |  /\n  * |\n  | *\n\n  But instead, it currently draws this:\n\n  | * | <- commit with uninteresting parent\n  * |\n  | *\n\n  This is a simple one-line fix.  I'll submit a patch for it.\n\n\n- Merge commits that have uninteresting parents print branch lines for\n  all of their parents, even the uninteresting ones.\n\n  This is just a cosmetic issue, but I agree it looks bad.  Perhaps the\n  best thing to do is not to display anything for the uninteresting\n  parents.  It might look a little confusing to some users though, since\n  you can have a merge commit that is printed as 'M', but it only has\n  one parent displayed in the graph.\n\n  This change would make the output from the command you mentioned\n  above look like:\n\n    M   1af8bca... Merge branch 'maint'\n    |\\  \n    | M   008442f... Merge branch 'maint-1.5.4' into maint\n    | * e77b0b5... git-am: fix typo in usage message\n    | * 74190d2... doc/git-daemon: s/uploadarchive/uploadarch/\n    M   9d88058... Merge branch 'ar/add-unreadable'\n    * dad25e4... Add a config option to ignore errors for git-add\n    * 8959743... Add a test for git-add --ignore-errors\n    * 984b83e... Add --ignore-errors to git-add to allow it to sk...\n    * 7ae02a3... Extend interface of add_files_to_cache to allow ...\n    * 960b8ad... Make the exit code of add_file_to_index actually...\n\n-- \nAdam Simpkins\nadam@adamsimpkins.net\n"},{"id":"77631","messageId":"7vk5hkpjj5.fsf@gitster.siamese.dyndns.org","threadId":"13643","inReplyTo":"20080524010555.GA5385@adamsimpkins.net","subject":"Re: bug in \"git log --graph\" at the tail end?","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-05-24T01:39:42Z","receivedAt":"2008-05-24T01:39:42Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Adam Simpkins <adam@adamsimpkins.net> writes:\n\n> - Merge commits that have uninteresting parents print branch lines for\n>   all of their parents, even the uninteresting ones.\n>\n>   This is just a cosmetic issue, but I agree it looks bad.  Perhaps the\n>   best thing to do is not to display anything for the uninteresting\n>   parents.  It might look a little confusing to some users though, since\n>   you can have a merge commit that is printed as 'M', but it only has\n>   one parent displayed in the graph.\n\nAh, I was also going to suggest you _not_ to use 'M' at all.  In other\nwords, I do not see anything wrong if you drew the graph like this:\n\n      *   1af8bca... Merge branch 'maint'\n     /|\n    | *   008442f... Merge branch 'maint-1.5.4' into maint\n    | * e77b0b5... git-am: fix typo in usage message\n    | * 74190d2... doc/git-daemon: s/uploadarchive/uploadarch/\n"},{"id":"77632","messageId":"1211595851-11992-1-git-send-email-adam@adamsimpkins.net","threadId":"13643","inReplyTo":"7vk5hkpjj5.fsf@gitster.siamese.dyndns.org","subject":"[PATCH 0/2] fix \"log --graph\" issues with uninteresting parents","fromName":"Adam Simpkins","fromEmail":"adam@adamsimpkins.net","sentAt":"2008-05-24T02:24:09Z","receivedAt":"2008-05-24T02:24:09Z","isPatch":true,"sender":{"key":"adam@adamsimpkins.net","avatar":"https://gravatar.com/avatar/d3fd2c0b3e2d2136b56e95726ee03227bee4eb562f627dcd3ebca0623fa05054?d=mp&s=160"},"body":"This fixes the issues pointed out by Junio when graphing commits that\nhave parents that aren't printed in the log output.\n\nAdam Simpkins (2):\n  graph API: fix graph mis-alignment after uninteresting commits\n  graph API: don't print branch lines for uninteresting merge parents\n\n graph.c |   54 ++++++++++++++++++++++++++++++++++++++++++++----------\n 1 files changed, 44 insertions(+), 10 deletions(-)\n"},{"id":"77634","messageId":"1211595851-11992-2-git-send-email-adam@adamsimpkins.net","threadId":"13643","inReplyTo":"1211595851-11992-1-git-send-email-adam@adamsimpkins.net","subject":"[PATCH 1/2] graph API: fix graph mis-alignment after uninteresting commits","fromName":"Adam Simpkins","fromEmail":"adam@adamsimpkins.net","sentAt":"2008-05-24T02:24:10Z","receivedAt":"2008-05-24T02:24:10Z","isPatch":true,"sender":{"key":"adam@adamsimpkins.net","avatar":"https://gravatar.com/avatar/d3fd2c0b3e2d2136b56e95726ee03227bee4eb562f627dcd3ebca0623fa05054?d=mp&s=160"},"body":"The graphing code had a bug that caused it to output branch lines\nincorrectly after ignoring an uninteresting commit.  When computing how\nto match up the branch lines from the current commit to the next one, it\nforgot to take into account that it needed to initially start with 2\nempty spaces where the missing commit would have gone.\n\nSo, instead of drawing this,\n\n| * | <- Commit with uninteresting parent\n|  /\n* |\n\nIt used to incorrectly draw this:\n\n| * | <- Commit with uninteresting parent\n* |\n\nSigned-off-by: Adam Simpkins <adam@adamsimpkins.net>\n---\n graph.c |    3 +++\n 1 files changed, 3 insertions(+), 0 deletions(-)\n\ndiff --git a/graph.c b/graph.c\nindex 9d6ed30..400f014 100644\n--- a/graph.c\n+++ b/graph.c\n@@ -190,7 +190,10 @@ static void graph_insert_into_new_columns(struct git_graph *graph,\n \t * Ignore uinteresting and pruned commits\n \t */\n \tif (commit->object.flags & (UNINTERESTING | TREESAME))\n+\t{\n+\t\t*mapping_index += 2;\n \t\treturn;\n+\t}\n \n \t/*\n \t * If the commit is already in the new_columns list, we don't need to\n-- \n1.5.5.1.359.gebc23.dirty\n"},{"id":"77633","messageId":"1211595851-11992-3-git-send-email-adam@adamsimpkins.net","threadId":"13643","inReplyTo":"1211595851-11992-2-git-send-email-adam@adamsimpkins.net","subject":"[PATCH 2/2] graph API: don't print branch lines for uninteresting merge parents","fromName":"Adam Simpkins","fromEmail":"adam@adamsimpkins.net","sentAt":"2008-05-24T02:24:11Z","receivedAt":"2008-05-24T02:24:11Z","isPatch":true,"sender":{"key":"adam@adamsimpkins.net","avatar":"https://gravatar.com/avatar/d3fd2c0b3e2d2136b56e95726ee03227bee4eb562f627dcd3ebca0623fa05054?d=mp&s=160"},"body":"Previously, the graphing code printed lines coming out of a merge commit\nfor all of its parents, even if some of them were uninteresting.  Now it\nonly prints lines for interesting commits.\n\nFor example, for a merge commit where only the first parent is\ninteresting, the code now prints:\n\n  *  merge commit\n  *  interesting child\n\ninstead of:\n\n  M  merge commit\n  |\\\n  *  interesting child\n---\n graph.c |   57 ++++++++++++++++++++++++++++++++++++++++++++-------------\n 1 files changed, 44 insertions(+), 13 deletions(-)\n\ndiff --git a/graph.c b/graph.c\nindex 400f014..add7e44 100644\n--- a/graph.c\n+++ b/graph.c\n@@ -55,9 +55,11 @@ struct git_graph {\n \t */\n \tstruct commit *commit;\n \t/*\n-\t * The number of parents this commit has.\n-\t * (Stored so we don't have to walk over them each time we need\n-\t * this number)\n+\t * The number of interesting parents that this commit has.\n+\t *\n+\t * Note that this is not the same as the actual number of parents.\n+\t * This count excludes parents that won't be printed in the graph\n+\t * output, as determined by graph_is_interesting().\n \t */\n \tint num_parents;\n \t/*\n@@ -180,6 +182,18 @@ static void graph_ensure_capacity(struct git_graph *graph, int num_columns)\n \t\t\t\t      sizeof(int) * 2 * graph->column_capacity);\n }\n \n+/*\n+ * Returns 1 if the commit will be printed in the graph output,\n+ * and 0 otherwise.\n+ */\n+static int graph_is_interesting(struct commit *commit)\n+{\n+\t/*\n+\t * Uninteresting and pruned commits won't be printed\n+\t */\n+\treturn (commit->object.flags & (UNINTERESTING | TREESAME)) ? 0 : 1;\n+}\n+\n static void graph_insert_into_new_columns(struct git_graph *graph,\n \t\t\t\t\t  struct commit *commit,\n \t\t\t\t\t  int *mapping_index)\n@@ -187,13 +201,10 @@ static void graph_insert_into_new_columns(struct git_graph *graph,\n \tint i;\n \n \t/*\n-\t * Ignore uinteresting and pruned commits\n+\t * Ignore uinteresting commits\n \t */\n-\tif (commit->object.flags & (UNINTERESTING | TREESAME))\n-\t{\n-\t\t*mapping_index += 2;\n+\tif (!graph_is_interesting(commit))\n \t\treturn;\n-\t}\n \n \t/*\n \t * If the commit is already in the new_columns list, we don't need to\n@@ -231,8 +242,8 @@ static void graph_update_width(struct git_graph *graph,\n \tint max_cols = graph->num_columns + graph->num_parents;\n \n \t/*\n-\t * Even if the current commit has no parents, it still takes up a\n-\t * column for itself.\n+\t * Even if the current commit has no parents to be printed, it\n+\t * still takes up a column for itself.\n \t */\n \tif (graph->num_parents < 1)\n \t\tmax_cols++;\n@@ -316,6 +327,7 @@ static void graph_update_columns(struct git_graph *graph)\n \t\t}\n \n \t\tif (col_commit == graph->commit) {\n+\t\t\tint old_mapping_idx = mapping_idx;\n \t\t\tseen_this = 1;\n \t\t\tfor (parent = graph->commit->parents;\n \t\t\t     parent;\n@@ -324,6 +336,14 @@ static void graph_update_columns(struct git_graph *graph)\n \t\t\t\t\t\t\t      parent->item,\n \t\t\t\t\t\t\t      &mapping_idx);\n \t\t\t}\n+\t\t\t/*\n+\t\t\t * We always need to increment mapping_idx by at\n+\t\t\t * least 2, even if it has no interesting parents.\n+\t\t\t * The current commit always takes up at least 2\n+\t\t\t * spaces.\n+\t\t\t */\n+\t\t\tif (mapping_idx == old_mapping_idx)\n+\t\t\t\tmapping_idx += 2;\n \t\t} else {\n \t\t\tgraph_insert_into_new_columns(graph, col_commit,\n \t\t\t\t\t\t      &mapping_idx);\n@@ -353,11 +373,13 @@ void graph_update(struct git_graph *graph, struct commit *commit)\n \tgraph->commit = commit;\n \n \t/*\n-\t * Count how many parents this commit has\n+\t * Count how many interesting parents this commit has\n \t */\n \tgraph->num_parents = 0;\n-\tfor (parent = commit->parents; parent; parent = parent->next)\n-\t\tgraph->num_parents++;\n+\tfor (parent = commit->parents; parent; parent = parent->next) {\n+\t\tif (graph_is_interesting(parent->item))\n+\t\t\tgraph->num_parents++;\n+\t}\n \n \t/*\n \t * Call graph_update_columns() to update\n@@ -543,6 +565,15 @@ void graph_output_commit_line(struct git_graph *graph, struct strbuf *sb)\n \n \t\tif (col_commit == graph->commit) {\n \t\t\tseen_this = 1;\n+\t\t\t/*\n+\t\t\t * If the commit has more than 1 interesting\n+\t\t\t * parent, print 'M' to indicate that it is a\n+\t\t\t * merge.  Otherwise, print '*'.\n+\t\t\t *\n+\t\t\t * Note that even if this is actually a merge\n+\t\t\t * commit, we still print '*' if less than 2 of its\n+\t\t\t * parents are interesting.\n+\t\t\t */\n \t\t\tif (graph->num_parents > 1)\n \t\t\t\tstrbuf_addch(sb, 'M');\n \t\t\telse\n-- \n1.5.5.1.359.gebc23.dirty\n"},{"id":"77663","messageId":"20080524182530.GB2997@mithlond.arda.local","threadId":"13643","inReplyTo":"1211595851-11992-3-git-send-email-adam@adamsimpkins.net","subject":"Re: [PATCH 2/2] graph API: don't print branch lines for uninteresting merge parents","fromName":"Teemu Likonen","fromEmail":"tlikonen@iki.fi","sentAt":"2008-05-24T18:25:30Z","receivedAt":"2008-05-24T18:25:30Z","isPatch":true,"sender":{"key":"tlikonen@iki.fi","avatar":null},"body":"Adam Simpkins wrote (2008-05-23 19:24 -0700):\n\n> Previously, the graphing code printed lines coming out of a merge commit\n> for all of its parents, even if some of them were uninteresting.  Now it\n> only prints lines for interesting commits.\n> \n> For example, for a merge commit where only the first parent is\n> interesting, the code now prints:\n> \n>   *  merge commit\n>   *  interesting child\n> \n> instead of:\n> \n>   M  merge commit\n>   |\\\n>   *  interesting child\n\nI'd rather show merge commits always with M. They are still conceptually\nmerges even if the current log view shows only one parent. This patch\nchanges symbols * and M to be visual symbols, not logical symbols which\nI'd prefer.\n\nFor example user may be interested in finding certain merge but chooses\nto limit the output with a commit range. It helps if user can always\ntrust the symbols * and M to have this conceptual difference.\n"},{"id":"77673","messageId":"1211662321-28846-1-git-send-email-adam@adamsimpkins.net","threadId":"13643","inReplyTo":"20080524182530.GB2997@mithlond.arda.local","subject":"[PATCH 0/1] graph API: always print 'M' for merge commits","fromName":"Adam Simpkins","fromEmail":"adam@adamsimpkins.net","sentAt":"2008-05-24T20:52:00Z","receivedAt":"2008-05-24T20:52:00Z","isPatch":true,"sender":{"key":"adam@adamsimpkins.net","avatar":"https://gravatar.com/avatar/d3fd2c0b3e2d2136b56e95726ee03227bee4eb562f627dcd3ebca0623fa05054?d=mp&s=160"},"body":"On Sat, May 24, 2008 at 09:25:30PM +0300, Teemu Likonen wrote:\n> \n> I'd rather show merge commits always with M. They are still conceptually\n> merges even if the current log view shows only one parent. This patch\n> changes symbols * and M to be visual symbols, not logical symbols which\n> I'd prefer.\n> \n> For example user may be interested in finding certain merge but chooses\n> to limit the output with a commit range. It helps if user can always\n> trust the symbols * and M to have this conceptual difference.\n\nOkay.  Here's a simple patch to restore the behavior of always printing\n'M' for merge commits, even if less than 2 parents are shown in the\ngraph.\n\n\nAdam Simpkins (1):\n  graph API: always print 'M' for merge commits\n\n graph.c |   16 +++++++++-------\n 1 files changed, 9 insertions(+), 7 deletions(-)\n"},{"id":"77672","messageId":"1211662321-28846-2-git-send-email-adam@adamsimpkins.net","threadId":"13643","inReplyTo":"1211662321-28846-1-git-send-email-adam@adamsimpkins.net","subject":"[PATCH 1/1] graph API: always print 'M' for merge commits","fromName":"Adam Simpkins","fromEmail":"adam@adamsimpkins.net","sentAt":"2008-05-24T20:52:01Z","receivedAt":"2008-05-24T20:52:01Z","isPatch":true,"sender":{"key":"adam@adamsimpkins.net","avatar":"https://gravatar.com/avatar/d3fd2c0b3e2d2136b56e95726ee03227bee4eb562f627dcd3ebca0623fa05054?d=mp&s=160"},"body":"The recent changes for handling uninteresting commits changed the\nbehavior so that merge commits were displayed as 'M' only if they had\nmultiple interesting parents.\n\nThis change reverts to the old behavior of displaying merges as 'M',\neven if they have less than 2 parents displayed in the graph.\n---\n graph.c |   16 +++++++++-------\n 1 files changed, 9 insertions(+), 7 deletions(-)\n\ndiff --git a/graph.c b/graph.c\nindex add7e44..ba9ede0 100644\n--- a/graph.c\n+++ b/graph.c\n@@ -566,15 +566,17 @@ void graph_output_commit_line(struct git_graph *graph, struct strbuf *sb)\n \t\tif (col_commit == graph->commit) {\n \t\t\tseen_this = 1;\n \t\t\t/*\n-\t\t\t * If the commit has more than 1 interesting\n-\t\t\t * parent, print 'M' to indicate that it is a\n-\t\t\t * merge.  Otherwise, print '*'.\n+\t\t\t * If the commit is a merge, print 'M'.  Otherwise,\n+\t\t\t * print '*'.\n \t\t\t *\n-\t\t\t * Note that even if this is actually a merge\n-\t\t\t * commit, we still print '*' if less than 2 of its\n-\t\t\t * parents are interesting.\n+\t\t\t * Note that we don't check graph->num_parents to\n+\t\t\t * determine if the commit is a merge, since that\n+\t\t\t * only tracks the number of \"interesting\" parents.\n+\t\t\t * We want to print 'M' for merge commits even if\n+\t\t\t * they have less than 2 interesting parents.\n \t\t\t */\n-\t\t\tif (graph->num_parents > 1)\n+\t\t\tif (graph->commit->parents != NULL &&\n+\t\t\t    graph->commit->parents->next != NULL)\n \t\t\t\tstrbuf_addch(sb, 'M');\n \t\t\telse\n \t\t\t\tstrbuf_addch(sb, '*');\n-- \n1.5.5.1.385.ge74ed\n"},{"id":"77676","messageId":"20080524222101.GA6795@adamsimpkins.net","threadId":"13643","inReplyTo":"1211595851-11992-3-git-send-email-adam@adamsimpkins.net","subject":"Re: [PATCH 2/2] graph API: don't print branch lines for uninteresting merge parents","fromName":"Adam Simpkins","fromEmail":"adam@adamsimpkins.net","sentAt":"2008-05-24T22:21:01Z","receivedAt":"2008-05-24T22:21:01Z","isPatch":true,"sender":{"key":"adam@adamsimpkins.net","avatar":"https://gravatar.com/avatar/d3fd2c0b3e2d2136b56e95726ee03227bee4eb562f627dcd3ebca0623fa05054?d=mp&s=160"},"body":"On Fri, May 23, 2008 at 07:24:11PM -0700, Adam Simpkins wrote:\n> Previously, the graphing code printed lines coming out of a merge commit\n> for all of its parents, even if some of them were uninteresting.  Now it\n> only prints lines for interesting commits.\n> \n> For example, for a merge commit where only the first parent is\n> interesting, the code now prints:\n> \n>   *  merge commit\n>   *  interesting child\n> \n> instead of:\n> \n>   M  merge commit\n>   |\\\n>   *  interesting child\n\nWhoops.  I forgot:\n\nSigned-off-by: Adam Simpkins <adam@adamsimpkins.net>\n\n-- \nAdam Simpkins\nadam@adamsimpkins.net\n"},{"id":"77677","messageId":"20080524222129.GB6795@adamsimpkins.net","threadId":"13643","inReplyTo":"1211662321-28846-2-git-send-email-adam@adamsimpkins.net","subject":"Re: [PATCH 1/1] graph API: always print 'M' for merge commits","fromName":"Adam Simpkins","fromEmail":"adam@adamsimpkins.net","sentAt":"2008-05-24T22:21:30Z","receivedAt":"2008-05-24T22:21:30Z","isPatch":true,"sender":{"key":"adam@adamsimpkins.net","avatar":"https://gravatar.com/avatar/d3fd2c0b3e2d2136b56e95726ee03227bee4eb562f627dcd3ebca0623fa05054?d=mp&s=160"},"body":"On Sat, May 24, 2008 at 01:52:01PM -0700, Adam Simpkins wrote:\n> The recent changes for handling uninteresting commits changed the\n> behavior so that merge commits were displayed as 'M' only if they had\n> multiple interesting parents.\n> \n> This change reverts to the old behavior of displaying merges as 'M',\n> even if they have less than 2 parents displayed in the graph.\n\nSigned-off-by: Adam Simpkins <adam@adamsimpkins.net>\n\n-- \nAdam Simpkins\nadam@adamsimpkins.net\n"},{"id":"77687","messageId":"7vabifkw9j.fsf@gitster.siamese.dyndns.org","threadId":"13643","inReplyTo":"1211662321-28846-1-git-send-email-adam@adamsimpkins.net","subject":"Re: [PATCH 0/1] graph API: always print 'M' for merge commits","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-05-25T01:28:08Z","receivedAt":"2008-05-25T01:28:08Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Adam Simpkins <adam@adamsimpkins.net> writes:\n\n> On Sat, May 24, 2008 at 09:25:30PM +0300, Teemu Likonen wrote:\n>> \n>> I'd rather show merge commits always with M. They are still conceptually\n>> merges even if the current log view shows only one parent. This patch\n>> changes symbols * and M to be visual symbols, not logical symbols which\n>> I'd prefer.\n>> \n>> For example user may be interested in finding certain merge but chooses\n>> to limit the output with a commit range. It helps if user can always\n>> trust the symbols * and M to have this conceptual difference.\n>\n> Okay.  Here's a simple patch to restore the behavior of always printing\n> 'M' for merge commits, even if less than 2 parents are shown in the\n> graph.\n\nI have to wonder if that is really necessary.  A merge commit, unless you\namend it, always starts with \"Merge ...\", and I think it is enough clue of\nwhat the particular commit did.  Besides, I think letter \"M\" in the\npictorial part of the graph simply looks rather ugly.\n\nI would even suggest not to use 'M' at all, whether its parents are\ninteresting or not.\n"},{"id":"77695","messageId":"20080525062927.GA3174@mithlond.arda.local","threadId":"13643","inReplyTo":"7vabifkw9j.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH 0/1] graph API: always print 'M' for merge commits","fromName":"Teemu Likonen","fromEmail":"tlikonen@iki.fi","sentAt":"2008-05-25T06:29:27Z","receivedAt":"2008-05-25T06:29:27Z","isPatch":true,"sender":{"key":"tlikonen@iki.fi","avatar":null},"body":"Junio C Hamano wrote (2008-05-24 18:28 -0700):\n\n> Adam Simpkins <adam@adamsimpkins.net> writes:\n> \n> > Okay.  Here's a simple patch to restore the behavior of always\n> > printing 'M' for merge commits, even if less than 2 parents are\n> > shown in the graph.\n> \n> I have to wonder if that is really necessary.  A merge commit, unless\n> you amend it, always starts with \"Merge ...\", and I think it is enough\n> clue of what the particular commit did.  Besides, I think letter \"M\"\n> in the pictorial part of the graph simply looks rather ugly.\n> \n> I would even suggest not to use 'M' at all, whether its parents are\n> interesting or not.\n\nI don't have strong opinions on this, although I prefer different\nsymbols for these conceptually different commits - in the current graph\nview. But if in the future someone implements an option like\nlog.unicodegraph=true which displays the graph with nice Unicode chars,\nthen I think M's wouldn't quite fit there visually anymore.\n"},{"id":"77697","messageId":"20080525064951.GA16981@adamsimpkins.net","threadId":"13643","inReplyTo":"7vabifkw9j.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH 0/1] graph API: always print 'M' for merge commits","fromName":"Adam Simpkins","fromEmail":"adam@adamsimpkins.net","sentAt":"2008-05-25T06:49:51Z","receivedAt":"2008-05-25T06:49:51Z","isPatch":true,"sender":{"key":"adam@adamsimpkins.net","avatar":"https://gravatar.com/avatar/d3fd2c0b3e2d2136b56e95726ee03227bee4eb562f627dcd3ebca0623fa05054?d=mp&s=160"},"body":"On Sat, May 24, 2008 at 06:28:08PM -0700, Junio C Hamano wrote:\n> Adam Simpkins <adam@adamsimpkins.net> writes:\n> \n> > On Sat, May 24, 2008 at 09:25:30PM +0300, Teemu Likonen wrote:\n> >> \n> >> I'd rather show merge commits always with M. They are still conceptually\n> >> merges even if the current log view shows only one parent. This patch\n> >> changes symbols * and M to be visual symbols, not logical symbols which\n> >> I'd prefer.\n> >> \n> >> For example user may be interested in finding certain merge but chooses\n> >> to limit the output with a commit range. It helps if user can always\n> >> trust the symbols * and M to have this conceptual difference.\n> >\n> > Okay.  Here's a simple patch to restore the behavior of always printing\n> > 'M' for merge commits, even if less than 2 parents are shown in the\n> > graph.\n> \n> I have to wonder if that is really necessary.  A merge commit, unless you\n> amend it, always starts with \"Merge ...\", and I think it is enough clue of\n> what the particular commit did.  Besides, I think letter \"M\" in the\n> pictorial part of the graph simply looks rather ugly.\n> \n> I would even suggest not to use 'M' at all, whether its parents are\n> interesting or not.\n\nEither way is fine with me; it's just a cosmetic issue.\n(We could even make it configurable, but that definitely seems like\noverkill.)\n\n-- \nAdam Simpkins\nadam@adamsimpkins.net\n"}]}