From 5a3ec9901d7384d99e77c8db1b9f6b4498a79273 Mon Sep 17 00:00:00 2001 From: Oleg Pudeyev Date: Fri, 9 Apr 2010 10:30:35 -0400 Subject: [PATCH 1/3] [git-tools] Changed pre-commit hook to use sh instead of bash --- git-tools/hooks/pre-commit | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/git-tools/hooks/pre-commit b/git-tools/hooks/pre-commit index 23ab8d6cdb..5f75381155 100755 --- a/git-tools/hooks/pre-commit +++ b/git-tools/hooks/pre-commit @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/bin/sh # # A hook to disallow php syntax errors to be committed # by running php -l (lint) on them. It requires php-cli From 9afe2c9b6e9b414889f8642e719308afa434bc40 Mon Sep 17 00:00:00 2001 From: Oleg Pudeyev Date: Fri, 9 Apr 2010 10:43:54 -0400 Subject: [PATCH 2/3] [git-tools] Adjusted pre-commit hook to run under freebsd /bin/sh. --- git-tools/hooks/pre-commit | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/git-tools/hooks/pre-commit b/git-tools/hooks/pre-commit index 5f75381155..835b28aec3 100755 --- a/git-tools/hooks/pre-commit +++ b/git-tools/hooks/pre-commit @@ -27,7 +27,10 @@ fi error=0 errors="" -IFS=$'\n' +# dash does not support $'\n': +# http://forum.soft32.com/linux2/Bug-409179-DASH-Settings-IFS-work-properly-ftopict70039.html +IFS=' +' # get a list of staged files for line in $(git diff-index --cached --full-index $against) do @@ -59,7 +62,7 @@ do then error=1 # Swap back in correct filenames - errors+=${result//in - on/"$filename"} + errors=$(echo "$errors"; echo "$result" |sed -e "s:in - on:in $filename on:g") fi done unset IFS From 9674214b2ffd3fc98e707ffa8f9b8b9eaef054da Mon Sep 17 00:00:00 2001 From: Oleg Pudeyev Date: Sat, 10 Apr 2010 05:43:26 -0400 Subject: [PATCH 3/3] [git-tools] Use @ instead of : in sed command in pre-commit hook for wider compatibility. --- git-tools/hooks/pre-commit | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/git-tools/hooks/pre-commit b/git-tools/hooks/pre-commit index 835b28aec3..9719b91746 100755 --- a/git-tools/hooks/pre-commit +++ b/git-tools/hooks/pre-commit @@ -62,7 +62,7 @@ do then error=1 # Swap back in correct filenames - errors=$(echo "$errors"; echo "$result" |sed -e "s:in - on:in $filename on:g") + errors=$(echo "$errors"; echo "$result" |sed -e "s@in - on@in $filename on@g") fi done unset IFS