From: Jeff King <peff@peff.net>
To: Erin Dahlgren <eedahlgren@gmail.com>
Cc: Junio C Hamano <gitster@pobox.com>,
git@vger.kernel.org,
Johannes Schindelin <johannes.schindelin@gmx.de>
Subject: Re: [PATCH v2] Simplify handling of setup_git_directory_gently() failure cases.
Date: Wed, 2 Jan 2019 23:54:57 -0500 [thread overview]
Message-ID: <20190103045456.GD20047@sigill.intra.peff.net> (raw)
In-Reply-To: <CAP_Smy0tMe=mq2u6OFBfYzutHvoLETOyRtFEzLVViupjMLVLrA@mail.gmail.com>
On Thu, Dec 27, 2018 at 03:46:10PM -0800, Erin Dahlgren wrote:
> > Heh, I should learn to cut and paste better. This should be:
> >
> > if (!nongit_ok || !*nongit_ok)
> >
> > (which comes from the current code).
>
> Yep, but I think we can benefit from De Morgan's law here, where:
>
> (!nongit_ok || !*nongit_ok) == (!(nongit_ok && *nongit_ok))
>
> PATCH v3 (just sent) uses that transformation like this:
>
> if (nongit_ok && *nongit_ok) {
> ... startup_info->has_repository = 0;
> } else {
> // !nongit_ok || !*nongit_ok
> .. startup_info->has_repository = 1;
> }
>
> Because IMHO (nongit_ok && *nongit_ok) is easier to read and reason
> about. Added brief comments as well.
Ah yes, that's much better.
-Peff
next prev parent reply other threads:[~2019-01-03 4:55 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-13 17:30 [PATCH] Simplify handling of setup_git_directory_gently() failure cases Erin Dahlgren
2018-12-14 10:32 ` Johannes Schindelin
2018-12-16 1:05 ` Erin Dahlgren
2018-12-16 1:05 ` [PATCH v2] " Erin Dahlgren
2018-12-18 12:35 ` Johannes Schindelin
2018-12-18 19:50 ` Erin Dahlgren
2018-12-18 17:54 ` Jeff King
2018-12-18 20:54 ` Erin Dahlgren
2018-12-19 15:59 ` Jeff King
2018-12-26 22:22 ` Junio C Hamano
2018-12-27 16:24 ` Jeff King
2018-12-27 23:46 ` Erin Dahlgren
2019-01-03 4:54 ` Jeff King [this message]
2018-12-27 23:36 ` [PATCH v3] " Erin Dahlgren
2019-01-03 5:14 ` Jeff King
2019-01-03 18:09 ` Junio C Hamano
2019-01-04 8:25 ` Jeff King
2019-01-05 16:57 ` Erin Dahlgren
2019-01-06 6:22 ` Jeff King
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=20190103045456.GD20047@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=eedahlgren@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=johannes.schindelin@gmx.de \
/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).