3 Existing=`cat .patchnum 2>/dev/null`
4 Existing_Sha1=`cat .sha1 2>/dev/null`
5 if [ -e ".patch" ]; then
6 Current=`awk '{print $4}' .patch`
7 Sha1=`awk '{print $3}' .patch`
8 elif [ -d ".git" ]; then
9 # we should do something better here
10 Current=`git describe`
11 Sha1=`git rev-parse HEAD`
12 Changed=`git diff-index --name-only HEAD`
13 [ -n "$Changed" ] && Current="$Current-with-uncommitted-changes"
16 if [ "$Existing" != "$Current" -o "$Existing_Sha1" != "$Sha1" ]; then
17 echo "Updating .patchnum and .sha1"
18 echo -n $Current > .patchnum
21 echo "Reusing .patchnum and .sha1"