Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F109294801
D35733.id108370.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D35733.id108370.diff
View Options
Index: .hooks/pre-commit.d/check_portepoch
===================================================================
--- /dev/null
+++ .hooks/pre-commit.d/check_portepoch
@@ -0,0 +1,27 @@
+#!/bin/sh
+#
+# Check that PORTEPOCH is not being dropped, and is non-decreasing
+#
+
+check_epoch() {
+ local makefile="$1"
+ local old_epoch=$(git diff --cached -U0 "${makefile}" | grep '^\-PORTEPOCH' | grep -oE '[0-9]+')
+ local new_epoch=$(git diff --cached -U0 "${makefile}" | grep '^\+PORTEPOCH' | grep -oE '[0-9]+')
+ if [ -z "${new_epoch}" ] ; then
+ echo "[pre-commit] dropped PORTEPOCH ${old_epoch} in ${makefile}"
+ exit 1
+ fi
+ if [ -n "${old_epoch}" ] ; then
+ if [ ${new_epoch} -lt ${old_epoch} ] ; then
+ echo "[pre-commit] PORTEPOCH decreasing from ${old_epoch} to ${new_epoch} in ${makefile}"
+ exit 2
+ fi
+ fi
+}
+
+modified_makefiles=$(git diff --name-only --cached --diff-filter=M -GPORTEPOCH | grep -E '^[^/]+/[^/]+/Makefile$')
+if [ $? -eq 0 ] ; then
+ for modified_makefile in ${modified_makefiles} ; do
+ check_epoch ${modified_makefile}
+ done
+fi
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Feb 4, 4:43 AM (5 h, 52 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16448080
Default Alt Text
D35733.id108370.diff (1 KB)
Attached To
Mode
D35733: framework: add git-hook to check PORTEPOCH validity
Attached
Detach File
Event Timeline
Log In to Comment