git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH] blame - fix some issues identified by coverage report.
       [not found] <Re: [PATCH v7 7/8] blame: add a fingerprint heuristic to match ignored lines>
@ 2019-06-01 21:09 ` michael
  2019-06-03 15:26   ` Barret Rhoden
  0 siblings, 1 reply; 3+ messages in thread
From: michael @ 2019-06-01 21:09 UTC (permalink / raw)
  To: git
  Cc: Jeff King, Stefan Beller, Jeff Smith, Junio C Hamano,
	René Scharfe, Ævar Arnfjörð Bjarmason,
	David Kastrup, Johannes Schindelin, Barret Rhoden,
	Michael Platings

From: Michael Platings <michael@platin.gs>

Thanks to Derrick Stolee for highlighting missing coverage.

In the case of "certainties[i] = CERTAINTY_NOT_CALCULATED" this was
defeating an optimization that preserved results of calculations
between line-matching passes. This had caused other code to never
be executed - that code is now executed and only discards calculation
results that are no longer valid.

In the case of "max_search_distance_b = 0" this was never executed
because another statement was added earlier in the function to return
early in such a case.

Signed-off-by: Michael Platings <michael@platin.gs>
---
 blame.c | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/blame.c b/blame.c
index c059063688..2b47c942db 100644
--- a/blame.c
+++ b/blame.c
@@ -825,10 +825,6 @@ static void fuzzy_find_matching_lines_recurse(
 		*get_similarity(similarities, most_certain_line_a - start_a,
 				i, closest_local_line_a,
 				max_search_distance_a) = -1;
-
-		if (certainties[i] >= 0) {
-			certainties[i] = CERTAINTY_NOT_CALCULATED;
-		}
 	}
 
 	/* More invalidating of results that may be affected by the choice of
@@ -947,12 +943,8 @@ static int *fuzzy_find_matching_lines(struct blame_origin *parent,
 	if (max_search_distance_a >= length_a)
 		max_search_distance_a = length_a ? length_a - 1 : 0;
 
-	if (length_a == 0) {
-		max_search_distance_b = 0;
-	} else {
-		max_search_distance_b = ((2 * max_search_distance_a + 1) *
-			length_b - 1) / length_a;
-	}
+	max_search_distance_b = ((2 * max_search_distance_a + 1) *
+		length_b - 1) / length_a;
 
 	result = xcalloc(sizeof(int), length_b);
 	second_best_result = xcalloc(sizeof(int), length_b);
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] blame - fix some issues identified by coverage report.
  2019-06-01 21:09 ` [PATCH] blame - fix some issues identified by coverage report michael
@ 2019-06-03 15:26   ` Barret Rhoden
  2019-06-03 18:08     ` Junio C Hamano
  0 siblings, 1 reply; 3+ messages in thread
From: Barret Rhoden @ 2019-06-03 15:26 UTC (permalink / raw)
  To: michael, git
  Cc: Jeff King, Stefan Beller, Jeff Smith, Junio C Hamano,
	René Scharfe, Ævar Arnfjörð Bjarmason,
	David Kastrup, Johannes Schindelin

Hi Michael -

On 6/1/19 5:09 PM, michael@platin.gs wrote:
> From: Michael Platings <michael@platin.gs>
> 
> Thanks to Derrick Stolee for highlighting missing coverage.
> 
> In the case of "certainties[i] = CERTAINTY_NOT_CALCULATED" this was
> defeating an optimization that preserved results of calculations
> between line-matching passes. This had caused other code to never
> be executed - that code is now executed and only discards calculation
> results that are no longer valid.
> 
> In the case of "max_search_distance_b = 0" this was never executed
> because another statement was added earlier in the function to return
> early in such a case.
> 
> Signed-off-by: Michael Platings <michael@platin.gs>

If it's OK with you, I can squash this into your existing patch in the 
blame-ignore patch set.

Thanks,

Barret

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] blame - fix some issues identified by coverage report.
  2019-06-03 15:26   ` Barret Rhoden
@ 2019-06-03 18:08     ` Junio C Hamano
  0 siblings, 0 replies; 3+ messages in thread
From: Junio C Hamano @ 2019-06-03 18:08 UTC (permalink / raw)
  To: Barret Rhoden
  Cc: michael, git, Jeff King, Stefan Beller, Jeff Smith,
	René Scharfe, Ævar Arnfjörð Bjarmason,
	David Kastrup, Johannes Schindelin

Barret Rhoden <brho@google.com> writes:

> Hi Michael -
>
> On 6/1/19 5:09 PM, michael@platin.gs wrote:
>> From: Michael Platings <michael@platin.gs>
>>
>> Thanks to Derrick Stolee for highlighting missing coverage.
>>
>> In the case of "certainties[i] = CERTAINTY_NOT_CALCULATED" this was
>> defeating an optimization that preserved results of calculations
>> between line-matching passes. This had caused other code to never
>> be executed - that code is now executed and only discards calculation
>> results that are no longer valid.
>>
>> In the case of "max_search_distance_b = 0" this was never executed
>> because another statement was added earlier in the function to return
>> early in such a case.
>>
>> Signed-off-by: Michael Platings <michael@platin.gs>
>
> If it's OK with you, I can squash this into your existing patch in the
> blame-ignore patch set.

Thanks, both.  That'd make my life easier ;-) by allowing me to
ignore this patch for now, knowing you two are on top of the issue.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-06-03 18:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <Re: [PATCH v7 7/8] blame: add a fingerprint heuristic to match ignored lines>
2019-06-01 21:09 ` [PATCH] blame - fix some issues identified by coverage report michael
2019-06-03 15:26   ` Barret Rhoden
2019-06-03 18:08     ` Junio C Hamano

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).