Skip to content

Commit

Permalink
Updated pre-commit check; fixed bug.
Browse files Browse the repository at this point in the history
  • Loading branch information
nstbayless committed Aug 27, 2017
1 parent 0bc46ca commit 7fba3eb
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions hooks/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,16 @@ then
exit 2;
fi

echo "Checking if patch is up-to-date..."

# generate patch
./make-patch.sh .patch-prev.ips
./make-patch.sh .patch-prev.ips >/dev/null

if [ ! $? -eq 0 ]
then
chmod +wrx .patch-prev.ips
rm .patch-prev.ips
echo "Unable to generate a patch for comparison"
exit 2;
fi

Expand All @@ -33,15 +36,17 @@ test=`diff patch.ips .patch-prev.ips`
chmod +wrx .patch-prev.ips
rm .patch-prev.ips

if [ ! -z test ]
if [ ! -z $test ]
then
echo "Cannot commit while patch.ips is not up-to-date!"
echo "(Either run ./apply.sh to bring patch.ips up to date, or commit again with --no-verify)"
exit 1;
fi

echo "Patch is up to date."

# pause to read input if successful:
sleep 0.5
sleep 0.1

exit 0

;

0 comments on commit 7fba3eb

Please sign in to comment.