git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Eric Sunshine <sunshine@sunshineco.com>
Date
Feb 5, 2016, 19:30 UTC
Message-ID
<CAPig+cRuRiL1_44tVFSP8k64aMhf6Tu0PeXfN8HUV7wX8=vLzA@mail.gmail.com>
In-Reply-To
<20160205191805.GA7245@sigill.intra.peff.net>
On Fri, Feb 5, 2016 at 2:18 PM, Jeff King <peff@peff.net> wrote:
Show 32 quoted lines
> 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.

Previous: Jeff KingNext: Junio C Hamano
Message 5 of 11 in “ident: add user.useConfigOnly boolean for when ident shouldn't be guessed”
  1. ident: add user.useConfigOnly boolean for when ident shouldn't be guessedDan Aloni, Feb 5, 2016
  2. 1/3 fmt_ident: refactor strictness checksDan Aloni, Feb 5, 2016
  3. 2/3 ident: add user.useConfigOnly boolean for when ident shouldn't be guessedDan Aloni, Feb 5, 2016
  4. Jeff KingFeb 5, 2016
  5. Eric SunshineFeb 5, 2016
  6. Junio C HamanoFeb 5, 2016
  7. Dan AloniFeb 5, 2016
  8. 3/3 ident: cleanup wrt ident's sourceDan Aloni, Feb 5, 2016
  9. Junio C HamanoFeb 5, 2016
  10. Jeff KingFeb 5, 2016
  11. Dan AloniFeb 5, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.