git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "Martin Ågren" <martin.agren@gmail.com>
Cc: git@vger.kernel.org, Dave Borowitz <dborowitz@google.com>,
	Stefan Beller <sbeller@google.com>
Subject: Re: [PATCH 2/6] t5334: document that git push --signed=1 does not work
Date: Mon, 07 Aug 2017 13:25:09 -0700	[thread overview]
Message-ID: <xmqqd187p1lm.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: 4ac17762106cde543c4c60968946b68263830d61.1502128418.git.martin.agren@gmail.com

Martin Ågren <martin.agren@gmail.com> writes:

> 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.


> 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 &&
> +	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 &&

  reply	other threads:[~2017-08-07 20:25 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-07 18:20 [PATCH 0/6] clean up parsing of maybe_bool Martin Ågren
2017-08-07 18:20 ` [PATCH 1/6] Doc/git-{push,send-pack}: correct --sign= to --signed= Martin Ågren
2017-08-07 18:20 ` [PATCH 2/6] t5334: document that git push --signed=1 does not work Martin Ågren
2017-08-07 20:25   ` Junio C Hamano [this message]
2017-08-07 18:20 ` [PATCH 3/6] config: introduce git_parse_maybe_bool_text Martin Ågren
2017-08-07 18:20 ` [PATCH 4/6] config: make git_{config,parse}_maybe_bool equivalent Martin Ågren
2017-08-07 18:20 ` [PATCH 5/6] treewide: deprecate git_config_maybe_bool, use git_parse_maybe_bool Martin Ågren
2017-08-07 18:20 ` [PATCH 6/6] parse_decoration_style: drop unused argument `var` Martin Ågren
2017-08-07 18:44 ` [PATCH 0/6] clean up parsing of maybe_bool Stefan Beller
2017-08-07 21:12   ` Junio C Hamano
2017-08-08  4:02     ` Martin Ågren
2017-08-08 17:04       ` Junio C Hamano
2017-08-08 17:21         ` Martin Ågren

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqd187p1lm.fsf@gitster.mtv.corp.google.com \
    --to=gitster@pobox.com \
    --cc=dborowitz@google.com \
    --cc=git@vger.kernel.org \
    --cc=martin.agren@gmail.com \
    --cc=sbeller@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).