From: Jeff King <peff@peff.net>
To: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Cc: Git Mailing List <git@vger.kernel.org>,
Junio C Hamano <gitster@pobox.com>,
Conrad Irwin <conrad.irwin@gmail.com>,
Sitaram Chamarty <sitaramc@gmail.com>,
Michael J Gruber <git@drmicha.warpmail.net>,
Nguyen Thai Ngoc Duy <pclouds@gmail.com>,
"Brian M . Carlson" <sandals@crustytoothpaste.net>
Subject: Re: [PATCH] rev-parse: match @{u}, @{push} and ^{<type>} case-insensitively
Date: Tue, 21 Mar 2017 15:43:31 -0400 [thread overview]
Message-ID: <20170321194330.5nghzisbud5yy6wq@sigill.intra.peff.net> (raw)
In-Reply-To: <CACBZZX6g694p9WkiK75+HJCLUPwjpdQhjBrAU713KahAKm53hA@mail.gmail.com>
On Tue, Mar 21, 2017 at 08:19:34PM +0100, Ævar Arnfjörð Bjarmason wrote:
> On Sat, Mar 18, 2017 at 11:34 PM, Ævar Arnfjörð Bjarmason
> <avarab@gmail.com> wrote:
>
> > The new starts_with_case() function is a copy of the existing adjacent
> > starts_with(), just with a tolower() in the "else if".
> > [...]
> > +int starts_with_case(const char *str, const char *prefix)
> > +{
> > + for (; ; str++, prefix++)
> > + if (!*prefix)
> > + return 1;
> > + else if (tolower(*str) != tolower(*prefix))
> > + return 0;
> > +}
> > +
> > /*
>
> One thing I'd like feedback on is whether I should be adding this to
> strbuf.c. There are >300 uses of starts_with(), but sha1_name.c will
> be the only one using this modified starts_with_case() function.
> Wouldn't it be better to just add it to sha1_name.c rather than
> expanding the strbuf API with something that'll likely be used by
> nothing else for a while?
I was thinking that I had written this same function before (in a patch
that didn't end up merged), but it was actually the related
skip_prefix_icase(). I'm fine with it either next to starts_with() or as
a static next to its callers.
-Peff
prev parent reply other threads:[~2017-03-21 19:44 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-18 22:34 [PATCH] rev-parse: match @{u}, @{push} and ^{<type>} case-insensitively Ævar Arnfjörð Bjarmason
2017-03-19 9:19 ` Duy Nguyen
2017-03-19 10:04 ` Ævar Arnfjörð Bjarmason
2017-03-19 12:55 ` Junio C Hamano
2017-03-19 14:26 ` Ævar Arnfjörð Bjarmason
2017-03-19 22:53 ` Junio C Hamano
2017-03-26 12:16 ` [PATCH v2 0/3] rev-parse case insensitivity & @{p} synonym Ævar Arnfjörð Bjarmason
2017-03-26 12:16 ` [PATCH v2 1/3] rev-parse: match @{upstream}, @{u} and @{push} case-insensitively Ævar Arnfjörð Bjarmason
2017-03-27 0:27 ` Junio C Hamano
2017-03-27 11:16 ` [PATCH v3] " Ævar Arnfjörð Bjarmason
2017-03-27 17:45 ` Junio C Hamano
2017-03-27 18:05 ` Ævar Arnfjörð Bjarmason
2017-03-26 12:16 ` [PATCH v2 2/3] rev-parse: add @{p} as a synonym for @{push} Ævar Arnfjörð Bjarmason
2017-03-27 2:53 ` Jeff King
2017-03-27 7:52 ` Ævar Arnfjörð Bjarmason
2017-03-26 12:16 ` [PATCH v2 3/3] rev-parse: match ^{<type>} case-insensitively Ævar Arnfjörð Bjarmason
2017-03-27 0:36 ` Junio C Hamano
2017-03-27 2:58 ` Jeff King
2017-03-27 5:39 ` Junio C Hamano
2017-03-27 7:11 ` Jeff King
2017-03-27 7:33 ` Ævar Arnfjörð Bjarmason
2017-03-21 19:19 ` [PATCH] rev-parse: match @{u}, @{push} and " Ævar Arnfjörð Bjarmason
2017-03-21 19:26 ` Junio C Hamano
2017-03-21 19:43 ` Jeff King [this message]
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=20170321194330.5nghzisbud5yy6wq@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=avarab@gmail.com \
--cc=conrad.irwin@gmail.com \
--cc=git@drmicha.warpmail.net \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=pclouds@gmail.com \
--cc=sandals@crustytoothpaste.net \
--cc=sitaramc@gmail.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.
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).