diff --git a/pretty.c b/pretty.c index 3c43db558ae..fe249f8820f 100644 --- a/pretty.c +++ b/pretty.c @@ -1267,6 +1267,8 @@ static size_t format_commit_one(struct strbuf *sb, /* in UTF-8 */ if (c->signature_check.key) strbuf_addstr(sb, c->signature_check.key); break; + default: + return 0; } return 2; } diff --git a/t/t7510-signed-commit.sh b/t/t7510-signed-commit.sh index e97477a3b98..9810242435b 100755 --- a/t/t7510-signed-commit.sh +++ b/t/t7510-signed-commit.sh @@ -147,4 +147,10 @@ test_expect_success GPG 'show lack of signature with custom format' ' test_cmp expect actual ' +test_expect_success 'unused %G placeholders are passed through' ' + echo "%GX %G" >expect && + git log -1 --format="%GX %G" >actual && + test_cmp expect actual +' + test_done