# in it.
#
+. $(dirname $0)/functions
+
# Command line
refname="$1"
oldrev="$2"
count=${#follows[@]}
for ((i = 0 ; i < count ; i++)) do
follow="${follows[$i]}"
- git rev-parse "$follow"
+ git rev-parse --verify --quiet "$follow"
if [ $? -eq 0 ] ; then
missing_commits=$(git log ^$newrev $follow --pretty=oneline | wc -l)
if [ $missing_commits -ne 0 ] ; then
- echo "----------------------------------------------------"
- echo
- echo "You need to merge $follow into $short_refname"
- echo
- echo "----------------------------------------------------"
+ # If for some reason people are stupid and push with a --force flag,
+ # we should warn them to update first in case one of their teammates
+ # already merged for them
+ if [ "0000000000000000000000000000000000000000" != "$oldrev" -a "$(git merge-base $oldrev $newrev)" != "$oldrev" ] ; then
+ display_error_message "You need to update your local branch $short_refname"
+ else
+ display_error_message "You need to merge $follow into $short_refname"
+ fi
exit 1
fi
fi