From 5552242588b8dd4dab155324cc8b12a3c61dd1e5 Mon Sep 17 00:00:00 2001 From: Ivan Frade Date: Wed, 29 Nov 2023 10:51:04 -0800 Subject: FooterLine: First line cannot be a footer The first line of the commit message cannot be a footer line. This restriction was dropped in commit [1] while adding multiline footers. This affects at least the git-numberer gerrit plugin, that even have a test for it [2]. Reintroduce the restriction that the first line of the commit message cannot be a footer and bring the test from git-numberer to jgit. [1] https://review.gerrithub.io/c/eclipse-jgit/jgit/+/1172664 [2] https://chromium.googlesource.com/infra/gerrit-plugins/git-numberer/+/refs/heads/main/src/test/java/com/googlesource/chromium/plugins/gitnumberer/GetFooterLinesTest.java Change-Id: Id3fa6b8614664dbc3fdccffe1006b0b9752a8de6 --- org.eclipse.jgit/src/org/eclipse/jgit/revwalk/FooterLine.java | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'org.eclipse.jgit') diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/FooterLine.java b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/FooterLine.java index cadeaec6e0..309d46f690 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/FooterLine.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/FooterLine.java @@ -107,6 +107,10 @@ public final class FooterLine { break; } } + if (keyStart == msgB) { + // Fist line cannot be a footer + continue; + } r.add(new FooterLine(raw, enc, keyStart, keyEnd, valStart, valEnd)); } -- cgit v1.2.3