path: root/t/
diff options
authorJeff King <>2018-08-23 00:49:56 (GMT)
committerJunio C Hamano <>2018-08-23 17:08:51 (GMT)
commit1688c9a4894df517241026c7a3848bdc84607986 (patch)
treecaef7f87bffe250f260ec28a34bc7db0da87e078 /t/
parentc188668e387509565237a865a1c63e890f6bbcd7 (diff)
interpret-trailers: allow suppressing "---" divider
Even with the newly-tightened "---" parser, it's still possible for a commit message to trigger a false positive if it contains something like "--- foo". If the caller knows that it has only a single commit message, it can now tell us with the "--no-divider" option, eliminating any false positives. If we were designing this from scratch, I'd probably make this the default. But we've advertised the "---" behavior in the documentation since interpret-trailers has existed. Since it's meant to be scripted, breaking that would be a bad idea. Note that the logic is in the underlying trailer.c code, which is used elsewhere. The default there will keep the current behavior, but many callers will benefit from setting this new option. That's left for future patches. Signed-off-by: Jeff King <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 't/')
1 files changed, 20 insertions, 0 deletions
diff --git a/t/ b/t/
index e13b40b..c441861 100755
--- a/t/
+++ b/t/
@@ -1439,4 +1439,24 @@ test_expect_success 'handling of --- lines in input' '
test_cmp expected actual
+test_expect_success 'suppress --- handling' '
+ echo "real-trailer: just right" >expected &&
+ git interpret-trailers --parse --no-divider >actual <<-\EOF &&
+ subject
+ This commit message has a "---" in it, but because we tell
+ interpret-trailers not to respect that, it has no effect.
+ not-a-trailer: too soon
+ ---
+ This is still the commit message body.
+ real-trailer: just right
+ test_cmp expected actual