From: Taylor Blau <firstname.lastname@example.org> To: Jeff King <email@example.com> Cc: Taylor Blau <firstname.lastname@example.org>, Eric Sunshine <email@example.com>, Git List <firstname.lastname@example.org>, Derrick Stolee <email@example.com> Subject: Re: [PATCH 2/3] t4216: fix broken '&&'-chain Date: Tue, 30 Jun 2020 15:12:31 -0400 [thread overview] Message-ID: <20200630191231.GA30767@syl.lan> (raw) In-Reply-To: <20200630190325.GB1888406@coredump.intra.peff.net> On Tue, Jun 30, 2020 at 03:03:25PM -0400, Jeff King wrote: > On Tue, Jun 30, 2020 at 02:39:28PM -0400, Taylor Blau wrote: > > > > > 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. > > > > Fair enough. For what it's worth, this explanation *does* make sense if > > you 'set -e' beforehand, which I am accustomed to (and had incorrectly > > assumed that tests in 't' also have 'set -e', when they do not). > > If we _really_ want to nitpick, it probably wouldn't terminate under > "set -e" because the call to "setup" is itself part of an &&-chain, > which suppresses "-e" handling (which is one of the many confusing "set > -e" behaviors that led us to avoid it in the first place). I learned something new about 'set -e'! I don't mind nitpicking at all, it's useful information to know... > But definitely your revised commit message below is more accurate. > > However... > > > --- >8 --- > > > > Subject: [PATCH] t4216: fix broken '&&'-chain > > > > The 'rm' added in a759bfa9ee (t4216: add end to end tests for git log > > with Bloom filters, 2020-04-06) should be placed within the function's > > '&&'-chain. > > > > The file being removed may not exist (for eg., in the case of '--run', > > in which case it may not be generated beforehand by a skipped test), and > > so add '-f' to account for the file's optional existence. > > Is the &&-chain really broken, or is the first command simply not part > of that chain? Perhaps a question for philosophers, but the more applied > question here is: what are we improving, and why? > > The original code handled the fact that the file might not exist by not > including its exit code in the &&-chain which leads to the function's > return value. Your new code does so by putting it in the &&-chain but > asking "rm" to ignore errors. Is one better than the other? > > I think so, but my argument would be more along the lines of: > > - without "-f", "rm" will complain about a missing file, which is > distracting noise in the test log > > - once "-f" is added in to suppress that, we might as well add the > command to the &&-chain. That's our normal style, so readers don't > have to wonder if it's important or not. Plus it would help avoid a > broken chain if more commands are added at the beginning of the > function. I made the change for basically these reasons, but mostly to bring this function into good style as with the rest of our test suite (there are a handful of other minor nits that we could look at, such as some odd spacing, etc.). Whether or not all of this needs to go into the commit message... I don't know. On the one hand, I think that your explanation here is clearer than what I wrote in the commit message, but on the other hand, I think that amending it again may be belaboring an otherwise simple change. If you feel strongly, though, I'm happy to send a revised patch. > -Peff Thanks, Taylor
next prev parent reply other threads:[~2020-06-30 19:12 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 2020-06-30 18:39 ` Taylor Blau 2020-06-30 19:03 ` Jeff King 2020-06-30 19:12 ` Taylor Blau [this message] 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=20200630191231.GA30767@syl.lan \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --subject='Re: [PATCH 2/3] t4216: fix broken '\''&&'\''-chain' \ /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
Code repositories for project(s) associated with this 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).