if self.revert_commit:
self.info = self.commit_to_info_hook(self.revert_commit)
+ # Allow complete deletion of ChangeLog files in a commit
project_files = [f for f in self.info.modified_files
- if self.is_changelog_filename(f[0], allow_suffix=True)
+ if (self.is_changelog_filename(f[0], allow_suffix=True) and f[1] != 'D')
or f[0] in misc_files]
ignored_files = [f for f in self.info.modified_files
if self.in_ignored_location(f[0])]
t = 'A'
else:
t = 'M'
- modified_files.append((target, t))
+ modified_files.append((target if t != 'D' else source, t))
git_info = GitInfo(None, date, author, body, modified_files)
super().__init__(git_info, strict=strict,
commit_to_info_hook=lambda x: None)
+[flake8]
+max-line-length = 120
+
[tool:pytest]
addopts = -vv --flake8
def test_multiline_bad_parentheses(self):
email = self.from_patch_glob('0002-Wrong-macro-changelog.patch')
assert email.errors[0].message == 'bad parentheses wrapping'
+
+ def test_changelog_removal(self):
+ email = self.from_patch_glob('0001-ChangeLog-removal.patch', strict=True)
+ assert not email.errors
+
--
2.29.2
+
+=== 0001-ChangeLog-removal.patch ===
+From b39fadf9df1a9510afcab0a391182da7dc68de24 Mon Sep 17 00:00:00 2001
+From: Martin Liska <mliska@suse.cz>
+Date: Fri, 12 Mar 2021 09:10:55 +0100
+Subject: [PATCH] Test ChangeLog removal.
+
+gcc/ChangeLog:
+
+ * ipa-icf.c (make_pass_ipa_icf): Add line.
+---
+diff --git a/gcc/analyzer/ChangeLog b/gcc/analyzer/ChangeLog
+deleted file mode 100644
+index 94e87f6bcde..00000000000
+--- a/gcc/analyzer/ChangeLog
++++ /dev/null
+@@ -1,1 +0,0 @@
+- foo
+diff --git a/gcc/ipa-icf.c b/gcc/ipa-icf.c
+index 5dd33a75c3a..c4ce432cb98 100644
+--- a/gcc/ipa-icf.c
++++ b/gcc/ipa-icf.c
+@@ -3655,3 +3655,4 @@ make_pass_ipa_icf (gcc::context *ctxt)
+ {
+ return new ipa_icf::pass_ipa_icf (ctxt);
+ }
++
+--
+2.30.1
+