diff --git a/misc/pre-commit.githook b/misc/pre-commit.githook deleted file mode 100755 index f6f9c0e24..000000000 --- a/misc/pre-commit.githook +++ /dev/null @@ -1,61 +0,0 @@ -#!/usr/bin/env sh - -mode=${1:-"precommit"} -exitstatus=0 - -#third_party imports. -cd third_party -rewrite=`./rewrite-imports.sh -l` -cd .. -if [ -n "$rewrite" ] -then - exitstatus=1 - for r in $rewrite - do - echo $r - done - echo "The above need their imports to be fixed. Use third_party/rewrite-imports.sh -w" -fi - -#gofmt and trailing space errors -committed=`git diff-index --cached --name-only HEAD` -needFmt="" -for c in $committed -do - if [ ! -e "$c" ] - then - continue - fi - gofile=`echo $c | grep -E '.*\.go$'` - javafile=`echo $c | grep -E '.*\.java$'` - if [ -n "$gofile" ] - then - fmtdiff=`git show ":$c" | gofmt -d 2>&1` - if [ -n "$fmtdiff" ] - then - needFmt="$needFmt $gofile" - exitstatus=1 - fi - fi - if [ -n "$gofile" -o -n "$javafile" ] - then - trailspace=`git diff-index --cached --check HEAD $c | grep 'trailing whitespace'` - if [ -n "$trailspace" ] - then - echo $trailspace - exitstatus=1 - fi - fi -done -if [ "$exitstatus" -ne 0 ] -then - if [ -n "$needFmt" ] - then - echo "gofmt -w $needFmt" - fi - if [ "$mode" != "test" ]; then - echo "You can override this check with 'git commit --no-verify'" - fi -fi - -exit $exitstatus diff --git a/third_party/rewrite-imports.sh b/third_party/rewrite-imports.sh deleted file mode 100755 index c88946974..000000000 --- a/third_party/rewrite-imports.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/sh - -#TODO(mpl): patch github.com/cznic/zappy on the fly to make it pure Go. -if [ "$1" = "-l" ] -then - find . -type f -name '*.go' -exec grep -E -l '"code.google.com/' {} \; - find . -type f -name '*.go' -exec grep -E -l '"launchpad.net/' {} \; - find . -type f -name '*.go' -exec grep -E -l '"github.com/' {} \; - find . -type f -name '*.go' -exec grep -E -l '"labix.org/' {} \; - find . -type f -name '*.go' -exec grep -E -l '"bazil.org/' {} \; - find . -type f -name '*.go' -exec grep -E -l '"golang.org/' {} \; - find . -type f -name '*.go' -exec grep -E -l '"google.golang.org/' {} \; -elif [ "$1" = "-w" ] -then - find . -type f -name '*.go' -exec perl -pi -e 's!"code.google.com/!"camlistore.org/third_party/code.google.com/!' {} \; - find . -type f -name '*.go' -exec perl -pi -e 's!"launchpad.net/!"camlistore.org/third_party/launchpad.net/!' {} \; - find . -type f -name '*.go' -exec perl -pi -e 's!"github.com/!"camlistore.org/third_party/github.com/!' {} \; - find . -type f -name '*.go' -exec perl -pi -e 's!"labix.org/!"camlistore.org/third_party/labix.org/!' {} \; - find . -type f -name '*.go' -exec perl -pi -e 's!"bazil.org/!"camlistore.org/third_party/bazil.org/!' {} \; - find . -type f -name '*.go' -exec perl -pi -e 's!"golang.org/!"camlistore.org/third_party/golang.org/!' {} \; - find . -type f -name '*.go' -exec perl -pi -e 's!"google.golang.org/!"camlistore.org/third_party/google.golang.org/!' {} \; -else - cat << heredoc -usage: rewrite-imports.sh -l|-w" - -l: list files where a rewrite is needed" - -w: actually performs the rewrite" -heredoc -fi