{"thread":{"id":"54149","subject":"[PATCH 0/2] log_tree_diff: simplify","startedAt":"2020-08-28T11:06:48Z","lastAt":"2020-09-06T21:52:56Z","messageCount":5,"participants":["Sergey Organov","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"404680","messageId":"20200828110526.21145-1-sorganov@gmail.com","threadId":"54149","inReplyTo":null,"subject":"[PATCH 0/2] log_tree_diff: simplify","fromName":"Sergey Organov","fromEmail":"sorganov@gmail.com","sentAt":"2020-08-28T11:05:24Z","receivedAt":"2020-08-28T11:06:48Z","isPatch":true,"sender":{"key":"sorganov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8501568?v=4"},"body":"These patches are pure code quality improvements, -- they should introduce no\nchanges in behavior.\n\nSergey Organov (2):\n  log_tree_diff: get rid of code duplication for first_parent_only\n  log_tree_diff: get rid of extra check for NULL\n\n log-tree.c | 21 +++++----------------\n 1 file changed, 5 insertions(+), 16 deletions(-)\n\n-- \n2.25.1\n\n"},{"id":"404681","messageId":"20200828110526.21145-3-sorganov@gmail.com","threadId":"54149","inReplyTo":"20200828110526.21145-1-sorganov@gmail.com","subject":"[PATCH 2/2] log_tree_diff: get rid of extra check for NULL","fromName":"Sergey Organov","fromEmail":"sorganov@gmail.com","sentAt":"2020-08-28T11:05:26Z","receivedAt":"2020-08-28T11:08:08Z","isPatch":true,"sender":{"key":"sorganov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8501568?v=4"},"body":"Get rid of needless check of 'parents' for NULL. The NULL case\nis already handled right above, and 'parents' is dereferenced\nwithout check below anyway.\n\nSigned-off-by: Sergey Organov <sorganov@gmail.com>\n---\n log-tree.c | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/log-tree.c b/log-tree.c\nindex c01932fa72bf..8ac285a25af5 100644\n--- a/log-tree.c\n+++ b/log-tree.c\n@@ -917,7 +917,7 @@ static int log_tree_diff(struct rev_info *opt, struct commit *commit, struct log\n \t}\n \n \t/* More than one parent? */\n-\tif (parents && parents->next) {\n+\tif (parents->next) {\n \t\tif (opt->ignore_merges)\n \t\t\treturn 0;\n \t\telse if (opt->combine_merges)\n-- \n2.25.1\n\n"},{"id":"404682","messageId":"20200828110526.21145-2-sorganov@gmail.com","threadId":"54149","inReplyTo":"20200828110526.21145-1-sorganov@gmail.com","subject":"[PATCH 1/2] log_tree_diff: get rid of code duplication for first_parent_only","fromName":"Sergey Organov","fromEmail":"sorganov@gmail.com","sentAt":"2020-08-28T11:05:25Z","receivedAt":"2020-08-28T11:22:30Z","isPatch":true,"sender":{"key":"sorganov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8501568?v=4"},"body":"Handle first_parent_only by breaking from generic loop early\nrather than by duplicating (part of) the loop body.\n\nSigned-off-by: Sergey Organov <sorganov@gmail.com>\n---\n log-tree.c | 19 ++++---------------\n 1 file changed, 4 insertions(+), 15 deletions(-)\n\ndiff --git a/log-tree.c b/log-tree.c\nindex 55a68d0c6101..c01932fa72bf 100644\n--- a/log-tree.c\n+++ b/log-tree.c\n@@ -922,21 +922,10 @@ static int log_tree_diff(struct rev_info *opt, struct commit *commit, struct log\n \t\t\treturn 0;\n \t\telse if (opt->combine_merges)\n \t\t\treturn do_diff_combined(opt, commit);\n-\t\telse if (opt->first_parent_only) {\n-\t\t\t/*\n-\t\t\t * Generate merge log entry only for the first\n-\t\t\t * parent, showing summary diff of the others\n-\t\t\t * we merged _in_.\n-\t\t\t */\n-\t\t\tparse_commit_or_die(parents->item);\n-\t\t\tdiff_tree_oid(get_commit_tree_oid(parents->item),\n-\t\t\t\t      oid, \"\", &opt->diffopt);\n-\t\t\tlog_tree_diff_flush(opt);\n-\t\t\treturn !opt->loginfo;\n+\t\telse if (!opt->first_parent_only) {\n+\t\t\t/* If we show multiple diffs, show the parent info */\n+\t\t\tlog->parent = parents->item;\n \t\t}\n-\n-\t\t/* If we show individual diffs, show the parent info */\n-\t\tlog->parent = parents->item;\n \t}\n \n \tshowed_log = 0;\n@@ -952,7 +941,7 @@ static int log_tree_diff(struct rev_info *opt, struct commit *commit, struct log\n \n \t\t/* Set up the log info for the next parent, if any.. */\n \t\tparents = parents->next;\n-\t\tif (!parents)\n+\t\tif (!parents || opt->first_parent_only)\n \t\t\tbreak;\n \t\tlog->parent = parents->item;\n \t\topt->loginfo = log;\n-- \n2.25.1\n\n"},{"id":"405023","messageId":"874kodd8ek.fsf@osv.gnss.ru","threadId":"54149","inReplyTo":"20200828110526.21145-1-sorganov@gmail.com","subject":"Re: [PATCH 0/2] log_tree_diff: simplify","fromName":"Sergey Organov","fromEmail":"sorganov@gmail.com","sentAt":"2020-09-04T12:38:11Z","receivedAt":"2020-09-04T12:38:26Z","isPatch":true,"sender":{"key":"sorganov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8501568?v=4"},"body":"Dear Junio,\n\nSergey Organov <sorganov@gmail.com> writes:\n> These patches are pure code quality improvements, -- they should introduce no\n> changes in behavior.\n>\n> Sergey Organov (2):\n>   log_tree_diff: get rid of code duplication for first_parent_only\n>   log_tree_diff: get rid of extra check for NULL\n\nWhat's the status of this?\n\nThanks,\n-- Sergey Organov\n"},{"id":"405102","messageId":"xmqq1rje4loz.fsf@gitster.c.googlers.com","threadId":"54149","inReplyTo":"20200828110526.21145-1-sorganov@gmail.com","subject":"Re: [PATCH 0/2] log_tree_diff: simplify","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2020-09-06T21:52:44Z","receivedAt":"2020-09-06T21:52:56Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Sergey Organov <sorganov@gmail.com> writes:\n\n> These patches are pure code quality improvements, -- they should introduce no\n> changes in behavior.\n>\n> Sergey Organov (2):\n>   log_tree_diff: get rid of code duplication for first_parent_only\n>   log_tree_diff: get rid of extra check for NULL\n>\n>  log-tree.c | 21 +++++----------------\n>  1 file changed, 5 insertions(+), 16 deletions(-)\n\nIt's been so long since I looked at the codepath that it wasn't\nimmediately clear to me if we are doing the right thing around\nlog->parent until I reread 91539833 (Log message printout cleanups,\n2006-04-17) to rediscover what the field was for, but everything\nlooks good to me.\n"}]}