Skip to content

Commit

Permalink
remove svn references from prepare-commit.sh and make it work from an…
Browse files Browse the repository at this point in the history
…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
Original file line number Original file line Diff line number Diff line change
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 if ! type -p astyle.sh >/dev/null; then
echo astyle.sh not found echo astyle.sh not found
Expand All @@ -37,28 +40,16 @@ fi
set -e set -e


# determine changed files # determine changed files
if [ -d .svn ]; then MODIFIED=$(git status --porcelain| sed -ne "s/^ *[MA] *//p" | sort -u)
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


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


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


ASTYLEDIFF=astyle.$REV.diff ASTYLEDIFF=astyle.$REV.diff
>$ASTYLEDIFF >$ASTYLEDIFF
Expand Down

0 comments on commit aef3dd4

Please sign in to comment.