Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 15 Aug 2014 19:12:59 +0000 (UTC)
From:      William Grzybowski <wg@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-svnadmin@freebsd.org
Subject:   svn commit: r365025 - in svnadmin/hooks: . scripts
Message-ID:  <201408151912.s7FJCxqj035915@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: wg
Date: Fri Aug 15 19:12:58 2014
New Revision: 365025
URL: http://svnweb.freebsd.org/changeset/ports/365025
QAT: https://qat.redports.org/buildarchive/r365025/

Log:
  Add a svn hook to disable filenames containing a colon (:).
  
  Phabric:	D504
  Approved by:	portmgr (mat, bdrewery)

Added:
  svnadmin/hooks/scripts/detect-filename.sh   (contents, props changed)
Modified:
  svnadmin/hooks/pre-commit

Modified: svnadmin/hooks/pre-commit
==============================================================================
--- svnadmin/hooks/pre-commit	Fri Aug 15 19:09:17 2014	(r365024)
+++ svnadmin/hooks/pre-commit	Fri Aug 15 19:12:58 2014	(r365025)
@@ -98,6 +98,9 @@ stage-only.sh "$REPO" "$TXN" || exit 1
 # check commits to vulk.xml don't have other files
 vulnxml-unique.sh "$REPO" "$TXN" || exit 1
 
+# check for filenames with invalid chars
+detect-filename.sh "$REPO" "$TXN" || exit 1
+
 # check for merge debris
 detect-merge-conflicts.sh "$REPO" "$TXN" || exit 1
 

Added: svnadmin/hooks/scripts/detect-filename.sh
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ svnadmin/hooks/scripts/detect-filename.sh	Fri Aug 15 19:12:58 2014	(r365025)
@@ -0,0 +1,30 @@
+#!/bin/sh
+# pre-commit hook to detect files containing not allowed characters
+# $FreeBSD$
+
+REPO=$1
+TXN=$2
+
+SVNLOOK=/usr/local/bin/svnlook
+
+# Check arguments
+if [ -z "$REPO" -o -z "$TXN" ]; then
+  echo "Syntax: $0 path_to_repos txn_id" >&2
+  exit 1
+fi
+
+# Approved by portmgr gets a free pass
+$SVNLOOK log -t "$TXN" "$REPO" | grep -q 'portmgr' && exit 0
+
+# We scan through the transaction diff, looking for files with colon in the name
+if $SVNLOOK changed -t "$TXN" "$REPO" | grep -q -E '^A.*:'; then
+  echo "Some files in your commit have a colon (:) in the name" >&2
+  echo "which is not allowed. Use __ instead of :: for patches ." >&2
+  echo "For further information please read:" >&2
+  echo "http://www.freebsd.org/doc/en/books/porters-handbook/slow-patch.html" >&2
+  echo "Please fix this and try committing again." >&2
+  exit 1
+fi
+
+# No files with invalid chars were detected
+exit 0



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201408151912.s7FJCxqj035915>