git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrei Rybak <rybak.a.v@gmail.com>
To: Edwin Fernando <edwinfernando734@gmail.com>, git@vger.kernel.org
Cc: Eric Sunshine <sunshine@sunshineco.com>
Subject: Re: [GSOC][PATCH v2] t3701: don't lose "git" exit codes in test scripts
Date: Sun, 2 Apr 2023 12:41:09 +0200	[thread overview]
Message-ID: <96430edd-a4f8-1f3c-a1f2-860e0af5e4e7@gmail.com> (raw)
In-Reply-To: <20230401194756.5954-1-edwinfernando734@gmail.com>

On 01/04/2023 21:47, Edwin Fernando wrote:
> Exit codes were lost due to piping and command substitution:

s/were/are/

See section "[[present-tense]]" in Documentation/SubmittingPatches:

    The problem statement that describes the status quo is written in the
    present tense.  Write "The code does X when it is given input Y",
    instead of "The code used to do Y when given input X".  You do not
    have to say "Currently"---the status quo in the problem statement is
    about the code _without_ your change, by project convention.

> 
> - "git ... | <command>"
> - "<command> $(git ... )"
> 
> Fix these issues using the intermediate step of writing output to file.
> ---
> Changes in response to review:
> - addressed code style issues: ">diff" not  "> diff_file"
> - a more direct alternative to "test -z $(cat ...)"
> - commit message similar to previous commits accomplishing same goals
> - revert unnecessary change. keep "<var> = $(git ...)"
> 
>   t/t3701-add-interactive.sh | 31 +++++++++++++++----------------
>   1 file changed, 15 insertions(+), 16 deletions(-)
> 
> diff --git a/t/t3701-add-interactive.sh b/t/t3701-add-interactive.sh
> index 80446b311d..77aad9032a 100755
> --- a/t/t3701-add-interactive.sh
> +++ b/t/t3701-add-interactive.sh
> @@ -292,10 +292,10 @@ test_expect_success FILEMODE 'patch does not affect mode' '
>   	echo content >>file &&
>   	chmod +x file &&
>   	printf "n\\ny\\n" | git add -p &&
> -	git show :file > show_file &&
> -	grep content show_file &&
> -	git diff file > diff_file &&
> -	grep "new mode" diff_file
> +	git show :file >show &&
> +	grep content show &&
> +	git diff file >diff &&
> +	grep "new mode" diff
>   '
>   
>   test_expect_success FILEMODE 'stage mode but not hunk' '
> @@ -303,10 +303,10 @@ test_expect_success FILEMODE 'stage mode but not hunk' '
>   	echo content >>file &&
>   	chmod +x file &&
>   	printf "y\\nn\\n" | git add -p &&
> -	git diff --cached file > diff_file &&
> -	grep "new mode" diff_file &&
> -	git diff file > diff_file &&
> -	grep "+content" diff_file
> +	git diff --cached file >diff &&
> +	grep "new mode" diff &&
> +	git diff file >diff &&
> +	grep "+content" diff
>   '
>   
>   
> @@ -315,12 +315,11 @@ test_expect_success FILEMODE 'stage mode and hunk' '
>   	echo content >>file &&
>   	chmod +x file &&
>   	printf "y\\ny\\n" | git add -p &&
> -	git diff --cached file > diff_file &&
> -	grep "new mode" diff_file &&
> -	git diff --cached file diff_file &&
> -	grep "+content" diff_file &&
> -	git diff file > diff_file &&
> -	test -z $(cat diff_file)
> +	git diff --cached file >diff &&
> +	grep "new mode" diff &&
> +	grep "+content" diff &&
> +	git diff file >diff &&
> +	test_must_be_empty diff
>   '
>   
>   # end of tests disabled when filemode is not usable
> @@ -977,8 +976,8 @@ test_expect_success 'handle submodules' '
>   
>   	force_color git -C for-submodules add -p dirty-head >output 2>&1 <y &&
>   	git -C for-submodules ls-files --stage dirty-head >actual &&
> -	git -C for-submodules/dirty-head rev-parse HEAD > rev &&
> -	grep -f rev actual
> +	rev="$(git -C for-submodules/dirty-head rev-parse HEAD)" &&
> +	grep "$rev" actual
>   '
>   
>   test_expect_success 'set up pathological context' '

It seems that you've created a second commit on top of the patch
you've originally sent and have only sent the second commit as "v2".
That is not what you want to show your reviewers, and more importantly,
that is not what we want to record in our history.

Instead, you should squash these two commits together and send it as
a single patch, as though the commit from v1 doesn't exist.

  reply	other threads:[~2023-04-02 10:41 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-26 17:31 [GSOC][PATCH 0/1] Avoid suppression of git's exit code in tests Edwin Fernando
2023-03-26 17:31 ` [GSOC][PATCH 1/1] t3701: Avoid suppression of exit status of git Edwin Fernando
2023-03-26 20:14   ` Andrei Rybak
2023-03-27 10:11     ` Eric Sunshine
2023-04-01 19:47 ` [GSOC][PATCH v2] t3701: don't lose "git" exit codes in test scripts Edwin Fernando
2023-04-02 10:41   ` Andrei Rybak [this message]
2023-04-02 11:36   ` [GSOC][PATCH v3] " Edwin Fernando
2023-04-02 17:17     ` Eric Sunshine
2023-04-02 19:17     ` [GSOC][PATCH v4] " Edwin Fernando
2023-04-03  6:24       ` Eric Sunshine
2023-04-03  9:21         ` Edwin Fernando
2023-04-03  9:34         ` Edwin Fernando
2023-04-03 17:03           ` Eric Sunshine

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=96430edd-a4f8-1f3c-a1f2-860e0af5e4e7@gmail.com \
    --to=rybak.a.v@gmail.com \
    --cc=edwinfernando734@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=sunshine@sunshineco.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).