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

Re: [PATCH v2 1/2] sequencer: fix gpg option passed to merge subcommand

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 13, 2020, 22:06 UTC
Message-ID
<xmqqy2k9ixvz.fsf@gitster.c.googlers.com>
In-Reply-To
<d2491759-e761-647b-7e76-3515b8eeaf3f@gmail.com>
Phillip Wood <phillip.wood123@gmail.com> writes:
Show 16 quoted lines
>>   +test_expect_success 'rebase -r, GPG and merge strategies' '
>> +	git reset --hard merged &&
>> +	git rebase -fr --gpg-sign -s resolve --root &&
>> +	git verify-commit HEAD
>> +'
>
> Unfortunately I've just noticed that the test above runs
>
> 	git config commit.gpgsign true
>
> So this test would pass anyway if merge picks up that config
> setting. The previous test needs to be changed to
>
> 	test_config commit.gpgsign true
>
> so that the config setting is cleared when that test finishes.
Thanks for a review, but I do not think that is a right way to go.

test_config has an inherent assumption that not having the config at all is somehow the "natural" state, and if that holds true, that would be OK. But what is "natural" is subjective X-<.

The way each test is run by calling test_rebase_gpg_sign repeatedly uses a different and more robust approach to ensure that previous test does not affect the current one. Each invocation of test explicitly sets the configuration to the state the test wants to, cancelling what the previous test did.

To blend in better with existing tests and match their robustness expectations, the right fix is for this new test to explicitly use "git config --set" or "git config --unset" to make the variable into the desired state, regardless of what the previous tests did.

If the test quoted at the beginning of this message wants to make sure that --gpg-sign from the command line takes effect without commit.gpgsign set, it should unset the variable explicitly. Another combination worth testing is to ensure that --gpg-sign takes effect when commit.gpgsign is explicitly set to false (not "left unset").

Thanks.
Previous: Phillip WoodNext: Samuel Čavoj
Message 12 of 18 in “sequencer: fix gpg option passed to merge subcommand”
  1. 1/2 sequencer: fix gpg option passed to merge subcommandSamuel Čavoj, Oct 12, 2020
  2. 2/2 sequencer: pass explicit --no-gpg-sign to mergeSamuel Čavoj, Oct 12, 2020
  3. Junio C HamanoOct 13, 2020
  4. Phillip WoodOct 13, 2020
  5. Samuel ČavojOct 12, 2020
  6. Phillip WoodOct 13, 2020
  7. Samuel ČavojOct 13, 2020
  8. Phillip WoodOct 13, 2020
  9. Phillip WoodOct 13, 2020
  10. Samuel ČavojOct 13, 2020
  11. Phillip WoodOct 13, 2020
  12. Junio C HamanoOct 13, 2020
  13. Samuel ČavojOct 13, 2020
  14. Junio C HamanoOct 14, 2020
  15. Phillip WoodOct 16, 2020
  16. Junio C HamanoOct 16, 2020
  17. Phillip WoodOct 16, 2020
  18. Junio C HamanoOct 16, 2020

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.