git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Michael Platings <michael@platin.gs>
Date
Jun 1, 2019, 21:22 UTC
Message-ID
<CAJDYR9QAWVJxn7cf1DQbnZTKeSGJPCXcTJT9FVNEDpf1bimtGg@mail.gmail.com>
In-Reply-To
<e18e4391-a574-1f4b-88c7-890ada116f51@gmail.com>

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.

Show 40 quoted lines
> On 5/30/2019 8:52 AM, Derrick Stolee wrote:
> > 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.
Previous: Johannes SchindelinNext: Barret Rhoden
Message 5 of 11 in “Git Test Coverage Report (Thursday, May 30th)”
  1. Derrick StoleeMay 30, 2019
  2. Derrick StoleeMay 30, 2019
  3. Derrick StoleeMay 31, 2019
  4. Johannes SchindelinMay 31, 2019
  5. Michael PlatingsJun 1, 2019
  6. Barret RhodenJun 3, 2019
  7. Derrick StoleeJun 3, 2019
  8. Barret RhodenJun 4, 2019
  9. Barret RhodenJun 4, 2019
  10. Derrick StoleeJun 5, 2019
  11. Barret RhodenJun 10, 2019

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.