git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Jeff King <peff@peff.net>
Cc: git@vger.kernel.org, Patrick Steinhardt <ps@pks.im>
Subject: Re: [PATCH 2/2] rev-list: disable commit graph with --verify-objects
Date: Wed, 07 Sep 2022 09:38:15 -0700	[thread overview]
Message-ID: <xmqq35d3ywaw.fsf@gitster.g> (raw)
In-Reply-To: <Yxe1422xPYoMNlkG@coredump.intra.peff.net> (Jeff King's message of "Tue, 6 Sep 2022 17:04:35 -0400")

> 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.

> 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.

> +	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 &&

  parent reply	other threads:[~2022-09-07 16:38 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-06 20:58 [PATCH 0/2] bug with rev-list --verify-objects and commit-graph Jeff King
2022-09-06 21:02 ` [PATCH 1/2] lookup_commit_in_graph(): use prepare_commit_graph() to check for graph Jeff King
2022-09-06 21:16   ` Taylor Blau
2022-09-06 21:04 ` [PATCH 2/2] rev-list: disable commit graph with --verify-objects Jeff King
2022-09-06 21:20   ` Taylor Blau
2022-09-07 16:38   ` Junio C Hamano [this message]
2022-09-06 21:20 ` [PATCH 0/2] bug with rev-list --verify-objects and commit-graph Taylor Blau

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqq35d3ywaw.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=peff@peff.net \
    --cc=ps@pks.im \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).