git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Labnann <khalid.masum.92@gmail.com>
Cc: avarab@gmail.com, git@vger.kernel.org, gitgitgadget@gmail.com
Subject: Re: [PATCH v2 2/3] t3501: don't ignore "git <cmd>" exit code
Date: Fri, 01 Apr 2022 11:10:37 -0700	[thread overview]
Message-ID: <xmqqilrswu76.fsf@gitster.g> (raw)
In-Reply-To: <20220331191525.17927-3-khalid.masum.92@gmail.com> (Labnann's message of "Thu, 31 Mar 2022 19:15:24 +0000")

Labnann <khalid.masum.92@gmail.com> writes:

> without this change this test will become flaky e.g under
> SANITIZE=leak if some (but not all) memory leaks revealed by
> these commands, according to c419562860e

The body of the proposed log message is *not* a continuation (the
latter half) of a sentence that the title started, but should be a
full sentence on its own.  Capitalize the first word as usual.

Also, the leak check should not be the primary reason to do this
change.  We do not want to miss "git rev-parse" used in these tests
starts to fail, regardless of why they fail.  Perhaps like this
instead?

    Otherwise, we would not notice when "git rev-parse" starts
    segfaulting without emitting any output.  The 'test' command
    would end up being just "test =", which yields success.

> +test_cmp_rev_parse () {
> +	git rev-parse $1 >expect &&
> +	git rev-parse $2 >actual &&
> +	test_cmp expect actual
> +}

To me, it looks like we can just use test_cmp_rev that already
exists, but am I missing some subtlety?

If not (then we need to explain why in the proposed commit log
message), at least we should place $1 and $2 inside a pair of
double-quotes.  For the current callers, what they pass happen not
to need such quoting, but once we write a helper function, we are
helping _future_ callers as well, and we should be reasonably
prepared for them.

>  test_expect_success 'cherry-pick --nonsense' '
>  
>  	pos=$(git rev-parse HEAD) &&
> @@ -66,7 +72,7 @@ test_expect_success 'cherry-pick after renaming branch' '
>  
>  	git checkout rename2 &&
>  	git cherry-pick added &&
> -	test $(git rev-parse HEAD^) = $(git rev-parse rename2) &&
> +	test_cmp_rev_parse HEAD^ rename2 &&

OK.

>  	test_path_is_file opos &&
>  	grep "Add extra line at the end" opos &&
>  	git reflog -1 | grep cherry-pick
> @@ -77,7 +83,7 @@ test_expect_success 'revert after renaming branch' '
>  
>  	git checkout rename1 &&
>  	git revert added &&
> -	test $(git rev-parse HEAD^) = $(git rev-parse rename1) &&
> +	test_cmp_rev_parse HEAD^ rename1 &&

OK.

>  	test_path_is_file spoo &&
>  	! grep "Add extra line at the end" spoo &&
>  	git reflog -1 | grep revert

Thanks.

  reply	other threads:[~2022-04-01 18:10 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-30 21:43 [PATCH] t3501: use test_path_is_* functions Labnan via GitGitGadget
2022-03-30 22:11 ` Ævar Arnfjörð Bjarmason
2022-03-31 19:15   ` [PATCH v2 0/3][GSoC] t3501: remove test and test -f Labnann
2022-03-31 19:15     ` [PATCH v2 1/3] t3501: use test_path_is_* functions Labnann
2022-03-31 19:15     ` [PATCH v2 2/3] t3501: don't ignore "git <cmd>" exit code Labnann
2022-04-01 18:10       ` Junio C Hamano [this message]
2022-03-31 19:15     ` [PATCH v2 3/3] t3501: test cherry-pick revert with oids Labnann
2022-04-01 18:24       ` Junio C Hamano
2022-04-02 19:24     ` [PATCH v3 0/1][GSoC] t3501: remove redundant file checking and stop ignoring git <cmd> exit code Labnann
2022-04-02 19:24       ` [PATCH v3 1/1] t3501: remove redundant file check " Labnann
2022-04-04 15:54         ` Junio C Hamano
2022-04-05 13:47       ` [PATCH v4 0/1][GSoC] t3501: remove test -f " Khalid Masum
2022-04-05 13:47         ` [PATCH v4 1/1] " Khalid Masum
2022-04-05 15:06       ` [PATCH v4 0/1][GSoC] " Khalid Masum
2022-04-05 15:06         ` [PATCH v4 1/1] " Khalid Masum
2022-04-22 11:26 ` [PATCH v2] " Labnan via GitGitGadget

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=xmqqilrswu76.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=khalid.masum.92@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).