Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
remove svn references from prepare-commit.sh and make it work from an…
…ywhere in the repository
- Loading branch information
Showing
with
7 additions
and
16 deletions.
-
+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 |
|
|