From 38f12141170abb4882b1c7806055450915616d3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Star=C3=BD?= Date: Fri, 5 Jan 2018 19:42:34 +0100 Subject: [PATCH] unbreak sed(1) in pre-commit Signed-off-by: Erik de Castro Lopo --- Scripts/git-pre-commit-hook | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Scripts/git-pre-commit-hook b/Scripts/git-pre-commit-hook index f967f3b0..dc70e735 100755 --- a/Scripts/git-pre-commit-hook +++ b/Scripts/git-pre-commit-hook @@ -1,5 +1,4 @@ #!/bin/sh -# if git rev-parse --verify HEAD >/dev/null 2>&1 ; then against=HEAD @@ -8,13 +7,6 @@ else against=4b825dc642cb6eb9a060e54bf8d69288fbee4904 fi -SED="sed -r " # BSD sed -if test $(sed --version | grep -c GNU) -gt 0 ; then - SED="sed -E " - fi - -files=$(git diff-index --name-status --cached HEAD | grep -v ^D | ${SED} "s/^[A-Z]+[A-Z0-9]*[ \t]+/ /") - # Redirect output to stderr. exec 1>&2 @@ -36,6 +28,14 @@ if test $(git diff --cached --name-only --diff-filter=A -z $against | LC_ALL=C t #------------------------------------------------------------------------------- # Check the formatting of all C files. +# http://man.openbsd.org/sed#r +# http://man.openbsd.org/sed#E +# http://netbsd.gw.com/cgi-bin/man-cgi?sed++NetBSD-current +# https://github.com/freebsd/freebsd/blob/master/usr.bin/sed/main.c +# http://git.savannah.gnu.org/gitweb/?p=sed.git;a=blob;f=sed/sed.c +# GNU has -r and -E (undocumented); MacOS has -E but not -r; Sunos has neither. +files=$(git diff-index --name-status --cached HEAD | grep -v ^D | sed -E "s/^[A-Z]+[A-Z0-9]*[ \t]+/ /") + cfiles="" for f in $files ; do if test `dirname $f` = "src/ALAC" ; then