On 27.10.21 22:30, Junio C Hamano wrote:
Fabian Stelzer [off-list ref] writes:
quoted
+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.
Thanks, will fix.
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.
Not really. I will add a BUG() to the default case and only ignore the
known cases that we don't want to handle.
Thanks