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

Re: [PATCH 2/2] rev-list: disable commit graph with --verify-objects

From
Junio C Hamano <gitster@pobox.com>
Date
Sep 7, 2022, 16:38 UTC
Message-ID
<xmqq35d3ywaw.fsf@gitster.g>
In-Reply-To
<Yxe1422xPYoMNlkG@coredump.intra.peff.net>
Show 5 quoted lines
> diff --git a/revision.c b/revision.c
> index ee702e498a..00f9c7943b 100644
> --- a/revision.c
> +++ b/revision.c
> @@ -2426,6 +2426,7 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg
It is consistent with the description in the proposed log message ...
>  		revs->tree_objects = 1;
>  		revs->blob_objects = 1;
>  		revs->verify_objects = 1;
> +		disable_commit_graph(revs->repo);
... to disable commit graph when "--verify-objects" is requested.
Show 22 quoted lines
> diff --git a/t/t1450-fsck.sh b/t/t1450-fsck.sh
> index 53c2aa10b7..f9a1bc5de7 100755
> --- a/t/t1450-fsck.sh
> +++ b/t/t1450-fsck.sh
> @@ -507,6 +507,34 @@ test_expect_success 'rev-list --verify-objects with bad sha1' '
>  	test_i18ngrep -q "error: hash mismatch $(dirname $new)$(test_oid ff_2)" out
>  '
>  
> +test_expect_success 'set up repository with commit-graph' '
> +	git init corrupt-graph &&
> +	(
> +		cd corrupt-graph &&
> +		test_commit one &&
> +		test_commit two &&
> +		git commit-graph write --reachable
> +	)
> +'
> +
> +corrupt_graph_obj () {
> +	oid=$(git -C corrupt-graph rev-parse "$1") &&
> +	obj=corrupt-graph/.git/objects/$(test_oid_to_path $oid) &&
> +	test_when_finished 'mv backup $obj' &&

OK. I missed this when-finished thing in my first read and wondered who takes care of the 'backup' file. We obviously cannot use it in tests that do not follow the "break single loose object and inspect the command behaviour in the repository" pattern, but that is OK.

Show 14 quoted lines
> +	mv $obj backup &&
> +	echo garbage >$obj
> +}
> +
> +test_expect_success 'rev-list --verify-objects with commit graph (tip)' '
> +	corrupt_graph_obj HEAD &&
> +	test_must_fail git -C corrupt-graph rev-list --verify-objects HEAD
> +'
> +
> +test_expect_success 'rev-list --verify-objects with commit graph (parent)' '
> +	corrupt_graph_obj HEAD^ &&
> +	test_must_fail git -C corrupt-graph rev-list --verify-objects HEAD
> +'
> +
Looks good, thanks.
>  test_expect_success 'force fsck to ignore double author' '
>  	git cat-file commit HEAD >basis &&
>  	sed "s/^author .*/&,&/" <basis | tr , \\n >multiple-authors &&
Previous: Taylor BlauNext: Taylor Blau
Message 6 of 7 in “bug with rev-list --verify-objects and commit-graph”
  1. 0/2 bug with rev-list --verify-objects and commit-graphJeff King, Sep 6, 2022
  2. 1/2 lookup_commit_in_graph(): use prepare_commit_graph() to check for graphJeff King, Sep 6, 2022
  3. Taylor BlauSep 6, 2022
  4. 2/2 rev-list: disable commit graph with --verify-objectsJeff King, Sep 6, 2022
  5. Taylor BlauSep 6, 2022
  6. Junio C HamanoSep 7, 2022
  7. Taylor BlauSep 6, 2022

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.