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

Re: [PATCH v3] Add the tag.gpgsign option to sign annotated tags

From
Jeff King <peff@peff.net>
Date
Mar 21, 2016, 19:42 UTC
Message-ID
<20160321194237.GA28301@sigill.intra.peff.net>
In-Reply-To
<20160321193207.GD20083@spk-laptop>
On Mon, Mar 21, 2016 at 08:32:07PM +0100, Laurent Arnoud wrote:
Show 7 quoted lines
> The `tag.gpgsign` config option allows to sign all
> annotated tags automatically.
> 
> Support `--no-sign` option to countermand configuration `tag.gpgsign`.
> 
> Signed-off-by: Laurent Arnoud <laurent@spkdev.net>
> Reviewed-by: Jeff King <peff@peff.net>

The meaning of "Reviewed-by" in this project is generally that the mentioned person has read and approved of the change. But in this case, I have not seen v3 at all yet, and I am also not sure that the ones I _did_ review are ready for merging.

So you should probably drop that.
> +tag.gpgSign::
> +	A boolean to specify whether annotated tags created should be GPG signed.
> +	If `--no-sign` is specified on the command line, it takes
> +	precedence over this option.

I take this to mean that we _only_ kick in signing if the created tag would otherwise be annotated (and I thought that's what you meant in your other mail, too). But that's not what happens with this patch, and your tests check for the opposite:

Show 11 quoted lines
> +get_tag_header config-implied-annotate $commit commit $time >expect
> +./fakeeditor >>expect
> +echo '-----BEGIN PGP SIGNATURE-----' >>expect
> +git config tag.gpgsign true
> +test_expect_success GPG \
> +	'git tag -s implied if configured with tag.gpgsign' \
> +	'GIT_EDITOR=./fakeeditor git tag config-implied-annotate &&
> +	get_tag_msg config-implied-annotate >actual &&
> +	test_cmp expect actual
> +'
> +git config --unset tag.gpgsign

That's a lightweight tag that becomes an annotated one due to the config variable.

So I think there may be some design-level issues to work out here, but I'll comment on a few more code-specific things, in case that code does get carried through:

> +	if (!strcmp(var, "tag.gpgsign")) {
> +		sign_tag_config = git_config_bool(var, value) ? 1 : 0;
> +		return 0;
> +	}
git_config_bool() already converts to 0/1, you can just say:
  sign_tag_config = git_config_bool(var, value);
Show 11 quoted lines
> +get_tag_header config-implied-annotate-disabled $commit commit $time >expect
> +echo "A message" >>expect
> +git config tag.gpgsign true
> +test_expect_success GPG \
> +	'git tag --no-sign disable configured tag.gpgsign' \
> +	'git tag --no-sign -m "A message" config-implied-annotate-disabled &&
> +	get_tag_msg config-implied-annotate-disabled >actual &&
> +	test_cmp expect actual &&
> +	test_must_fail git tag -v config-implied-annotate-disabled
> +'
> +git config --unset tag.gpgsign
Here (and in the other tests), you can use:
  test_config tag.gpgsign true &&
  ...
inside the test_expect_success block. That has two advantages:
  1. If setting the config fails for some reason, we'll notice and the
     test will fail.
  2. At the end of the test block, it will automatically clean up the
     variable for us.
-Peff
Previous: Laurent ArnoudNext: Jeff King
Message 21 of 22 in “Add the tag.gpgsign option to sign all created tags”
  1. Add the tag.gpgsign option to sign all created tagsLaurent Arnoud, Mar 19, 2016
  2. Jeff KingMar 20, 2016
  3. Laurent ArnoudMar 20, 2016
  4. Jeff KingMar 20, 2016
  5. Laurent ArnoudMar 20, 2016
  6. Add the tag.gpgsign option to sign all created tagsLaurent Arnoud, Mar 20, 2016
  7. Ramsay JonesMar 20, 2016
  8. Junio C HamanoMar 21, 2016
  9. Laurent ArnoudMar 21, 2016
  10. Junio C HamanoMar 21, 2016
  11. Laurent ArnoudMar 21, 2016
  12. Jeff KingMar 21, 2016
  13. Add the tag.gpgsign option to sign annotated tagsLaurent Arnoud, Mar 21, 2016
  14. Junio C HamanoMar 21, 2016
  15. Add the option to force sign annotated tagsLaurent Arnoud, Mar 22, 2016
  16. Junio C HamanoMar 22, 2016
  17. Laurent ArnoudMar 22, 2016
  18. Add the option to force sign annotated tagsLaurent Arnoud, Mar 22, 2016
  19. Junio C HamanoMar 21, 2016
  20. Add the tag.gpgsign option to sign annotated tagsLaurent Arnoud, Mar 21, 2016
  21. Jeff KingMar 21, 2016
  22. Jeff KingMar 21, 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.