Skip to content
Permalink
Browse files

remove svn references from prepare-commit.sh and make it work from an…

…ywhere in the repository
  • Loading branch information
jef-n committed May 26, 2016
1 parent d4802e5 commit aef3dd4da4fd14ef4664c31e578a69c7e95c063d
Showing with 7 additions and 16 deletions.
  1. +7 −16 scripts/prepare-commit.sh
@@ -14,8 +14,11 @@
# #
###########################################################################

TOPLEVEL=$(git rev-parse --show-toplevel)

PATH=$(git rev-parse --show-toplevel)/scripts:$PATH
PATH=$TOPLEVEL/scripts:$PATH

cd $TOPLEVEL

if ! type -p astyle.sh >/dev/null; then
echo astyle.sh not found
@@ -37,28 +40,16 @@ fi
set -e

# determine changed files
if [ -d .svn ]; then
MODIFIED=$(svn status | sed -ne "s/^[MA] *//p")
elif [ -d .git ]; then
MODIFIED=$(git status --porcelain| sed -ne "s/^ *[MA] *//p" | sort -u)
else
echo No working copy
exit 1
fi
MODIFIED=$(git status --porcelain| sed -ne "s/^ *[MA] *//p" | sort -u)

if [ -z "$MODIFIED" ]; then
echo nothing was modified
exit 0
fi

# save original changes
if [ -d .svn ]; then
REV=r$(svn info | sed -ne "s/Revision: //p")
svn diff >rev-$REV.diff
elif [ -d .git ]; then
REV=$(git log -n1 --pretty=%H)
git diff >sha-$REV.diff
fi
REV=$(git log -n1 --pretty=%H)
git diff >sha-$REV.diff

ASTYLEDIFF=astyle.$REV.diff
>$ASTYLEDIFF

0 comments on commit aef3dd4

Please sign in to comment.
You can’t perform that action at this time.