All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Cc: git@vger.kernel.org, Glen Choo <chooglen@google.com>,
	Derrick Stolee <stolee@gmail.com>
Subject: Re: [PATCH 3/3] commit-graph: don't consider "replace" objects with "verify"
Date: Fri, 15 Oct 2021 09:18:45 -0700	[thread overview]
Message-ID: <xmqqr1cm8dne.fsf@gitster.g> (raw)
In-Reply-To: <patch-3.3-56bb70518cb-20211014T233343Z-avarab@gmail.com> (=?utf-8?B?IsOGdmFyCUFybmZqw7Zyw7A=?= Bjarmason"'s message of "Fri, 15 Oct 2021 01:37:16 +0200")

Ævar Arnfjörð Bjarmason  <avarab@gmail.com> writes:

> Extend the code added in d6538246d3d (commit-graph: not compatible
> with replace objects, 2018-08-20) which ignored replace objects in the
> "write" command to ignore it in the "verify" command too.
>
> We can just move this assignment to the cmd_commit_graph(), it
> dispatches to "write" and "verify", and we're unlikely to ever get a
> sub-command that would like to consider replace refs.
>
> This will make tests added in eddc1f556cd (mktag tests: test
> update-ref and reachable fsck, 2021-06-17) pass in combination with
> the "GIT_TEST_COMMIT_GRAPH" mode added in 859fdc0c3cf (commit-graph:
> define GIT_TEST_COMMIT_GRAPH, 2018-08-29), except that mode is
> currently broken (but is being fixed concurrently). See the discussion
> starting at [1].
>
> 1. https://lore.kernel.org/git/87wnmihswp.fsf@evledraar.gmail.com/
>
> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
> ---
>  builtin/commit-graph.c  | 2 +-
>  t/t5318-commit-graph.sh | 1 +
>  2 files changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/builtin/commit-graph.c b/builtin/commit-graph.c
> index 3c3de3a156f..fb8e166a26f 100644
> --- a/builtin/commit-graph.c
> +++ b/builtin/commit-graph.c
> @@ -263,7 +263,6 @@ static int graph_write(int argc, const char **argv)
>  	    git_env_bool(GIT_TEST_COMMIT_GRAPH_CHANGED_PATHS, 0))
>  		flags |= COMMIT_GRAPH_WRITE_BLOOM_FILTERS;
>  
> -	read_replace_refs = 0;
>  	odb = find_odb(the_repository, opts.obj_dir);
>  
>  	if (opts.reachable) {
> @@ -318,6 +317,7 @@ int cmd_commit_graph(int argc, const char **argv, const char *prefix)
>  	if (!argc)
>  		goto usage;
>  
> +	read_replace_refs = 0;
>  	save_commit_buffer = 0;
>  
>  	if (!strcmp(argv[0], "verify"))

OK.  The only question I have is if this deserves some kind of a
warning.  If the user has replacement defined and makes an explicit
request to work with the commit-graph, silently ignoring the request
instead of telling them why we are ignoring may lead to confusion.

	Side note.  It is a "question", not "objection".

Other than that, nicely done.

Thanks.

> diff --git a/t/t5318-commit-graph.sh b/t/t5318-commit-graph.sh
> index 88fbe004a38..84d122a7ae7 100755
> --- a/t/t5318-commit-graph.sh
> +++ b/t/t5318-commit-graph.sh
> @@ -385,6 +385,7 @@ test_expect_success 'replace-objects invalidates commit-graph' '
>  		git commit-graph write --reachable &&
>  		test_path_is_file .git/objects/info/commit-graph &&
>  		git replace HEAD~1 HEAD~2 &&
> +		graph_git_two_modes "commit-graph verify" &&
>  		git -c core.commitGraph=false log >expect &&
>  		git -c core.commitGraph=true log >actual &&
>  		test_cmp expect actual &&

      reply	other threads:[~2021-10-15 16:18 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-14 23:37 [PATCH 0/3] commit-graph: make "verify" work with replace refs Ævar Arnfjörð Bjarmason
2021-10-14 23:37 ` [PATCH 1/3] commit-graph tests: fix error-hiding graph_git_two_modes() helper Ævar Arnfjörð Bjarmason
2021-10-15 16:03   ` Junio C Hamano
2021-10-14 23:37 ` [PATCH 2/3] commit-graph tests: fix another " Ævar Arnfjörð Bjarmason
2021-10-15 16:15   ` Junio C Hamano
2021-10-14 23:37 ` [PATCH 3/3] commit-graph: don't consider "replace" objects with "verify" Ævar Arnfjörð Bjarmason
2021-10-15 16:18   ` Junio C Hamano [this message]

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

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

  git send-email \
    --in-reply-to=xmqqr1cm8dne.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=avarab@gmail.com \
    --cc=chooglen@google.com \
    --cc=git@vger.kernel.org \
    --cc=stolee@gmail.com \
    /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.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.