aboutsummaryrefslogtreecommitdiff
path: root/contrib/gcc-changelog/git_commit.py
diff options
context:
space:
mode:
authorMartin Liska <mliska@suse.cz>2022-01-24 13:03:01 +0100
committerMartin Liska <mliska@suse.cz>2022-01-24 13:26:30 +0100
commit978abe918f8c8deed28e92297d3c0cc39086ad83 (patch)
tree6ddce99632f3b7a9dcc09e668e807fda6f990be9 /contrib/gcc-changelog/git_commit.py
parentf1af8528d34418bc874ae9d993ee0dc3559972d2 (diff)
downloadgcc-978abe918f8c8deed28e92297d3c0cc39086ad83.zip
gcc-978abe918f8c8deed28e92297d3c0cc39086ad83.tar.gz
gcc-978abe918f8c8deed28e92297d3c0cc39086ad83.tar.bz2
gcc-changelog: Be stricter for top-level dir.
contrib/ChangeLog: * gcc-changelog/git_commit.py: New files in toplev must be explicitly marked as "New file". * gcc-changelog/test_email.py: Test. * gcc-changelog/test_patches.txt: Add test.
Diffstat (limited to 'contrib/gcc-changelog/git_commit.py')
-rwxr-xr-xcontrib/gcc-changelog/git_commit.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/contrib/gcc-changelog/git_commit.py b/contrib/gcc-changelog/git_commit.py
index 27a1d59..95dc49e 100755
--- a/contrib/gcc-changelog/git_commit.py
+++ b/contrib/gcc-changelog/git_commit.py
@@ -718,9 +718,15 @@ class GitCommit:
self.changelog_entries.append(entry)
# strip prefix of the file
assert file.startswith(entry.folder)
- file = file[len(entry.folder):].lstrip('/')
- entry.lines.append('\t* %s: New file.' % file)
- entry.files.append(file)
+ # do not allow auto-addition of New files
+ # for the top-level folder
+ if entry.folder:
+ file = file[len(entry.folder):].lstrip('/')
+ entry.lines.append('\t* %s: New file.' % file)
+ entry.files.append(file)
+ else:
+ msg = 'new file in the top-level folder not mentioned in a ChangeLog'
+ self.errors.append(Error(msg, file))
else:
used_pattern = [p for p in mentioned_patterns
if file.startswith(p)]