Re: [PATCH v6 2/3] ident: add user.useConfigOnly boolean for when ident shouldn't be guessed

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Feb 5, 2016 at 2:18 PM, Jeff King <peff@xxxxxxxx> 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.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]