scripts: pre-submit: Ensure changelog captures API updates
I think most people have fallen short of this ideal at some point, so
add an automated check.
Change-Id: Ic7d2da4d97d49d7e5f43bc341b7e13381b8176e5
Signed-off-by: Andrew Jeffery <andrew@codeconstruct.com.au>
diff --git a/scripts/changelog.awk b/scripts/changelog.awk
new file mode 100644
index 0000000..e1644e6
--- /dev/null
+++ b/scripts/changelog.awk
@@ -0,0 +1,4 @@
+BEGIN { cl = 0; api = 0; }
+/^CHANGELOG.md$/ { cl=1 }
+/^include[/]libpldm/ { api=1 }
+END { exit !(cl || !api); }
diff --git a/scripts/pre-submit b/scripts/pre-submit
index 0c00ac5..8d50341 100755
--- a/scripts/pre-submit
+++ b/scripts/pre-submit
@@ -7,6 +7,15 @@
meson format --recursive --inplace || true
git diff --quiet
+# Make sure if the change touches the public headers, it also updates the
+# changelog.
+if ! git show --format="" --name-only HEAD -- CHANGELOG.md include/libpldm |
+ awk -f scripts/changelog.awk
+then
+ echo You must document your changes under include/libpldm in CHANGELOG.md
+ exit 1
+fi
+
# Ensure the test suite passes in the default configuration. Note
# that we don't specify -Dabi=... - the default is equivalent to
# -Dabi=deprecated,stable,testing.