git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Eric Sunshine <sunshine@sunshineco.com>
To: Taylor Blau <me@ttaylorr.com>
Cc: Git List <git@vger.kernel.org>, Jeff King <peff@peff.net>,
	Derrick Stolee <dstolee@microsoft.com>
Subject: Re: [PATCH 2/3] t4216: fix broken '&&'-chain
Date: Tue, 30 Jun 2020 13:50:22 -0400	[thread overview]
Message-ID: <CAPig+cQv3cHe5ci3mDvNKYXbVQt6Rp5icG-woaDCqfAtzZ6SZw@mail.gmail.com> (raw)
In-Reply-To: <5a20a97658fa8e6c874c9c9cafb2cf49e39f94d6.1593536481.git.me@ttaylorr.com>

On Tue, Jun 30, 2020 at 1:17 PM Taylor Blau <me@ttaylorr.com> wrote:
> In a759bfa9ee (t4216: add end to end tests for git log with Bloom
> filters, 2020-04-06), a 'rm' invocation was added without a
> corresponding '&&' chain.
>
> This ends up working fine when the file already exists, in which case
> 'rm' exits cleanly and the rest of the function executes normally. When
> the file does _not_ exist, however, 'rm' returns an unclean exit code,
> causing the function to terminate.

This explanation makes no sense. Since this command was not part of
the &&-chain, its failure would not cause the function to terminate
prematurely nor would it affect the return value of the function. This
explanation would make sense, however, if you're talking about the
behavior _after_ fixing the broken &&-chain.

> Fix this by making the test use an '&&'-chain, and passing '-f' to
> ignore missing files (as can be the case when specifying which tests are
> '--run').

The entire commit message is talking about implementation details and
merely repeats what the subject and patch itself already say quite
clearly; anyone familiar with 'rm' understands implicitly that '-f'
must be added to incorporate it into the &&-chain if the file's
presence is not guaranteed. Thus, you could drop the entire body of
the commit message without losing clarity...

With one minor exception: What is much more interesting for the reader
to know is whether the file being removed is guaranteed to exist (in
which case '-f' is unnecessary) or may be missing (requiring '-f'),
and under what conditions it might be missing. The very last part of
the last sentence of the current commit message gives a good hint
about the latter, thus would be a good bit to retain.

> diff --git a/t/t4216-log-bloom.sh b/t/t4216-log-bloom.sh
> @@ -53,7 +53,7 @@ sane_unset GIT_TRACE2_PERF_BRIEF
>  sane_unset GIT_TRACE2_CONFIG_PARAMS

Not related to this patch, but 'sane_unset' is pointless outside of a
test since there is no &&-chain to maintain. Plain 'unset' would work
just as well and be less misleading.

>  setup () {
> -       rm "$TRASH_DIRECTORY/trace.perf"
> +       rm -f "$TRASH_DIRECTORY/trace.perf" &&

  reply	other threads:[~2020-06-30 17:50 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-30 17:17 [PATCH 0/3] commit-graph: introduce 'core.useBloomFilters' Taylor Blau
2020-06-30 17:17 ` [PATCH 1/3] commit-graph: pass a 'struct repository *' in more places Taylor Blau
2020-06-30 20:52   ` Derrick Stolee
2020-06-30 17:17 ` [PATCH 2/3] t4216: fix broken '&&'-chain Taylor Blau
2020-06-30 17:50   ` Eric Sunshine [this message]
2020-06-30 18:39     ` Taylor Blau
2020-06-30 19:03       ` Jeff King
2020-06-30 19:12         ` Taylor Blau
2020-06-30 19:19           ` Jeff King
2020-06-30 19:48         ` Eric Sunshine
2020-06-30 18:55     ` Jeff King
2020-06-30 17:17 ` [PATCH 3/3] commit-graph: respect 'core.useBloomFilters' Taylor Blau
2020-06-30 19:18   ` Jeff King
2020-06-30 19:27     ` Taylor Blau
2020-06-30 19:33       ` Jeff King
2020-08-03 19:02 ` [PATCH 0/3] commit-graph: introduce 'core.useBloomFilters' Taylor Blau

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+cQv3cHe5ci3mDvNKYXbVQt6Rp5icG-woaDCqfAtzZ6SZw@mail.gmail.com \
    --to=sunshine@sunshineco.com \
    --cc=dstolee@microsoft.com \
    --cc=git@vger.kernel.org \
    --cc=me@ttaylorr.com \
    --cc=peff@peff.net \
    /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).