git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Sunshine <sunshine@sunshineco.com>
To: Jeff King <peff@peff.net>
Cc: Dan Aloni <alonid@gmail.com>, Git List <git@vger.kernel.org>,
	Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH v6 2/3] ident: add user.useConfigOnly boolean for when ident shouldn't be guessed
Date: Fri, 5 Feb 2016 14:30:46 -0500	[thread overview]
Message-ID: <CAPig+cRuRiL1_44tVFSP8k64aMhf6Tu0PeXfN8HUV7wX8=vLzA@mail.gmail.com> (raw)
In-Reply-To: <20160205191805.GA7245@sigill.intra.peff.net>

On Fri, Feb 5, 2016 at 2:18 PM, Jeff King <peff@peff.net> wrote:
> On Fri, Feb 05, 2016 at 09:42:27AM +0200, Dan Aloni wrote:
>> +prepare () {
>> +     # Have a non-empty repository
>> +     rm -fr .git
>> +     git init
>> +     echo "Initial" >foo &&
>> +     git add foo &&
>> +     git commit -m foo &&
>> +
>> +     # Setup a likely user.useConfigOnly use case
>> +     sane_unset GIT_AUTHOR_NAME &&
>> +     sane_unset GIT_AUTHOR_EMAIL &&
>> +     test_unconfig --global user.name &&
>> +     test_unconfig --global user.email &&
>> +     test_config user.name "test" &&
>> +     test_unconfig user.email &&
>> +     test_config_global user.useConfigOnly true
>> +}
>
> The flow of this test script is a bit different than what we usually
> write. Typically we have some early test_expect_success blocks do setup
> for the whole script, and then progress through a sequence (and we rely
> on the test harness to do things like "git init").
>
> IOW, most of your "prepare" would go in the first block, and then the
> rest of the tests rely on it.
>
> The only thing I really see that needs to be repeated for each test is
> setting up the "about to commit" scenario. But you can simply use
> "commit --allow-empty" so that the tests work no matter what state the
> previous test left us in. We care about the ident, not what gets
> committed.

I was going to make all the same suggestions, so thanks. One thing to
add is that the &&-chain is broken in the prepare() function.

  reply	other threads:[~2016-02-05 19:30 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-05  7:42 [PATCH v6] ident: add user.useConfigOnly boolean for when ident shouldn't be guessed Dan Aloni
2016-02-05  7:42 ` [PATCH v6 1/3] fmt_ident: refactor strictness checks Dan Aloni
2016-02-05  7:42 ` [PATCH v6 2/3] ident: add user.useConfigOnly boolean for when ident shouldn't be guessed Dan Aloni
2016-02-05 19:18   ` Jeff King
2016-02-05 19:30     ` Eric Sunshine [this message]
2016-02-05 19:31   ` Junio C Hamano
2016-02-05 21:14     ` Dan Aloni
2016-02-05  7:42 ` [PATCH v6 3/3] ident: cleanup wrt ident's source Dan Aloni
2016-02-05 19:05   ` Junio C Hamano
2016-02-05 19:24     ` Jeff King
2016-02-05 21:03       ` Dan Aloni

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='CAPig+cRuRiL1_44tVFSP8k64aMhf6Tu0PeXfN8HUV7wX8=vLzA@mail.gmail.com' \
    --to=sunshine@sunshineco.com \
    --cc=alonid@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.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.
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).