From: Junio C Hamano <gitster@pobox.com>
To: Labnann <khalid.masum.92@gmail.com>
Cc: git@vger.kernel.org, gitgitgadget@gmail.com
Subject: Re: [PATCH v3 1/1] t3501: remove redundant file check and stop ignoring git <cmd> exit code
Date: Mon, 04 Apr 2022 08:54:48 -0700 [thread overview]
Message-ID: <xmqqfsmssv1z.fsf@gitster.g> (raw)
In-Reply-To: <20220402192415.19023-2-khalid.masum.92@gmail.com> (Labnann's message of "Sat, 2 Apr 2022 19:24:15 +0000")
Labnann <khalid.masum.92@gmail.com> writes:
> In the test 'cherry-pick after renaming branch', stop checking for
> the presence of a file (opos) because we are going to "grep" in it in
> the same test and the lack of it will be noticed as a failure anyway.
OK.
> In the test 'revert after renaming branch', instead of allowing any
> random contents as long as a known phrase is not there in it, we can
> expect the exact outcome---after the successful revert of
> "added", the contents of file "spoo" should become identical to
> what was in file "oops" in the "initial" commit.
Makes sense. The code removes "test -f spoo", which is not
explained in the above, and I do not think we want to. We'd
notice a breakage where revert leaves the right result in HEAD
but fails to match the working tree files if we leave it there.
> In both tests, 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. Therefore we could
> use test_cmp_rev
The two sentences are right. The conclusion is a bit iffy; it is
not "we could", which implies that the current one is OK but it is
OK to also rewrite it to use test_cmp_rev.
Use the 'test_cmp_rev' helper to make sure we will notice such a
breakage.
or something like that, perhaps?
> Signed-off-by: Labnann <khalid.masum.92@gmail.com>
Is Labnann your name? I do not know where you are from so forgive
me if it is. We prefer people to sign with their real names (cf.
Documentation/SubmittingPatches[[real-name]]) on this line (and
because the name/e-mail on this line must match the author's ident,
the same preference applies there, too).
> ---
> t/t3501-revert-cherry-pick.sh | 8 +++-----
> 1 file changed, 3 insertions(+), 5 deletions(-)
>
> diff --git a/t/t3501-revert-cherry-pick.sh b/t/t3501-revert-cherry-pick.sh
> index 8617efaaf1..ad8f0cae5a 100755
> --- a/t/t3501-revert-cherry-pick.sh
> +++ b/t/t3501-revert-cherry-pick.sh
> @@ -66,8 +66,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 -f opos &&
> + test_cmp_rev rename2 HEAD^ &&
> grep "Add extra line at the end" opos &&
> git reflog -1 | grep cherry-pick
>
> @@ -77,9 +76,8 @@ test_expect_success 'revert after renaming branch' '
>
> git checkout rename1 &&
> git revert added &&
> - test $(git rev-parse HEAD^) = $(git rev-parse rename1) &&
> - test -f spoo &&
> - ! grep "Add extra line at the end" spoo &&
> + test_cmp_rev rename1 HEAD^ &&
> + test_cmp_rev initial:oops HEAD:spoo &&
> git reflog -1 | grep revert
>
> '
The diff looks almost perfect here (modulo that "test -f spoo" is
better kept, I would think).
Thanks.
next prev parent reply other threads:[~2022-04-04 15:54 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
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 [this message]
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=xmqqfsmssv1z.fsf@gitster.g \
--to=gitster@pobox.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 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.