git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Eric Sunshine <sunshine@sunshineco.com>
To: Andrei Rybak <rybak.a.v@gmail.com>
Cc: Edwin Fernando <edwinfernando734@gmail.com>,
	vdye@github.org, git@vger.kernel.org
Subject: Re: [GSOC][PATCH 1/1] t3701: Avoid suppression of exit status of git
Date: Mon, 27 Mar 2023 06:11:16 -0400	[thread overview]
Message-ID: <CAPig+cRS5M65MskbWKBuqtzuGUMjibbBHpTBDxLYEJF33aJX4Q@mail.gmail.com> (raw)
In-Reply-To: <be2f23ec-4b3c-eb9f-fc2d-fecdf76604e1@gmail.com>

On Sun, Mar 26, 2023 at 4:21 PM Andrei Rybak <rybak.a.v@gmail.com> wrote:
> On 26/03/2023 19:31, Edwin Fernando wrote:
> In subject line "t3701: Avoid suppression of exit status of git" -- the first
> word after a colon shouldn't be capitalized.  By the way, similar existing
> commits call it:
>    don't lose "git" exit codes
> and
>    preserve "git" exit codes

Thanks, your review comments covered almost everything I was going to
say, and I agree with all you said, so I'll just add a couple comments
not covered by your review.

> > +     git show :file > show_file &&
>
> Code style here and in all output redirections below: lose the space between
> redirection and the path, like so:
>    git show :file >show_file
>
> Also, the suffix "_file" is unnecessary.  Just
>    git show :file >show
> or
>    git show :file >out
> or
>    git show :file >actual
> might be better.

Fully agree with either of the latter two suggestions.

> > @@ -311,9 +315,12 @@ test_expect_success FILEMODE 'stage mode and hunk' '
> > -     git diff --cached file | grep "new mode" &&
> > -     git diff --cached file | grep "+content" &&
> > -     test -z "$(git diff file)"
> > +     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)
>
> Function test_stdout_line_count can be used here instead of "test -z".
> test_stdout_line_count would produce a more helpful error message in
> case of test failure.

The other idiomatic possibility would be to use test_must_be_empty()
to verify that the file is empty.

> > -     rev="$(git -C for-submodules/dirty-head rev-parse HEAD)" &&
> > -     grep "$rev" actual
> > +     git -C for-submodules/dirty-head rev-parse HEAD > rev &&
> > +     grep -f rev actual

This change is unnecessary since this is a cases in which the exit
code does not get lost; the exit code of the command substitution
becomes the exit code of the assignment:

  % x="$(true)"
  % echo $?
  0
  % x="$(false)"
  % echo $?
  1

So let's drop this change from the patch.

  reply	other threads:[~2023-03-27 10:11 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 [this message]
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
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

  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=CAPig+cRS5M65MskbWKBuqtzuGUMjibbBHpTBDxLYEJF33aJX4Q@mail.gmail.com \
    --to=sunshine@sunshineco.com \
    --cc=edwinfernando734@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=rybak.a.v@gmail.com \
    --cc=vdye@github.org \
    /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).