Skip to contentSkip to conversation

trailers: --only-trailers normalizes URLs to trailers

PATCH Superseded Kristoffer Haugsbakk 3 participants 18 messages Jun 4 – Aug 21 Documentation

lore
Share & tools
lore

Kristoffer Haugsbakk

author Reviewed-by Ilpo Järvinen Acked-by Darrick J. Wong Reviewed-by Jan Kara
#0 lore raw

The following is a bug that follows straightforwardly from the documented or discussed behavior. In that sense it is not a bug. But it is a bug in the sense that it makes things inconvenient and violates a design goal.

Quoted 4 lines

Thank you for filling out a Git bug report!
Please answer the following questions to help us understand your issue.

What did you do before the bug happened? (Steps to reproduce your issue)

Ran what is the equivalent of

    git interpret-trailers --only-trailers

With

    git log --format="%(trailers:only)"
Quoted 1 line

What did you expect to happen? (Expected behavior)

For URLs like https://www.digsm.xyz/ to be left intact.

(Well, did I expect that? It follows from the discussed behavior...)

Quoted 1 line

What happened instead? (Actual behavior)

URLs on a line by themselves in eligible trailer blocks get normalized/canonicalized to a “trailer” with key e.g. https:

    https: //www.digsm.xyz/
Quoted 1 line

What's different between what you expected and what actually happened?

In an ideal world to have some special-casing of URLs so that they are not detected as trailers. Does anyone realistically want trailers like this?:

    file: //...
    http: //...
    https: //...

Maybe a C-style comment?

https: // I changed my mind about providing a URL here.
This comment is a placeholder.
Comment: // But next up we have a URL
https: https://protocoltwiceover.net

And this is where my imagination ends.

Just special-casing https would go a long way.

Quoted 1 line

Anything else you want to add:

Yes, after this [System Info] part.

Quoted 2 lines

Please review the rest of the bug report below.
You can delete any lines you don't wish to share.

[System Info]
git version:
git version 2.54.0
cpu: x86_64
built from commit: 94f057755b7941b321fd11fec1b2e3ca5313a4e0
sizeof-long: 8
sizeof-size_t: 8
shell-path: /bin/sh
rust: disabled
gettext: enabled
libcurl: 7.81.0
OpenSSL: OpenSSL 3.0.2 15 Mar 2022
zlib: 1.2.11
SHA-1: SHA1_DC
SHA-256: SHA256_BLK
default-ref-format: files
default-hash: sha1
uname: Linux 6.8.0-117-generic #117~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu May 7 22:17:46 UTC x86_64 compiler info: gnuc: 11.4
libc info: glibc: 2.35
$SHELL (typically, interactive shell): /bin/bash

[Enabled Hooks]
commit-msg
post-applypatch
post-commit
sendemail-validate

***

That things like --format='%(trailers:only)' normalize trailers is known and has been discussed before.[1] There’s been discussion around the key capitalization and prefix normalization. But this is not about that. This is just about normalizing the separator part.

🔗 1: https://lore.kernel.org/git/[email protected]/

One design goal for trailers (either by implementers or reviewers or both) has been to avoid false positives.[2] That meant trying to avoid detecting trailers that were not intended. For example:

Everything was better in the past. Let me not even start on this
rant: it is not good for my blood pressure.

This will not be picked up as a trailer block unless rant is configured as a trailer key.

† 2: See e.g. Jonathan Tan’s series about among other things adding the

     25% rule

     https://lore.kernel.org/git/[email protected]/

But that’s pretty innocuous. Just a misplaced rant. The topic of this bug report is not a big deal either, but it is:

1. Structured data that gets mangled in this normalize mode
2. That can naturally go at the end of the message on its own line

And these two points are very relevant for people who never use trailers. Or, wait. I guess it isn’t if they don’t use trailers and thus will never normalize them. But it is relevant if they work on a project where someone else does that.

IN INTENDED TRAILER BLOCKS [3]

And then there are things that can go wrong if you intend to write trailer blocks:

1. “Non-trailer lines” that are URLs get normalized as trailers (NTL for short)
2. User error line wrapping turns one trailer into an empty trailer plus a https trailer (LW for short)
3. Normalizing trailers along the way (as in patches in flight or something) introduces this strange lossiness (NL for short)

I did (2) (LW for short) four years ago it seems:

    See:
    https://digsm.yxz/blog/important-context/?bigtechtracker=86b0c5a1e2b73b08fd54c727f4458649ed9fe3ad1b6e8ac9460c070113509a1e

† 3: Are all-caps titles good or bad? Let me know.

IN THE LINUX KERNEL

There are some hits for the http and https trailers when trailers are normalized. The baseline:

   $ git log --extended-regexp --grep='https?: //' --oneline | wc -l
   12

With normalization:

    $ git log --format='%(trailers:only)' |
          grep --extended-regexp '^https?: //' | wc -l
    245

Note that I have no idea how the Linux Kernel is run. But I don’t imagine that there are uses for https: //... trailers.

And trailer usage is complicated. There are for example on-purpose indented Link “trailers”, presumably for the purpose of *excluding* them as Link trailers. See:

    commit d80a9cb1a64ab9c817b6262c7e4e433b6a3581a0

    <body>

    [[email protected]: avoid bisection hazard]
      Link: https://lkml.kernel.org/r/[email protected]
    Link: https://lkml.kernel.org/r/c2be872d64ef9573b80727d9ab5446cf002f17b5.1774029655.git.ljs@kernel.org
    Signed-off-by: Lorenzo Stoakes (Oracle) <[email protected]>
    [MORE BELOW]

Is that indented link for that [] comment? I dunno.

But what’s the main topic here are intended non-trailer lines which are URLs that get treated as trailers (NTL). Like this invented example:

Reported-by: ...
https://digsm.xyz/?avastvirus=5891b5b522d5df086d0ff0b110fbd9d21bb4fc7163af34d08286a2e846f6be03
Signed-off-by: ...

Or this real example where the URLs are clearly part of a “comment” non-trailer run.

8236fc613d44e59f6736d6c3e9efffaf26ab7f00

