Subject: Re: [PATCH v2 3/6] ssh signing: make verify-commit consider key lifetime

From: Junio C Hamano <[email-masked]>
Date: Wed, 27 Oct 2021 13:30:51 -0700

Fabian Stelzer <[email-masked]> writes:

> +static int parse_payload_metadata(struct signature_check *sigc)
> +{
> +	const char *ident_line = NULL;
> +	size_t ident_len;
> +	struct ident_split ident;
> +	const char *signer_header;
> +
> +	switch(sigc->payload_type) {
> +		case SIGNATURE_PAYLOAD_COMMIT:
> +			signer_header = "committer";
> +			break;
> +		case SIGNATURE_PAYLOAD_TAG:
> +			signer_header = "tagger";
> +			break;
> +		default:
> +			/* Ignore unknown payload types */
> +			return 0;
> +	}

The case arms should be indented to the same level as opening
switch().  Have SP between keyword "switch" and the expression
the statement switches on.

More importantly, can you explain why it is necessary to allow
callers to call this function with a random value in payload_type
and have it silently succeed?  Isn't it a programming error that
deserves a call to BUG("...")?

Thanks.