Skip to contentSkip to conversation

patman: Detect unexpected END

PATCH New Patrick Delaunay 2 participants 2 messages Jul 2, 2020 – Jul 3, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 patman: Detect unexpected END

Detect unexpected 'END' line when a section is not detected.

This patch detect issue when tag name for section start is misspelled, for example 'Commit-note:' for 'Commit-notes:'

Commit-note:
....
END

Then 'Commit-note:' is removed silently by re_remove = "Commit-\w*:" but 'END' is kept in commit message.

---

 tools/patman/patchstream.py | 4 ++++
 1 file changed, 4 insertions(+)
tools/patman/patchstream.py +4 -0
index 4fe465e9ab..a575c09b47 100644
@@ -260,6 +260,10 @@ class PatchStream:
             else:
                 self.section.append(line)
 
+        # If we are not in a section, it is an unexpected END
+        elif line == 'END':
+                raise ValueError("'END' wihout section")
+
         # Detect the commit subject
         elif not is_blank and self.state == STATE_PATCH_SUBJECT:
             self.commit.subject = line
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/1 patman: Detect unexpected END

Quoted 10 lines · Patrick Delaunay

Detect unexpected 'END' line when a section is not detected.

This patch detect issue when tag name for section start is misspelled, for example 'Commit-note:' for 'Commit-notes:'

Commit-note:
....
END

Quoted 8 lines

Then 'Commit-note:' is removed silently by re_remove = "Commit-\w*:" but 'END' is kept in commit message.

---

 tools/patman/patchstream.py | 4 ++++
 1 file changed, 4 insertions(+)