[bhelgaas: squash fixes:
https://lore.kernel.org/r/[email protected]
https://lore.kernel.org/r/[email protected]]

(These are shown as they are written in the commit message. Normalizing the messages would create https trailers.)

Here are examples of line-wrapping mistake commits (LW) for Link, Closes, or Fixes (sometimes these point to bug URLs and not commits):

5bd97f5c5f241a5610c4412d1b93995a26241f81

Link:
https://lore.kernel.org/3cnmtqmakpbb2uwhenrj7kdqu3uefykiykjllgfbtpkiwhaa4s@sghkevv7jned [1]

and:

• 24abe1f238e7d7ac56be6374c52a3c13dab84f69
• 27e21516914dc130a79aa895a5a26e18f0213a5a
• be3536a4bdda53ff5a91b7e542b167d12bddb317

Finally there is this commit which has a trailer in the commit message itself with the key https (NL).

    commit 496c0c4c53bbe1bad97e82cd12103df61a6e459d
    ...
    ...

	net: wan: fsl_ucc_hdlc: free tx_skbuff in uhdlc_memclean

        <body>

	https: //sashiko.dev/#/patchset/20260429114208.941011-1-holger.brunck%40hitachienergy.com
	Fixes: c19b6d246a35 ("drivers/net: support hdlc function for QE-UCC")
	Signed-off-by: Holger Brunck <[email protected]>
	Link: https://patch.msgid.link/[email protected]
	Signed-off-by: Jakub Kicinski <[email protected]>

How could this have happened? Follow the patch-id link.

https://patch.msgid.link/[email protected]

https://sashiko.dev/#/patchset/20260429114208.941011-1-holger.brunck%40hitachienergy.com

Fixes c19b6d246a35 ("drivers/net: support hdlc function for QE-UCC")

So it was just a non-trailer URL line as this person submitted it. But presumably the person who applied it put the message through a round of normalization.

Cheers, good night

Signature · 1 line
Kristoffer
#1 lore raw
Quoted 3 lines · Kristoffer Haugsbakk

The following is a bug that follows straightforwardly from the documented or discussed behavior. In that sense it is not a bug. But it is a bug in the sense that it makes things inconvenient and violates a design goal.

Yeah, though if you'll allow me to nitpick your subject a moment: I don't think --only-trailers is really the culprit here. It demonstrates the problem because it normalizes the "trailer" it found. But the loose trailer matching is the more fundamental issue. For example:

git interpret-trailers --trailer=foo=bar <<\EOF
subject

body

http://example.com
EOF

will stick the new "foo: bar" trailer right up against the (now-broken) "http:" trailer. When it should come in its own stanza, which it would if you added a line "other" at the end, since that tells us that "http:" can't be a trailer.

Quoted 9 lines
Quoted 1 line

What's different between what you expected and what actually happened?

In an ideal world to have some special-casing of URLs so that they are not detected as trailers. Does anyone realistically want trailers like this?:

    file: //...
    http: //...
    https: //...

I could even see those as trailers, if somebody really wanted to allow arbitrary values that might just happen to start with "//". But without the whitespace after the colon, it is quite questionable.

Quoted 1 line

Just special-casing https would go a long way.

Agreed, though I think a rule like: ":// (with no whitespace)" is not a valid separator. Something like this:

trailer.c +5 -1
index 6d8ec7fa8d..342ed81c78 100644
@@ -635,8 +635,12 @@ static ssize_t find_separator(const char *line, const char *separators)
 	int whitespace_found = 0;
 	const char *c;
 	for (c = line; *c; c++) {
-		if (strchr(separators, *c))
+		if (strchr(separators, *c)) {
+			/* special case to avoid accidental URL matches */
+			if (*c == ':' && c[1] == '/' && c[2] == '/')
+				return -1;
 			return c - line;
+		}
 		if (!whitespace_found && (isalnum(*c) || *c == '-'))
 			continue;
 		if (c != line && (*c == ' ' || *c == '\t')) {

-Peff

#2 lore raw
Quoted 6 lines · Jeff King
Quoted 3 lines · Kristoffer Haugsbakk

The following is a bug that follows straightforwardly from the documented or discussed behavior. In that sense it is not a bug. But it is a bug in the sense that it makes things inconvenient and violates a design goal.

Quoted 6 lines

Yeah, though if you'll allow me to nitpick your subject a moment: I don't think --only-trailers is really the culprit here. It demonstrates the problem because it normalizes the "trailer" it found. But the loose trailer matching is the more fundamental issue. For example:

[snip]

Yeah, this is more precise. I focused a ton on the normalized output because that’s what makes it obvious. But the fundamental problem is interpreting URLs like trailers.

Quoted 11 lines
Quoted 10 lines
Quoted 2 lines

What's different between what you expected and what actually happened?

In an ideal world to have some special-casing of URLs so that they are not detected as trailers. Does anyone realistically want trailers like this?:

    file: //...
    http: //...
    https: //...
Quoted 8 lines

I could even see those as trailers, if somebody really wanted to allow arbitrary values that might just happen to start with "//". But without the whitespace after the colon, it is quite questionable.

Quoted 1 line

Just special-casing https would go a long way.

Agreed, though I think a rule like: ":// (with no whitespace)" is not a valid separator. Something like this:

Yes, matching on :// strictly is a better proposal. No need to care about http, https, file, etc. And both of these would *still* have to be true for this change to be a false negative w.r.t. the user’s intentions:

• They really input a trailer that looks like a URL, but it’s not meant to be a URL
• They really wanted the value to start with //

And again I don’t think that is likely to ever happen (with a knock on wood).

Thanks!

Quoted 20 lines
trailer.c +5 -1
index 6d8ec7fa8d..342ed81c78 100644
@@ -635,8 +635,12 @@ static ssize_t find_separator(const char *line,
 const char *separators)
 	int whitespace_found = 0;
 	const char *c;
 	for (c = line; *c; c++) {
-		if (strchr(separators, *c))
+		if (strchr(separators, *c)) {
+			/* special case to avoid accidental URL matches */
+			if (*c == ':' && c[1] == '/' && c[2] == '/')
+				return -1;
 			return c - line;
+		}
 		if (!whitespace_found && (isalnum(*c) || *c == '-'))
 			continue;

if (c != line && (*c == ' ' || *c == '\t')) {

#3 lore raw
Quoted 10 lines · Kristoffer Haugsbakk
Quoted 6 lines

Yeah, though if you'll allow me to nitpick your subject a moment: I don't think --only-trailers is really the culprit here. It demonstrates the problem because it normalizes the "trailer" it found. But the loose trailer matching is the more fundamental issue. For example:

[snip]

Yeah, this is more precise. I focused a ton on the normalized output because that’s what makes it obvious. But the fundamental problem is interpreting URLs like trailers.

That makes sense. As the author of --only-trailers I immediately wondered if I had introduced a bug in it, so I was partially motivated by exonerating myself. ;) I agree that using it is the simplest way to demonstrate the problem.

Quoted 8 lines
Quoted 2 lines

Agreed, though I think a rule like: ":// (with no whitespace)" is not a valid separator. Something like this:

Yes, matching on :// strictly is a better proposal. No need to care about http, https, file, etc. And both of these would *still* have to be true for this change to be a false negative w.r.t. the user’s intentions:

Quoted 6 lines

• They really input a trailer that looks like a URL, but it’s not meant to be a URL
• They really wanted the value to start with //

And again I don’t think that is likely to ever happen (with a knock on wood).

I didn't spend much effort on the patch I showed beyond running it once. It would probably need tests and a doc update. I wasn't planning to run with it, but if you feel like doing so, please feel free to use it as you like.

-Peff

#4 lore raw
Quoted 9 lines · Jeff King
Quoted 4 lines

[snip]

And again I don’t think that is likely to ever happen (with a knock on wood).

I didn't spend much effort on the patch I showed beyond running it once. It would probably need tests and a doc update. I wasn't planning to run with it, but if you feel like doing so, please feel free to use it as you like.

Yeah, I want to add some tests on top and make a sumbission (but sent a message to first confirm that you weren't cooking anything more ;) ). Thanks.

Signature · 1 line
Sent from mobile
#5 lore raw

PATCH 1/1 trailers: stop recognizing URLs as trailers

In reply to Jeff King

From: Kristoffer Haugsbakk <[email protected]>

An HTTPS URL starts with an alphanumeric scheme followed by a colon. That means that they will be recognized as trailers in a trailer block. That turns out to be a problem in practice. Let’s stop recognizing these as trailers by failing the trailer parsing when we:

1. find the separator;
2. the separator and the next two characters form ://; and
3. we haven’t parsed any whitespace yet.

The simplest example of how this can be a problem is for people who do not use trailers but may leave URLs at the end of the commit message. Now, while these authors might not use trailers themselves, other authors may have used trailers and this metadata confusion can become a problem once someone tries to extract that metadata (and non-metadata).

Let’s now look at some examples in the Linux Kernel[1] to see how this is a problem in practice.

There are commits which contain intended non-trailer lines which start with URLs. These are comments. Example with just the trailers:[2]

[bhelgaas: squash fixes:
https://lore.kernel.org/r/[email protected]
https://lore.kernel.org/r/[email protected]]

Those [] pairs delimit the “squash fixes” comment.

Now, any of these two commands:

     git log --format='%(trailers:only)' -1 <commit>
     git log -1 --format=%B <commit> |
         git interpret-trailers --only-trailers

Will both wrongly (according to the surmised user intent) include these two URL lines as trailers and also mangle the URLs, e.g.:

    https: //lore.kernel.org/r/[email protected]

Because the --only-trailers mode (or only for the git-log(1) format) normalizes the output to a colon and a space.

Another example is linewrapping mistakes; a Link trailer with a URL where the URL ended up on the next line, presumably because the user’s editor linewrapped the “too long” line. Example with just the trailers:[3]

Link:
https://lore.kernel.org/3cnmtqmakpbb2uwhenrj7kdqu3uefykiykjllgfbtpkiwhaa4s@sghkevv7jned [1]

Now, this intended trailer is already ruined, but interpreting the URL as a standalone trailer only compounds the mistake.

Yet another example is the trailer machinery normalizing the trailer block before application, resulting in a https trailer key in the commit message itself. Example with just the trailers:[4]

https: //sashiko.dev/#/patchset/20260429114208.941011-1-holger.brunck%40hitachienergy.com

Fixes c19b6d246a35 ("drivers/net: support hdlc function for QE-UCC")

We have a helpful Link that points to the original patch.[5] Following it we can see that that https trailer was indeed a URL originally (again just the trailer block here):

https://sashiko.dev/#/patchset/20260429114208.941011-1-holger.brunck%40hitachienergy.com

Fixes c19b6d246a35 ("drivers/net: support hdlc function for QE-UCC")

So how did it end up as a https trailer? My theory is that the trailer block was normalized on patch application, causing a URL comment to be wrongly normalized and cemented in the commit message as a trailer.[6]

† 1: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/
† 2: commit 8236fc613d44e59f6736d6c3e9efffaf26ab7f00
† 3: commit 5bd97f5c5f241a5610c4412d1b93995a26241f81
† 4: commit 496c0c4c53bbe1bad97e82cd12103df61a6e459d
† 5: https://patch.msgid.link/[email protected]
† 6: There are only four commits in the Linux Kernel of this kind, and
three of them have the same recurring person in the signoff chain.

---

Notes (series):
Topic name: trailers-no-urls

Topic summary: Stop recognizing URLs in trailer blocks as trailers.

Note to the maintainer: this is based on master with topic kh/doc-trailers merged into it.

I used Peff’s suggestion from the previous email. I just shortened the comment, added the parentheses (://) and added the condition that whitespace has not been found for the case I discussed of someone writing out <key>: // (note the space). (Or for that matter: <key> ://.) I can’t imagine that that is a likely case, but I just want to avoid matching URLs, so we don’t have to reject this case.

t/u-trailer.c: expected_contents[] is not formatted like the other ones in this file. But this is what clang-format(1) gave me.

 Documentation/git-interpret-trailers.adoc | 13 ++++--
 t/t7513-interpret-trailers.sh             | 19 +++++++++
 t/unit-tests/u-trailer.c                  | 52 +++++++++++++++++++++++
 trailer.c                                 |  7 ++-
 4 files changed, 87 insertions(+), 4 deletions(-)
Documentation/git-interpret-trailers.adoc +10 -3
index b4988d39eab..903d598dcb0 100644
@@ -123,9 +123,16 @@ OTHER RULES
 What was covered in the previous section are the rules that are relevant
 for regular use. The following points are included for completeness.
 
-This command ignores comment lines (see `core.commentString` in
-linkgit:git-config[1]). This is for use with the `prepare-commit-msg`
-and `commit-msg` hooks.
+--
+* This command ignores comment lines (see `core.commentString` in
+  linkgit:git-config[1]). This is for use with the `prepare-commit-msg`
+  and `commit-msg` hooks.
+
+* Candidate trailer lines that have `:` as the separator, that have no
+  whitespace before the value part, and that start with `//` are not
+  recognized as trailers. This is to avoid accidentally interpreting
+  URLs as trailers (e.g. lines that start with `https://`).
+--
 
 OPTIONS
 -------
t/t7513-interpret-trailers.sh +19 -0
index 818a8dafbd2..e3555b6d51d 100755
@@ -1989,4 +1989,23 @@ test_expect_success 'handling of --- lines in conjunction with cut-lines' '
 	test_cmp expected actual
 '
 
+test_expect_success 'URLs and lines that are not quite URLs' '
+	cat >expect <<-\EOF &&
+	https: //www.a-trailer.org
+	https: //www.another-trailer.org
+	Signed-off-by: somebody <somebody@somewhere>
+	EOF
+	git interpret-trailers --only-trailers >actual <<-\EOF &&
+	subject
+
+	body
+
+	https://www.not-a-trailer.org
+	https ://www.a-trailer.org
+	https: //www.another-trailer.org
+	Signed-off-by: somebody <somebody@somewhere>
+	EOF
+	test_cmp expect actual
+'
+
 test_done
t/unit-tests/u-trailer.c +52 -0

55 lines not on this page · raw message

trailer.c +6 -1
index 6d8ec7fa8d8..971ae459596 100644
@@ -635,8 +635,13 @@ static ssize_t find_separator(const char *line, const char *separators)
 	int whitespace_found = 0;
 	const char *c;
 	for (c = line; *c; c++) {
-		if (strchr(separators, *c))
+		if (strchr(separators, *c)) {
+			/* avoid accidental URL matches (://) */
+			if (*c == ':' && c[1] == '/' && c[2] == '/' &&
+			    !whitespace_found)
+				return -1;
 			return c - line;
+		}
 		if (!whitespace_found && (isalnum(*c) || *c == '-'))
 			continue;
 		if (c != line && (*c == ' ' || *c == '\t')) {
Signature · 1 line
2.54.0.22.g9e26862b904
#6 lore raw

Re: [PATCH] trailers: stop recognizing URLs as trailers

Quoted 10 lines · [email protected] writes:

From: Kristoffer Haugsbakk <[email protected]>

An HTTPS URL starts with an alphanumeric scheme followed by a colon. That means that they will be recognized as trailers in a trailer block. That turns out to be a problem in practice. Let’s stop recognizing these as trailers by failing the trailer parsing when we:

1. find the separator;
2. the separator and the next two characters form ://; and
3. we haven’t parsed any whitespace yet.

When I read the problem description, I would have expected you to say "If we find <token>: at the beginning of the line, check <token> against known URL schemes like https, ftp, etc. and declare that the line is not a trailer, if it matches". Checking against "://" is much more robust, as it is less likely to happen in random text, and we avoid maintaining a whitelist of scheme names. You are certainly smarter than I am ;-).

Shouldn't we restrict the token preceding "://" more strictly than simply prohibiting whitespace?

Quoted 9 lines

---

trailer.c +0 -0
index 6d8ec7fa8d8..971ae459596 100644

trailer.c static ssize_t find_separator(const char *line, const char *separators) · line 640

Quoted 7 lines
trailer.c +3 -1
@@ -635,8 +635,13 @@ static ssize_t find_separator(const char *line, const char *separators)
 	int whitespace_found = 0;
 	const char *c;
 	for (c = line; *c; c++) {
-		if (strchr(separators, *c))
+		if (strchr(separators, *c)) {
+			/* avoid accidental URL matches (://) */
+			if (*c == ':' && c[1] == '/' && c[2] == '/' &&

How do we know the references to c[1] and c[2] do not access an unmapped piece of memory? The answer is that line[] is NUL terminated, so c[0] == ':' guarantees that c[1] is safe to read and unless it is NUL (and c[1] =='/' certainly means it is not NUL), c[2] is safe to read.

OK. Makes sense to me.

Thanks.

Quoted 7 lines
trailer.c +3 -0
+			    !whitespace_found)
+				return -1;
 			return c - line;
+		}
 		if (!whitespace_found && (isalnum(*c) || *c == '-'))
 			continue;
 		if (c != line && (*c == ' ' || *c == '\t')) {
#7 lore raw

Re: [PATCH] trailers: stop recognizing URLs as trailers

Quoted 13 lines · Junio C Hamano
Quoted 10 lines · [email protected] writes:

From: Kristoffer Haugsbakk <[email protected]>

An HTTPS URL starts with an alphanumeric scheme followed by a colon. That means that they will be recognized as trailers in a trailer block. That turns out to be a problem in practice. Let’s stop recognizing these as trailers by failing the trailer parsing when we:

1. find the separator;
2. the separator and the next two characters form ://; and
3. we haven’t parsed any whitespace yet.

Quoted 7 lines

When I read the problem description, I would have expected you to say "If we find <token>: at the beginning of the line, check <token> against known URL schemes like https, ftp, etc. and declare that the line is not a trailer, if it matches". Checking against "://" is much more robust, as it is less likely to happen in random text, and we avoid maintaining a whitelist of scheme names. You are certainly smarter than I am ;-).

The credit for being smart goes to Peff.

https://lore.kernel.org/git/[email protected]/T/#m03ac1a456648090c04cdf5141b7a3e638f1213d1

Quoted 2 lines

Shouldn't we restrict the token preceding "://" more strictly than simply prohibiting whitespace?

Right now (with this code) we know that:

1. We have either parsed only alphanumerics and hyphens (whitespace is ruled out); or
2. We haven’t even parsed (1), but just found a line that starts with ://.

In both cases we bail out of the parsing with -1, i.e. “not a trailer”.

Wikipedia[1] tells me that this current check *does* have a false positive:

A non-empty scheme component followed by a colon (:), consisting of a sequence of characters beginning with a letter and followed by any combination of letters, digits, plus (+), period (.), or hyphen (-).

🔗 1: https://en.wikipedia.org/wiki/Uniform_Resource_Identifier#Syntax

A URL *must* begin with a letter, but a trailer can just be a digit. Which means that this is not the start of a URL:

    1://

But the current code will reject it as a URL.

There are also other false positives like the strange but legal trailer key -.

Other than that, the character set of trailers (alphanums and hyphens) is a strict subset of URL <scheme>.

I also see that the git-interpret-trailers(1) doc update should say alphanumerics and/or hyphens instead of just alphanums.

Quoted 24 lines
Quoted 10 lines

---

trailer.c +0 -0
index 6d8ec7fa8d8..971ae459596 100644

trailer.c static ssize_t find_separator(const char *line, const char *separators) · line 640

Quoted 7 lines
trailer.c +3 -1
@@ -635,8 +635,13 @@ static ssize_t find_separator(const char *line, const char *separators)
 	int whitespace_found = 0;
 	const char *c;
 	for (c = line; *c; c++) {
-		if (strchr(separators, *c))
+		if (strchr(separators, *c)) {
+			/* avoid accidental URL matches (://) */
+			if (*c == ':' && c[1] == '/' && c[2] == '/' &&

How do we know the references to c[1] and c[2] do not access an unmapped piece of memory? The answer is that line[] is NUL terminated, so c[0] == ':' guarantees that c[1] is safe to read and unless it is NUL (and c[1] =='/' certainly means it is not NUL), c[2] is safe to read.

Quoted 1 line

OK. Makes sense to me.

I’m mostly a Java programmer so I had the same thought (non-didactically ;) ). Yes, because of sentinel NUL and boolean short-circuiting we can incrementally peak one character ahead. This would be wrong in any language without NUL terminating strings, but here it is correct. Indeed, checking the length first (which you would need to do in Java) would incur a linear cost since you need to scan the string until you hit the NUL terminator.

Quoted 3 lines

Thanks.
[snip]

#8 lore raw

Re: [PATCH] trailers: stop recognizing URLs as trailers

In reply to [email protected]
Quoted 4 lines · On Sun, Aug 02, 2026 at 09:57:17PM +0200, [email protected]…

There are commits which contain intended non-trailer lines which start with URLs. These are comments. Example with just the trailers:[2]

Quoted 8 lines

[bhelgaas: squash fixes:
https://lore.kernel.org/r/[email protected]
https://lore.kernel.org/r/[email protected]]

Those [] pairs delimit the “squash fixes” comment.

This example makes me wonder if we ought to be smarter about brackets. I.e., could/should we realize that the opening bracket is a comment and then ignore everything up to the closing one? That would help this case and other weird cases like:

Signed-off-by: whomever
[peff: there's a really interesting thing going on
here: the comment is free-form text that happens to use a colon in a sentence, but we'll interpret it as a trailer with key "here"]
Signed-off-by: another unlucky soul

That said, I think there are cases without brackets that are also confusing. Like:

Let me finish this commit message by telling you all about this amazing url:

https://example.com

So I don't think that is a counter-argument against this URL false-positive check, but just a possible direction for future exploration.

Quoted 6 lines

Another example is linewrapping mistakes; a Link trailer with a URL where the URL ended up on the next line, presumably because the user’s editor linewrapped the “too long” line. Example with just the trailers:[3]

Quoted 8 lines

Link:
https://lore.kernel.org/3cnmtqmakpbb2uwhenrj7kdqu3uefykiykjllgfbtpkiwhaa4s@sghkevv7jned [1]

Now, this intended trailer is already ruined, but interpreting the URL as a standalone trailer only compounds the mistake.

Yeah, this is another interesting example. I agree it is fundamentally broken, but showing the "https" trailer is just making it worse.

Quoted 6 lines
trailer.c +0 -0
index 6d8ec7fa8d8..971ae459596 100644
@@ -635,8 +635,13 @@ static ssize_t find_separator(const char *line, const char *separators)
 	int whitespace_found = 0;

trailer.c static ssize_t find_separator(const char *line, const char *separators) · line 644

Quoted 10 lines
trailer.c +6 -1
 	const char *c;
 	for (c = line; *c; c++) {
-		if (strchr(separators, *c))
+		if (strchr(separators, *c)) {
+			/* avoid accidental URL matches (://) */
+			if (*c == ':' && c[1] == '/' && c[2] == '/' &&
+			    !whitespace_found)
+				return -1;
 			return c - line;
+		}

As discussed elsewhere, we are free to match with short-circuiting because of the NUL termination. But that also means we could write this as:

  if (starts_with(c, "://") && !whitespace_found)

which is perhaps a little more readable.

-Peff

#9 lore raw

Re: [PATCH] trailers: stop recognizing URLs as trailers

Quoted 7 lines · Jeff King

As discussed elsewhere, we are free to match with short-circuiting because of the NUL termination. But that also means we could write this as:

  if (starts_with(c, "://") && !whitespace_found)

which is perhaps a little more readable.

"little more" -> "much more" ;-).

#10 lore raw

Re: [PATCH] trailers: stop recognizing URLs as trailers

In reply to Jeff King
Quoted 14 lines · Jeff King
Quoted 11 lines · On Sun, Aug 02, 2026 at 09:57:17PM +0200, [email protected]…

There are commits which contain intended non-trailer lines which start with URLs. These are comments. Example with just the trailers:[2]

[bhelgaas: squash fixes:
https://lore.kernel.org/r/[email protected]
https://lore.kernel.org/r/[email protected]]

Quoted 6 lines
Quoted 1 line

Those [] pairs delimit the “squash fixes” comment.

This example makes me wonder if we ought to be smarter about brackets. I.e., could/should we realize that the opening bracket is a comment and then ignore everything up to the closing one? That would help this case and other weird cases like: [snip]

I think that it makes a lot of sense to special-case brackets as delimiting non-trailer runs.

(for other readers) This support for non-trailer lines grew out of Linux Kernel practices. At least according to this thread:

https://lore.kernel.org/git/CA+55aFzN4SnenchxPScn61_apzitGAPtoYEd49iLZPxgK0KQGw@mail.gmail.com/

(See also in particular: https://lore.kernel.org/git/[email protected]/ )

And part of the back-and-forth in that thread is an inherent tension:
the trailer format is loose. All you need is a some alphanumerics/hyphens and a colon. So it is simple to accidentally slip in a *real* trailer line along with all the cruft. Like Peff’s example shows:

Quoted 7 lines

Signed-off-by: whomever
[peff: there's a really interesting thing going on
here: the comment is free-form text that happens to use a colon in a sentence, but we'll interpret it as a trailer with key "here"]
Signed-off-by: another unlucky soul

Imagine you had internalized the trailer parsing rules (which you shouldn’t have to but anyway); it would still be easy to accidentally write something like the above.

But with an additional [] rule you don’t have to worry:

• A run of non-trailer lines starts with regex ^[
• And ends 0 or more lines later with regex ]$
• In addition to the existing rules

And [] are illegal in trailer keys anyway.

This is a very Linux (and Git project) specific additional rule, but the non-trailer lines rules were always like that.

Quoted 8 lines

That said, I think there are cases without brackets that are also confusing. Like:

Let me finish this commit message by telling you all about this amazing url:

https://example.com

Yeah exactly.

Quoted 22 lines

[snip]

Quoted 6 lines
trailer.c +0 -0
index 6d8ec7fa8d8..971ae459596 100644
@@ -635,8 +635,13 @@ static ssize_t find_separator(const char *line, const char *separators)
 	int whitespace_found = 0;

trailer.c static ssize_t find_separator(const char *line, const char *separators) · line 644

Quoted 10 lines
trailer.c +6 -1
 	const char *c;
 	for (c = line; *c; c++) {
-		if (strchr(separators, *c))
+		if (strchr(separators, *c)) {
+			/* avoid accidental URL matches (://) */
+			if (*c == ':' && c[1] == '/' && c[2] == '/' &&
+			    !whitespace_found)
+				return -1;
 			return c - line;
+		}

As discussed elsewhere, we are free to match with short-circuiting because of the NUL termination. But that also means we could write this as:

Quoted 3 lines
  if (starts_with(c, "://") && !whitespace_found)

which is perhaps a little more readable.

Oh for sure, much more readable.

Thanks!

#11 lore raw

Re: [PATCH] trailers: stop recognizing URLs as trailers

In reply to [email protected]
Quoted 9 lines · [email protected] writes:

From: Kristoffer Haugsbakk <[email protected]>

An HTTPS URL starts with an alphanumeric scheme followed by a colon. That means that they will be recognized as trailers in a trailer block. That turns out to be a problem in practice. Let’s stop recognizing these as trailers by failing the trailer parsing when we:
...

This has been on hold waiting for the base topic to settle, but now that the base topic has graduated, the effort can be rebooted.

Can somebody summarize the outstanding issues on this topic (if any)?

Thanks.

#12 lore raw

Re: [PATCH] trailers: stop recognizing URLs as trailers

Quoted 12 lines · Junio C Hamano
Quoted 9 lines · [email protected] writes:

From: Kristoffer Haugsbakk <[email protected]>

An HTTPS URL starts with an alphanumeric scheme followed by a colon. That means that they will be recognized as trailers in a trailer block. That turns out to be a problem in practice. Let’s stop recognizing these as trailers by failing the trailer parsing when we:
...

Quoted 2 lines

This has been on hold waiting for the base topic to settle, but now that the base topic has graduated, the effort can be rebooted.

Thanks!

Quoted 2 lines

Can somebody summarize the outstanding issues on this topic (if any)?

I have version 2 ready. The only code change is using starts_with like Peff mentioned. What I wrote about the changes:

• Use starts_with for readability:
https://lore.kernel.org/git/[email protected]/T/#m74203c474c34f1028a7e3d389ff46fb7e579444c
• Explain in the commit message that you can technically get false positive “URL” start fragments:

https://lore.kernel.org/git/[email protected]/T/#m35047d5c7a79abd23c11f97e6b6a0364409805e3

I just have to dust it off.

#13 lore raw

Re: [PATCH] trailers: stop recognizing URLs as trailers

Quoted 5 lines · Kristoffer Haugsbakk
Quoted 2 lines

Can somebody summarize the outstanding issues on this topic (if any)?

I have version 2 ready. The only code change is using starts_with like Peff mentioned. What I wrote about the changes:

Yep, v2 looks great to me.

-Peff

#14 lore raw

PATCH v2 1/1 trailers: stop recognizing URLs as trailers

In reply to [email protected]

From: Kristoffer Haugsbakk <[email protected]>

An HTTPS URL starts with an alphanumeric scheme followed by a colon. That means that they will be recognized as trailers in a trailer block. That turns out to be a problem in practice. Let’s stop recognizing these as trailers by failing the trailer parsing when we:

1. find the separator;
2. the separator and the next two characters form ://; and
3. we haven’t parsed any whitespace yet.

The simplest example of how this can be a problem is for people who do not use trailers but may leave URLs at the end of the commit message. Now, while these authors might not use trailers themselves, other authors may have used trailers and this metadata confusion can become a problem once someone tries to extract that metadata (and non-metadata).

Let’s now look at some examples in the Linux Kernel[1] to see how this is a problem in practice.

There are commits which contain intended non-trailer lines which start with URLs. These are comments. Example with just the trailers:[2]

[bhelgaas: squash fixes:
https://lore.kernel.org/r/[email protected]
https://lore.kernel.org/r/[email protected]]

Those [] pairs delimit the “squash fixes” comment.

Now, any of these two commands:

     git log --format='%(trailers:only)' -1 <commit>
     git log -1 --format=%B <commit> |
         git interpret-trailers --only-trailers

Will both wrongly (according to the surmised user intent) include these two URL lines as trailers and also mangle the URLs, e.g.:

    https: //lore.kernel.org/r/[email protected]

Because the --only-trailers mode (or only for the git-log(1) format) normalizes the output to a colon and a space.

Another example is linewrapping mistakes; a Link trailer with a URL where the URL ended up on the next line, presumably because the user’s editor linewrapped the “too long” line. Example with just the trailers:[3]

Link:
https://lore.kernel.org/3cnmtqmakpbb2uwhenrj7kdqu3uefykiykjllgfbtpkiwhaa4s@sghkevv7jned [1]

Now, this intended trailer is already ruined, but interpreting the URL as a standalone trailer only compounds the mistake.

Yet another example is the trailer machinery normalizing the trailer block before application, resulting in a https trailer key in the commit message itself. Example with just the trailers:[4]

https: //sashiko.dev/#/patchset/20260429114208.941011-1-holger.brunck%40hitachienergy.com

Fixes c19b6d246a35 ("drivers/net: support hdlc function for QE-UCC")

We have a helpful Link that points to the original patch.[5] Following it we can see that that https trailer was indeed a URL originally (again just the trailer block here):

https://sashiko.dev/#/patchset/20260429114208.941011-1-holger.brunck%40hitachienergy.com

Fixes c19b6d246a35 ("drivers/net: support hdlc function for QE-UCC")

So how did it end up as a https trailer? My theory is that the trailer block was normalized on patch application, causing a URL comment to be wrongly normalized and cemented in the commit message as a trailer.[6]

† 1: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/
† 2: commit 8236fc613d44e59f6736d6c3e9efffaf26ab7f00
† 3: commit 5bd97f5c5f241a5610c4412d1b93995a26241f81
† 4: commit 496c0c4c53bbe1bad97e82cd12103df61a6e459d
† 5: https://patch.msgid.link/[email protected]
† 6: There are only four commits in the Linux Kernel of this kind, and
three of them have the same recurring person in the signoff chain.

***

Note that this check has some benign false positives. A trailer key can start with a digit, but a URL scheme can not start with a digit. That means that a line that starts with 1:// will be rejected even though it cannot be a URL. I don’t think this will reject any real trailers, so I think the implementation simplicity is worth it.

And these false positives are just for a limited start fragment check; a mere heuristic, not a URL parser.

---

Notes (series):
Topic name (applied): trailers-no-urls

Topic summary: Stop recognizing URLs in trailer blocks as trailers.

Note to the maintainer: This has been rebased on master since the dependent topic kh/doc-trailers has been merged thither.

§ Link to v1

https://lore.kernel.org/git/[email protected]/

§ Changes in v2

• Use starts_with for readability:
https://lore.kernel.org/git/[email protected]/T/#m74203c474c34f1028a7e3d389ff46fb7e579444c
• Since starts_with is a function, put the simpler conjunct whitespace_found before it. It’s better to put the cheaper operations first in a short-circuiting expression. Right?
• Explain in the commit message that you can technically get false positive “URL” start fragments:

https://lore.kernel.org/git/[email protected]/T/#m35047d5c7a79abd23c11f97e6b6a0364409805e3

 Documentation/git-interpret-trailers.adoc | 13 ++++--
 t/t7513-interpret-trailers.sh             | 19 +++++++++
 t/unit-tests/u-trailer.c                  | 52 +++++++++++++++++++++++
 trailer.c                                 |  6 ++-
 4 files changed, 86 insertions(+), 4 deletions(-)
Documentation/git-interpret-trailers.adoc +10 -3
index b4988d39eab..903d598dcb0 100644
@@ -123,9 +123,16 @@ OTHER RULES
 What was covered in the previous section are the rules that are relevant
 for regular use. The following points are included for completeness.
 
-This command ignores comment lines (see `core.commentString` in
-linkgit:git-config[1]). This is for use with the `prepare-commit-msg`
-and `commit-msg` hooks.
+--
+* This command ignores comment lines (see `core.commentString` in
+  linkgit:git-config[1]). This is for use with the `prepare-commit-msg`
+  and `commit-msg` hooks.
+
+* Candidate trailer lines that have `:` as the separator, that have no
+  whitespace before the value part, and that start with `//` are not
+  recognized as trailers. This is to avoid accidentally interpreting
+  URLs as trailers (e.g. lines that start with `https://`).
+--
 
 OPTIONS
 -------
t/t7513-interpret-trailers.sh +19 -0
index 818a8dafbd2..e3555b6d51d 100755
@@ -1989,4 +1989,23 @@ test_expect_success 'handling of --- lines in conjunction with cut-lines' '
 	test_cmp expected actual
 '
 
+test_expect_success 'URLs and lines that are not quite URLs' '
+	cat >expect <<-\EOF &&
+	https: //www.a-trailer.org
+	https: //www.another-trailer.org
+	Signed-off-by: somebody <somebody@somewhere>
+	EOF
+	git interpret-trailers --only-trailers >actual <<-\EOF &&
+	subject
+
+	body
+
+	https://www.not-a-trailer.org
+	https ://www.a-trailer.org
+	https: //www.another-trailer.org
+	Signed-off-by: somebody <somebody@somewhere>
+	EOF
+	test_cmp expect actual
+'
+
 test_done
t/unit-tests/u-trailer.c +52 -0

55 lines not on this page · raw message

trailer.c +5 -1
index 6d8ec7fa8d8..10b1abebfbe 100644
@@ -635,8 +635,12 @@ static ssize_t find_separator(const char *line, const char *separators)
 	int whitespace_found = 0;
 	const char *c;
 	for (c = line; *c; c++) {
-		if (strchr(separators, *c))
+		if (strchr(separators, *c)) {
+			/* avoid accidental URL matches */
+			if (!whitespace_found && starts_with(c, "://"))
+				return -1;
 			return c - line;
+		}
 		if (!whitespace_found && (isalnum(*c) || *c == '-'))
 			continue;
 		if (c != line && (*c == ' ' || *c == '\t')) {

Range-diff against v1:
1: e7ba66a0ce3 ! 1: 2f8d10c1c6d trailers: stop recognizing URLs as trailers
@@ Commit message
† 6: There are only four commits in the Linux Kernel of this kind, and
three of them have the same recurring person in the signoff chain.

+ ***
+
+ Note that this check has some benign false positives. A trailer key
+ can start with a digit, but a URL scheme can not start with a digit.
+ That means that a line that starts with 1:// will be rejected even
+ though it cannot be a URL. I don’t think this will reject any real
+ trailers, so I think the implementation simplicity is worth it.
+
+ And these false positives are just for a limited start fragment check;
+ a mere heuristic, not a URL parser.
+

@@ trailer.c: static ssize_t find_separator(const char *line, const char *separator
for (c = line; *c; c++) {
- if (strchr(separators, *c))
+ if (strchr(separators, *c)) {
-+ /* avoid accidental URL matches (://) */
-+ if (*c == ':' && c[1] == '/' && c[2] == '/' &&
-+ !whitespace_found)
++ /* avoid accidental URL matches */
++ if (!whitespace_found && starts_with(c, "://"))
+ return -1;
return c - line;
+ }

base-commit: 1a3e64c6c4a623626ff0687008732a8e007e2a1c

Signature · 1 line
2.55.0.13.g85d2d65e389
#15 lore raw

PATCH v3 1/1 trailers: stop recognizing URLs as trailers

In reply to [email protected]

From: Kristoffer Haugsbakk <[email protected]>

An HTTPS URL starts with an alphanumeric scheme followed by a colon. That means that they will be recognized as trailers in a trailer block. That turns out to be a problem in practice. Let’s stop recognizing these as trailers by failing the trailer parsing when we:

1. find the separator;
2. the separator and the next two characters form ://; and
3. we haven’t parsed any whitespace yet.

The simplest example of how this can be a problem is for people who do not use trailers but may leave URLs at the end of the commit message. Now, while these authors might not use trailers themselves, other authors may have used trailers and this metadata confusion can become a problem once someone tries to extract that metadata (and non-metadata).

Let’s now look at some examples in the Linux Kernel[1] to see how this is a problem in practice.

There are commits which contain intended non-trailer lines which start with URLs. These are comments. Example with just the trailers:[2]

[bhelgaas: squash fixes:
https://lore.kernel.org/r/[email protected]
https://lore.kernel.org/r/[email protected]]

Those [] pairs delimit the “squash fixes” comment.

Now, any of these two commands:

     git log --format='%(trailers:only)' -1 <commit>
     git log -1 --format=%B <commit> |
         git interpret-trailers --only-trailers

Will both wrongly (according to the surmised user intent) include these two URL lines as trailers and also mangle the URLs, e.g.:

    https: //lore.kernel.org/r/[email protected]

Because the --only-trailers mode (or only for the git-log(1) format) normalizes the output to a colon and a space.

Another example is linewrapping mistakes; a Link trailer with a URL where the URL ended up on the next line, presumably because the user’s editor linewrapped the “too long” line. Example with just the trailers:[3]

Link:
https://lore.kernel.org/3cnmtqmakpbb2uwhenrj7kdqu3uefykiykjllgfbtpkiwhaa4s@sghkevv7jned [1]

Now, this intended trailer is already ruined, but interpreting the URL as a standalone trailer only compounds the mistake.

Yet another example is the trailer machinery normalizing the trailer block before application, resulting in a https trailer key in the commit message itself. Example with just the trailers:[4]

https: //sashiko.dev/#/patchset/20260429114208.941011-1-holger.brunck%40hitachienergy.com

Fixes c19b6d246a35 ("drivers/net: support hdlc function for QE-UCC")

We have a helpful Link that points to the original patch.[5] Following it we can see that that https trailer was indeed a URL originally (again just the trailer block here):

https://sashiko.dev/#/patchset/20260429114208.941011-1-holger.brunck%40hitachienergy.com

Fixes c19b6d246a35 ("drivers/net: support hdlc function for QE-UCC")

So how did it end up as a https trailer? My theory is that the trailer block was normalized on patch application, causing a URL comment to be wrongly normalized and cemented in the commit message as a trailer.[6]

† 1: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/
† 2: commit 8236fc613d44e59f6736d6c3e9efffaf26ab7f00
† 3: commit 5bd97f5c5f241a5610c4412d1b93995a26241f81
† 4: commit 496c0c4c53bbe1bad97e82cd12103df61a6e459d
† 5: https://patch.msgid.link/[email protected]
† 6: There are only four commits in the Linux Kernel of this kind, and
three of them have the same recurring person in the signoff chain.

***

Note that this check has some benign false positives. A trailer key can start with a digit, but a URL scheme can not start with a digit. That means that a line that starts with 1:// will be rejected even though it cannot be a URL. I don’t think this will reject any real trailers, so I think the implementation simplicity is worth it.

And these false positives are just for a limited start fragment check; a mere heuristic, not a URL parser.

---

Notes (series):
Topic name (applied): trailers-no-urls

Topic summary: Stop recognizing URLs in trailer blocks as trailers.

§ Link to v2

https://lore.kernel.org/git/[email protected]/

§ Changes in v2

• Add Ack https://lore.kernel.org/git/[email protected]/

 Documentation/git-interpret-trailers.adoc | 13 ++++--
 t/t7513-interpret-trailers.sh             | 19 +++++++++
 t/unit-tests/u-trailer.c                  | 52 +++++++++++++++++++++++
 trailer.c                                 |  6 ++-
 4 files changed, 86 insertions(+), 4 deletions(-)
Documentation/git-interpret-trailers.adoc +10 -3
index b4988d39eab..903d598dcb0 100644
@@ -123,9 +123,16 @@ OTHER RULES
 What was covered in the previous section are the rules that are relevant
 for regular use. The following points are included for completeness.
 
-This command ignores comment lines (see `core.commentString` in
-linkgit:git-config[1]). This is for use with the `prepare-commit-msg`
-and `commit-msg` hooks.
+--
+* This command ignores comment lines (see `core.commentString` in
+  linkgit:git-config[1]). This is for use with the `prepare-commit-msg`
+  and `commit-msg` hooks.
+
+* Candidate trailer lines that have `:` as the separator, that have no
+  whitespace before the value part, and that start with `//` are not
+  recognized as trailers. This is to avoid accidentally interpreting
+  URLs as trailers (e.g. lines that start with `https://`).
+--
 
 OPTIONS
 -------
t/t7513-interpret-trailers.sh +19 -0
index 818a8dafbd2..e3555b6d51d 100755
@@ -1989,4 +1989,23 @@ test_expect_success 'handling of --- lines in conjunction with cut-lines' '
 	test_cmp expected actual
 '
 
+test_expect_success 'URLs and lines that are not quite URLs' '
+	cat >expect <<-\EOF &&
+	https: //www.a-trailer.org
+	https: //www.another-trailer.org
+	Signed-off-by: somebody <somebody@somewhere>
+	EOF
+	git interpret-trailers --only-trailers >actual <<-\EOF &&
+	subject
+
+	body
+
+	https://www.not-a-trailer.org
+	https ://www.a-trailer.org
+	https: //www.another-trailer.org
+	Signed-off-by: somebody <somebody@somewhere>
+	EOF
+	test_cmp expect actual
+'
+
 test_done
t/unit-tests/u-trailer.c +52 -0

55 lines not on this page · raw message

trailer.c +5 -1
index 6d8ec7fa8d8..10b1abebfbe 100644
@@ -635,8 +635,12 @@ static ssize_t find_separator(const char *line, const char *separators)
 	int whitespace_found = 0;
 	const char *c;
 	for (c = line; *c; c++) {
-		if (strchr(separators, *c))
+		if (strchr(separators, *c)) {
+			/* avoid accidental URL matches */
+			if (!whitespace_found && starts_with(c, "://"))
+				return -1;
 			return c - line;
+		}
 		if (!whitespace_found && (isalnum(*c) || *c == '-'))
 			continue;
 		if (c != line && (*c == ' ' || *c == '\t')) {

Interdiff against v2:

Range-diff against v2:
1: 2f8d10c1c6d ! 1: 736610daf6e trailers: stop recognizing URLs as trailers
@@ Commit message
a mere heuristic, not a URL parser.

+ Acked-by: Jeff King <[email protected]>

## Documentation/git-interpret-trailers.adoc ##

base-commit: 1a3e64c6c4a623626ff0687008732a8e007e2a1c

Signature · 1 line
2.55.0.13.g85d2d65e389
#17 lore raw

Re: [PATCH v3] trailers: stop recognizing URLs as trailers

In reply to [email protected]
Quoted 5 lines · [email protected] writes:

Notes (series):
Topic name (applied): trailers-no-urls

Topic summary: Stop recognizing URLs in trailer blocks as trailers.

Quoted 7 lines

§ Link to v2

https://lore.kernel.org/git/[email protected]/

§ Changes in v2

• Add Ack https://lore.kernel.org/git/[email protected]/

That's a change in v3, and the only one. v2 was already good so let me mark it for 'next'.

Thanks.