Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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 aef3dd4
Showing 1 changed file with 7 additions and 16 deletions.
23 changes: 7 additions & 16 deletions scripts/prepare-commit.sh
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit aef3dd4

Please sign in to comment.