Thread (11 messages) 11 messages, 4 authors, 2019-06-10

Re: Git Test Coverage Report (Thursday, May 30th)

From: Michael Platings <hidden>
Date: 2019-06-01 21:22:22

Thanks very much for this Derrick. I looked into it and it turns out
that the missing coverage in blame.c for "certainties[i] =
CERTAINTY_NOT_CALCULATED" was due to earlier code overwriting the same
value in most cases, thereby defeating an optimization. I've deleted
that earlier code and now coverage is as expected. I posted the patch
here: https://public-inbox.org/git/20190601210925.15339-1-michael@platin.gs/T/#u
I also deleted the other uncovered code that appeared in the same
patch as it was unreachable.
On 5/30/2019 8:52 AM, Derrick Stolee wrote:
quoted
blame.c
170072f9 846)     (result[i] >= most_certain_line_a ||
170072f9 847)      second_best_result[i] >= most_certain_line_a)) {
170072f9 848) certainties[i] = CERTAINTY_NOT_CALCULATED;
This section appears in the following block:

        /* More invalidating of results that may be affected by the choice of
         * most certain line.
         * Discard the matches for lines in B that are currently matched with a
         * line in A such that their ordering contradicts the ordering imposed
         * by the choice of most certain line.
         */
        for (i = most_certain_local_line_b - 1; i >= invalidate_min; --i) {
                /* In this loop we discard results for lines in B that are
                 * before most-certain-line-B but are matched with a line in A
                 * that is after most-certain-line-A.
                 */
                if (certainties[i] >= 0 &&
                    (result[i] >= most_certain_line_a ||
                     second_best_result[i] >= most_certain_line_a)) {
                        certainties[i] = CERTAINTY_NOT_CALCULATED;
                }
        }
        for (i = most_certain_local_line_b + 1; i < invalidate_max; ++i) {
                /* In this loop we discard results for lines in B that are
                 * after most-certain-line-B but are matched with a line in A
                 * that is before most-certain-line-A.
                 */
                if (certainties[i] >= 0 &&
                    (result[i] <= most_certain_line_a ||
                     second_best_result[i] <= most_certain_line_a)) {
                        certainties[i] = CERTAINTY_NOT_CALCULATED;
                }
        }

Note that the first for loop includes the uncovered lines. The logical operands
are backwards of the conditions in the second for loop, which are covered. This
seems non-trivial enough to merit a test.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help