From: Junio C Hamano <gitster@pobox.com>
To: "SZEDER Gábor" <szeder.dev@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] t7501-commit: drop silly command substitution
Date: Wed, 22 Aug 2018 08:39:28 -0700 [thread overview]
Message-ID: <xmqq8t4y76mn.fsf@gitster-ct.c.googlers.com> (raw)
In-Reply-To: <20180821232811.3610-1-szeder.dev@gmail.com> ("SZEDER Gábor"'s message of "Wed, 22 Aug 2018 01:28:11 +0200")
SZEDER Gábor <szeder.dev@gmail.com> writes:
> The test '--dry-run with conflicts fixed from a merge' in
> 't7501-commit.sh', added in 8dc874b2ee (wt-status.c: set commitable
> bit if there is a meaningful merge., 2016-02-15), runs the following
> unnecessary and downright bogus command substitution:
>
> ! $(git merge --no-commit commit-1) &&
I vaguely recall discussing (or noticing myself and then forgetting
to mention it? I dunno) this exact one on another thread of your
test fixes and drawing the same conclusion as you have here.
Will apply. Thanks for following it through.
>
> I.e. after 'git merge ...' is executed and expectedly fails, the test
> attempts to execute its output:
>
> Merging:
> 80f2ea2 commit 2
> virtual commit-1
> found 1 common ancestor:
> e60d113 Initial commit
> Auto-merging test-file
> CONFLICT (content): Merge conflict in test-file
> Automatic merge failed; fix conflicts and then commit the result.
>
> as a command, which most likely fails, because there is no such
> command as "Merging:". Then '!' negates the failed exit status, the
> test continues, and eventually succeeds.
>
> Remove this command substitution and use 'test_must_fail' to ensure
> that 'git merge' fails.
>
> Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
> ---
> t/t7501-commit.sh | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/t/t7501-commit.sh b/t/t7501-commit.sh
> index 51646d8019..d766bf34c4 100755
> --- a/t/t7501-commit.sh
> +++ b/t/t7501-commit.sh
> @@ -677,7 +677,7 @@ test_expect_success '--dry-run with conflicts fixed from a merge' '
> git checkout -b branch-2 HEAD^1 &&
> echo "commit-2-state" >test-file &&
> git commit -m "commit 2" -i test-file &&
> - ! $(git merge --no-commit commit-1) &&
> + test_must_fail git merge --no-commit commit-1 &&
> echo "commit-2-state" >test-file &&
> git add test-file &&
> git commit --dry-run &&
prev parent reply other threads:[~2018-08-22 15:39 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-21 23:28 [PATCH] t7501-commit: drop silly command substitution SZEDER Gábor
2018-08-22 15:39 ` 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
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=xmqq8t4y76mn.fsf@gitster-ct.c.googlers.com \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=szeder.dev@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.
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).