commit 7f54166fb1c118516f840158d03351b5a8970b53
Author: Simó Albert i Beltran <sim6@probeta.net>
Date:   Fri May 3 00:57:41 2013 +0200

    Add is_up_to_date rule in Makefile to check if qmp repository is up to date and to be used by nightlycompile.sh. Closes #238

diff --git a/Makefile b/Makefile
index 32bb4fa..eca07ea 100644
--- a/Makefile
+++ b/Makefile
@@ -170,6 +170,14 @@ define target_error
 	@exit 1
 endef
 
+define get_git_local_revision
+	git rev-parse origin/$1
+endef
+
+define get_git_remote_revision
+	git ls-remote origin $1 | awk 'NR==1{print $$1}'
+endef
+
 all: build
 
 .checkout_qmp:
@@ -250,3 +258,5 @@ build: checkout sync_config
 	$(if $(TARGET),$(call build_src))
 	$(call post_build)
 
+is_up_to_date:
+	cd $(BUILD_DIR)/qmp && test "$$($(call get_git_local_revision,$(QMP_GIT_BRANCH)))" == "$$($(call get_git_remote_revision,$(QMP_GIT_BRANCH)))"
diff --git a/nightlycompile.sh b/nightlycompile.sh
index 24b9a15..fa01717 100755
--- a/nightlycompile.sh
+++ b/nightlycompile.sh
@@ -22,7 +22,7 @@ DAYS_TO_PRESERVE="10"
 [ -z "$FORCE" ] && FORCE=0
 
 [ $FORCE -eq 0 ] && {
-	if (cd build/qmp && git diff-index --quiet HEAD --)
+	if make is_up_to_date QMP_GIT_BRANCH=$BRANCH >& /dev/null
 	   then
 	   echo "Nothing to compile, qMp in last version"
 	   exit 0
