git.vger.kernel.org archive mirror
 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 2/3] commit-graph tests: fix another graph_git_two_modes() helper
Date: Fri, 15 Oct 2021 09:15:34 -0700	[thread overview]
Message-ID: <xmqqwnme8dsp.fsf@gitster.g> (raw)
In-Reply-To: <patch-2.3-d6934031882-20211014T233343Z-avarab@gmail.com> ("Ævar	Arnfjörð Bjarmason"'s message of "Fri, 15 Oct 2021 01:37:15 +0200")

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

> In 135a7123755 (commit-graph: add --split option to builtin,
> 2019-06-18) this function was copy/pasted to the split commit-graph
> tests, as in the preceding commit we need to fix this to use
> &&-chaining, so it won't be hiding errors.
>
> Unlike its sister function in "t5318-commit-graph.sh", which we got
> lucky with, this one was hiding a real test failure. A tests added in
> c523035cbd8 (commit-graph: allow cross-alternate chains, 2019-06-18)
> has never worked as intended. Unlike most other graph_git_behavior
> uses in this file it clones the repository into a sub-directory, so
> we'll need to refer to "commits/6" as "origin/commits/6".

Interesting.  The original created "fork" prepared the alternates
structure in the preceding test, but tested the "behavour" of the
commands outside the "fork" it just prepared?

>  graph_git_two_modes() {
> -	git -c core.commitGraph=true $1 >output
> -	git -c core.commitGraph=false $1 >expect
> +	git ${2:+ -C "$2"} -c core.commitGraph=true $1 >output &&
> +	git ${2:+ -C "$2"} -c core.commitGraph=false $1 >expect &&

OK, it was a bit curious to see :+ (instead of just +), but the
caller unconditionally passes "$DIR" (with double quotes), so it is
understandable.  Much more concise than having the caller to repeat
${4+"$4"} where it says "$DIR".

>  	test_cmp expect output
>  }
>  
> @@ -64,12 +64,13 @@ graph_git_behavior() {
>  	MSG=$1
>  	BRANCH=$2
>  	COMPARE=$3
> +	DIR=$4
>  	test_expect_success "check normal git operations: $MSG" '
> -		graph_git_two_modes "log --oneline $BRANCH" &&
> -		graph_git_two_modes "log --topo-order $BRANCH" &&
> -		graph_git_two_modes "log --graph $COMPARE..$BRANCH" &&
> -		graph_git_two_modes "branch -vv" &&
> -		graph_git_two_modes "merge-base -a $BRANCH $COMPARE"
> +		graph_git_two_modes "log --oneline $BRANCH" "$DIR" &&
> +		graph_git_two_modes "log --topo-order $BRANCH" "$DIR" &&
> +		graph_git_two_modes "log --graph $COMPARE..$BRANCH" "$DIR" &&
> +		graph_git_two_modes "branch -vv" "$DIR" &&
> +		graph_git_two_modes "merge-base -a $BRANCH $COMPARE" "$DIR"
>  	'
>  }
>  
> @@ -187,7 +188,10 @@ test_expect_success 'create fork and chain across alternate' '
>  	)
>  '
>  
> -graph_git_behavior 'alternate: commit 13 vs 6' commits/13 commits/6
> +if test -d fork
> +then
> +	graph_git_behavior 'alternate: commit 13 vs 6' commits/13 origin/commits/6 "fork"
> +fi
>  
>  test_expect_success 'test merge stragety constants' '
>  	git clone . merge-2 &&

  reply	other threads:[~2021-10-15 16:15 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 [this message]
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

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=xmqqwnme8dsp.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 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 NNTP newsgroup(s).