From: Eric Sunshine <sunshine@sunshineco.com>
To: "Torsten Bögershausen" <tboegi@web.de>
Cc: Mike Hommey <mh@glandium.org>,
git@vger.kernel.org, Joshua Jensen <jjensen@workspacewhiz.com>,
Jonathan Nieder <jrnieder@gmail.com>,
Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH] fast-import: add options to enable/disable case folding
Date: Fri, 17 Apr 2015 15:57:05 -0400 [thread overview]
Message-ID: <20150417195705.GA36902@flurp.local> (raw)
In-Reply-To: <55313B4B.3030106@web.de>
On Fri, Apr 17, 2015 at 06:56:43PM +0200, Torsten Bögershausen wrote:
> On 04/17/2015 01:52 PM, Mike Hommey wrote:
> > +test_expect_success 'V: default case folding with ignorecase=true' '
> > + git config core.ignorecase true &&
> > + git fast-import <input &&
> > + git ls-tree refs/heads/V >actual &&
> > + git update-ref -d refs/heads/V &&
> > + cat >expected <<\EOF &&
> > +100644 blob 78981922613b2afb6025042ff6bd878ac1994e85 a
> > +EOF
> > + test_cmp expected actual'
> > +
> > +test_expect_success 'V: default case folding with ignorecase=false' '
> > + git config core.ignorecase false &&
> > + git fast-import <input &&
> > + git ls-tree refs/heads/V >actual &&
> > + git update-ref -d refs/heads/V &&
> > + cat >expected <<\EOF &&
> > +100644 blob 78981922613b2afb6025042ff6bd878ac1994e85 A
> > +EOF
> > + test_cmp expected actual'
> > +
> > +test_expect_success 'V: forced case folding with ignorecase=true' '
> > + git config core.ignorecase true &&
> > + git fast-import --fold-case <input &&
> > + git ls-tree refs/heads/V >actual &&
> > + git update-ref -d refs/heads/V &&
> > + cat >expected <<\EOF &&
> > +100644 blob 78981922613b2afb6025042ff6bd878ac1994e85 a
> > +EOF
> > + test_cmp expected actual'
>
> If you want to make it shorter (and try to avoid repetition):
> The forced true cases could be collected in a loop.
> (and the same for forced=false)
I was also going to suggest squashing the repetition. Here's what I
had in mind:
--- >8 ---
test_foldcase() {
ignore=$1 &&
case "$2" in
true) fold=--fold-case folded=true ;;
false) fold=--no-fold-case folded=false ;;
*) fold= folded=$ignore ;;
esac &&
case $folded in true) folded=a ;; false) folded=A ;; esac &&
test_expect_success "V: case folding: ignorecase=$ignore${fold:+ $fold}" "
git -c core.ignorecase=$ignore fast-import $fold <input &&
git ls-tree refs/heads/V >actual &&
git update-ref -d refs/heads/V &&
cat >expect <<-EOF &&
100644 blob 78981922613b2afb6025042ff6bd878ac1994e85 $folded
EOF
test_cmp expect actual
"
}
for o in '' true false
do
for c in true false
do
test_foldcase $c "$o"
done
done
--- >8 ---
which outputs:
--- >8 ---
ok 176 - V: case folding: ignorecase=true
ok 177 - V: case folding: ignorecase=false
ok 178 - V: case folding: ignorecase=true --fold-case
ok 179 - V: case folding: ignorecase=false --fold-case
ok 180 - V: case folding: ignorecase=true --no-fold-case
ok 181 - V: case folding: ignorecase=false --no-fold-case
--- >8 ---
prev parent reply other threads:[~2015-04-17 19:57 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-09 0:12 fast-import should not care about core.ignorecase Mike Hommey
2014-12-09 0:22 ` Mike Hommey
2014-12-09 1:07 ` Joshua Jensen
2014-12-09 1:31 ` Jonathan Nieder
2014-12-09 3:20 ` Joshua Jensen
2014-12-09 20:19 ` Junio C Hamano
2015-04-17 11:52 ` [PATCH] fast-import: add options to enable/disable case folding Mike Hommey
2015-04-17 16:56 ` Torsten Bögershausen
2015-04-17 18:44 ` Junio C Hamano
2015-04-18 7:36 ` Mike Hommey
2015-04-24 9:42 ` Luke Diamand
2015-04-17 19:57 ` Eric Sunshine [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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150417195705.GA36902@flurp.local \
--to=sunshine@sunshineco.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=jjensen@workspacewhiz.com \
--cc=jrnieder@gmail.com \
--cc=mh@glandium.org \
--cc=tboegi@web.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.
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 NNTP newsgroup(s).