Skip to content

Commit aef3dd4

Browse files
committedMay 26, 2016
remove svn references from prepare-commit.sh and make it work from anywhere in the repository
1 parent d4802e5 commit aef3dd4

File tree

1 file changed

+7
-16
lines changed

1 file changed

+7
-16
lines changed
 

‎scripts/prepare-commit.sh

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,11 @@
1414
# #
1515
###########################################################################
1616

17+
TOPLEVEL=$(git rev-parse --show-toplevel)
1718

18-
PATH=$(git rev-parse --show-toplevel)/scripts:$PATH
19+
PATH=$TOPLEVEL/scripts:$PATH
20+
21+
cd $TOPLEVEL
1922

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

3942
# determine changed files
40-
if [ -d .svn ]; then
41-
MODIFIED=$(svn status | sed -ne "s/^[MA] *//p")
42-
elif [ -d .git ]; then
43-
MODIFIED=$(git status --porcelain| sed -ne "s/^ *[MA] *//p" | sort -u)
44-
else
45-
echo No working copy
46-
exit 1
47-
fi
43+
MODIFIED=$(git status --porcelain| sed -ne "s/^ *[MA] *//p" | sort -u)
4844

4945
if [ -z "$MODIFIED" ]; then
5046
echo nothing was modified
5147
exit 0
5248
fi
5349

5450
# save original changes
55-
if [ -d .svn ]; then
56-
REV=r$(svn info | sed -ne "s/Revision: //p")
57-
svn diff >rev-$REV.diff
58-
elif [ -d .git ]; then
59-
REV=$(git log -n1 --pretty=%H)
60-
git diff >sha-$REV.diff
61-
fi
51+
REV=$(git log -n1 --pretty=%H)
52+
git diff >sha-$REV.diff
6253

6354
ASTYLEDIFF=astyle.$REV.diff
6455
>$ASTYLEDIFF

0 commit comments

Comments
 (0)
Please sign in to comment.