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

Re: [PATCH 2/6] t5334: document that git push --signed=1 does not work

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 7, 2017, 20:25 UTC
Message-ID
<xmqqd187p1lm.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<4ac17762106cde543c4c60968946b68263830d61.1502128418.git.martin.agren@gmail.com>
Martin Ågren <martin.agren@gmail.com> writes:
Show 10 quoted lines
> When accepting booleans as command-line or config options throughout
> Git, there are several documented synonyms for true and false.
> However, one particular user is slightly broken: `git push --signed=..`
> does not understand the integer synonyms for true and false.
>
> This is hardly wanted. The --signed option has a different notion of
> boolean than all other arguments and config options, including the
> config option corresponding to it, push.gpgSign.
>
> Add a test documenting the failure to handle --signed=1.

My knee-jerk reaction is that parse_maybe_bool() is broken in that it should do everything that config_maybe_bool() does. I wonder why we do not call git_parse_int() like git_config_maybe_bool() does?

... Ahh, that is because bool_or_int() wants to know that "1" is an int and not a bool, and parse_maybe_bool() is designed to cater to the need of that thing, in addition to config_maybe_bool(). And the "--signed=" thing wants parse_bool_or_string(), not bool_or_int(), so we should treat "1" as true and "0" as false. There is no way to do so in the current code and that is why you have the new _text() thing in patches 3-4/6.

Makes sense.
Show 10 quoted lines
> diff --git a/t/t5534-push-signed.sh b/t/t5534-push-signed.sh
> index 464ffdd14..5dce55e1d 100755
> --- a/t/t5534-push-signed.sh
> +++ b/t/t5534-push-signed.sh
> @@ -71,6 +71,13 @@ test_expect_success 'push --signed fails with a receiver without push certificat
>  	test_i18ngrep "the receiving end does not support" err
>  '
>  
> +test_expect_failure 'push --signed=1 is accepted' '
> +	prepare_dst &&
n> +	mkdir -p dst/.git/hooks &&
Show 7 quoted lines
> +	test_must_fail git push --signed=1 dst noop ff +noff 2>err &&
> +	test_i18ngrep "the receiving end does not support" err
> +'
> +
>  test_expect_success GPG 'no certificate for a signed push with no update' '
>  	prepare_dst &&
>  	mkdir -p dst/.git/hooks &&
Previous: Martin ÅgrenNext: Martin Ågren
Message 4 of 13 in “clean up parsing of maybe_bool”
  1. 0/6 clean up parsing of maybe_boolMartin Ågren, Aug 7, 2017
  2. 1/6 Doc/git-{push,send-pack}: correct --sign= to --signed=Martin Ågren, Aug 7, 2017
  3. 2/6 t5334: document that git push --signed=1 does not workMartin Ågren, Aug 7, 2017
  4. Junio C HamanoAug 7, 2017
  5. 3/6 config: introduce git_parse_maybe_bool_textMartin Ågren, Aug 7, 2017
  6. 4/6 config: make git_{config,parse}_maybe_bool equivalentMartin Ågren, Aug 7, 2017
  7. 5/6 treewide: deprecate git_config_maybe_bool, use git_parse_maybe_boolMartin Ågren, Aug 7, 2017
  8. 6/6 parse_decoration_style: drop unused argument `var`Martin Ågren, Aug 7, 2017
  9. Stefan BellerAug 7, 2017
  10. Junio C HamanoAug 7, 2017
  11. Martin ÅgrenAug 8, 2017
  12. Junio C HamanoAug 8, 2017
  13. Martin ÅgrenAug 8, 2017

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.