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

Re: [PATCH 1/1] commit-graph: improve error messages

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Apr 26, 2019, 12:33 UTC
Message-ID
<875zr1rlob.fsf@evledraar.gmail.com>
In-Reply-To
<1751b479e79ba18990e4152ae2acdf60c8713340.1556279303.git.gitgitgadget@gmail.com>
On Fri, Apr 26 2019, Derrick Stolee via GitGitGadget wrote:
Show 15 quoted lines
> The error messages when reading a commit-graph have a few problems:
>
> 1. Some values are output in hexadecimal, but that is not made
>    clear by the message. Prepend "0x" to these values.
>
> 2. The version number does not need to be hexadecimal, and also
>    should mention a "maximum supported version". This has one
>    possible confusing case: we could have a corrupt commit-graph
>    file with version number zero, so the output would be
>
>    "commit-graph has version 0, our maximum supported version is 1"
>
>    This will only happen with corrupt data. This error message is
>    designed instead for the case where a client is downgraded after
>    writing a newer file version.
This looks good to me and is obviously correct:
Show 27 quoted lines
> Update t5318-commit-graph.sh to watch for these new error messages.
> [...]
> diff --git a/t/t5318-commit-graph.sh b/t/t5318-commit-graph.sh
> index e80c1cac02..264ebb15b1 100755
> --- a/t/t5318-commit-graph.sh
> +++ b/t/t5318-commit-graph.sh
> @@ -420,17 +420,17 @@ test_expect_success 'detect too small' '
>
>  test_expect_success 'detect bad signature' '
>  	corrupt_graph_and_verify 0 "\0" \
> -		"graph signature"
> +		"commit-graph signature"
>  '
>
>  test_expect_success 'detect bad version' '
>  	corrupt_graph_and_verify $GRAPH_BYTE_VERSION "\02" \
> -		"graph version"
> +		"commit-graph has version"
>  '
>
>  test_expect_success 'detect bad hash version' '
>  	corrupt_graph_and_verify $GRAPH_BYTE_HASH "\02" \
> -		"hash version"
> +		"commit-graph has hash version"
>  '
>
>  test_expect_success 'detect low chunk count' '
Just a small nit/OCD :).
The only change to that test code that's actually needed is just doing:
    -               "graph version"
    +               "graph has version"

The rest were already grepping subsets of the message before/after, and maybe worth it to keep it consistent that all these "corrupt_graph_and_verify" invocations grep the part of the message that isn't the "commit-graph <whatever>", i.e. now with just that change:

    $ git grep -h -A1 corrupt_graph_and_verify|grep -o '".*"$'
    "graph signature"
    "graph has version"
    "hash version"
    "missing the .* chunk"
    "missing the OID Fanout chunk"
    "missing the OID Lookup chunk"
    "missing the Commit Data chunk"
    "fanout value"
    "fanout value"
    "incorrect OID order"
    "from object database"
    "root tree OID for commit"
    "invalid parent"
    "is too long"
    "commit-graph parent for"
    "generation for commit"
    "non-zero generation number"
    "commit date"
    "invalid parent"
    "incorrect checksum"
Well, there's the sore thumb of "commit-graph parent for".
Previous: Derrick Stolee via GitGitGadget
Message 3 of 3 in “commit-graph: improve error messages”
  1. 0/1 commit-graph: improve error messagesDerrick Stolee via GitGitGadget, Apr 26, 2019
  2. 1/1 commit-graph: improve error messagesDerrick Stolee via GitGitGadget, Apr 26, 2019
  3. Ævar Arnfjörð BjarmasonApr 26, 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.