trailer: forbid leading whitespace in trailers

Currently, interpret-trailers allows leading whitespace in trailer
lines. This leads to false positives, especially for quoted lines or
bullet lists.

Forbid leading whitespace in trailers.

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Jonathan Tan
2016-10-21 10:55:02 -07:00
committed by Junio C Hamano
parent 146245063e
commit c463a6b280
3 changed files with 17 additions and 2 deletions

View File

@ -241,6 +241,21 @@ test_expect_success 'with non-trailer lines only' '
test_cmp expected actual
'
test_expect_success 'line with leading whitespace is not trailer' '
q_to_tab >patch <<-\EOF &&
Qtoken: value
EOF
q_to_tab >expected <<-\EOF &&
Qtoken: value
token: value
EOF
git interpret-trailers --trailer "token: value" patch >actual &&
test_cmp expected actual
'
test_expect_success 'with config setup' '
git config trailer.ack.key "Acked-by: " &&
cat >expected <<-\EOF &&