{"thread":{"id":"51220","subject":"[PATCH] blame - fix some issues identified by coverage report.","startedAt":"2019-06-01T21:14:22Z","lastAt":"2019-06-03T18:08:08Z","messageCount":3,"participants":["michael@platin.gs","Barret Rhoden","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"376535","messageId":"20190601210925.15339-1-michael@platin.gs","threadId":"51220","inReplyTo":null,"subject":"[PATCH] blame - fix some issues identified by coverage report.","fromName":"","fromEmail":"michael@platin.gs","sentAt":"2019-06-01T21:09:25Z","receivedAt":"2019-06-01T21:14:22Z","isPatch":true,"sender":{"key":"michael@platin.gs","avatar":"https://avatars.githubusercontent.com/u/1112348?v=4"},"body":"From: Michael Platings <michael@platin.gs>\n\nThanks to Derrick Stolee for highlighting missing coverage.\n\nIn the case of \"certainties[i] = CERTAINTY_NOT_CALCULATED\" this was\ndefeating an optimization that preserved results of calculations\nbetween line-matching passes. This had caused other code to never\nbe executed - that code is now executed and only discards calculation\nresults that are no longer valid.\n\nIn the case of \"max_search_distance_b = 0\" this was never executed\nbecause another statement was added earlier in the function to return\nearly in such a case.\n\nSigned-off-by: Michael Platings <michael@platin.gs>\n---\n blame.c | 12 ++----------\n 1 file changed, 2 insertions(+), 10 deletions(-)\n\ndiff --git a/blame.c b/blame.c\nindex c059063688..2b47c942db 100644\n--- a/blame.c\n+++ b/blame.c\n@@ -825,10 +825,6 @@ static void fuzzy_find_matching_lines_recurse(\n \t\t*get_similarity(similarities, most_certain_line_a - start_a,\n \t\t\t\ti, closest_local_line_a,\n \t\t\t\tmax_search_distance_a) = -1;\n-\n-\t\tif (certainties[i] >= 0) {\n-\t\t\tcertainties[i] = CERTAINTY_NOT_CALCULATED;\n-\t\t}\n \t}\n \n \t/* More invalidating of results that may be affected by the choice of\n@@ -947,12 +943,8 @@ static int *fuzzy_find_matching_lines(struct blame_origin *parent,\n \tif (max_search_distance_a >= length_a)\n \t\tmax_search_distance_a = length_a ? length_a - 1 : 0;\n \n-\tif (length_a == 0) {\n-\t\tmax_search_distance_b = 0;\n-\t} else {\n-\t\tmax_search_distance_b = ((2 * max_search_distance_a + 1) *\n-\t\t\tlength_b - 1) / length_a;\n-\t}\n+\tmax_search_distance_b = ((2 * max_search_distance_a + 1) *\n+\t\tlength_b - 1) / length_a;\n \n \tresult = xcalloc(sizeof(int), length_b);\n \tsecond_best_result = xcalloc(sizeof(int), length_b);\n-- \n2.21.0\n\n"},{"id":"376573","messageId":"10bbee35-4df1-1a6d-8301-6866c7445e2d@google.com","threadId":"51220","inReplyTo":"20190601210925.15339-1-michael@platin.gs","subject":"Re: [PATCH] blame - fix some issues identified by coverage report.","fromName":"Barret Rhoden","fromEmail":"brho@google.com","sentAt":"2019-06-03T15:26:52Z","receivedAt":"2019-06-03T15:26:57Z","isPatch":true,"sender":{"key":"brho@google.com","avatar":null},"body":"Hi Michael -\n\nOn 6/1/19 5:09 PM, michael@platin.gs wrote:\n> From: Michael Platings <michael@platin.gs>\n> \n> Thanks to Derrick Stolee for highlighting missing coverage.\n> \n> In the case of \"certainties[i] = CERTAINTY_NOT_CALCULATED\" this was\n> defeating an optimization that preserved results of calculations\n> between line-matching passes. This had caused other code to never\n> be executed - that code is now executed and only discards calculation\n> results that are no longer valid.\n> \n> In the case of \"max_search_distance_b = 0\" this was never executed\n> because another statement was added earlier in the function to return\n> early in such a case.\n> \n> Signed-off-by: Michael Platings <michael@platin.gs>\n\nIf it's OK with you, I can squash this into your existing patch in the \nblame-ignore patch set.\n\nThanks,\n\nBarret\n"},{"id":"376592","messageId":"xmqqk1e2v8xr.fsf@gitster-ct.c.googlers.com","threadId":"51220","inReplyTo":"10bbee35-4df1-1a6d-8301-6866c7445e2d@google.com","subject":"Re: [PATCH] blame - fix some issues identified by coverage report.","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2019-06-03T18:08:00Z","receivedAt":"2019-06-03T18:08:08Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Barret Rhoden <brho@google.com> writes:\n\n> Hi Michael -\n>\n> On 6/1/19 5:09 PM, michael@platin.gs wrote:\n>> From: Michael Platings <michael@platin.gs>\n>>\n>> Thanks to Derrick Stolee for highlighting missing coverage.\n>>\n>> In the case of \"certainties[i] = CERTAINTY_NOT_CALCULATED\" this was\n>> defeating an optimization that preserved results of calculations\n>> between line-matching passes. This had caused other code to never\n>> be executed - that code is now executed and only discards calculation\n>> results that are no longer valid.\n>>\n>> In the case of \"max_search_distance_b = 0\" this was never executed\n>> because another statement was added earlier in the function to return\n>> early in such a case.\n>>\n>> Signed-off-by: Michael Platings <michael@platin.gs>\n>\n> If it's OK with you, I can squash this into your existing patch in the\n> blame-ignore patch set.\n\nThanks, both.  That'd make my life easier ;-) by allowing me to\nignore this patch for now, knowing you two are on top of the issue.\n\n"}]}