From: Jean Guyader Date: Tue, 17 Nov 2009 16:02:23 +0000 (+0000) Subject: buildroot: Add git pull script. X-Git-Url: http://xenbits.xen.org/gitweb?a=commitdiff_plain;h=0eb05feb3fdb9421b027f47210fffdd1716e6594;p=xenclient%2Fbuild.git buildroot: Add git pull script. --- diff --git a/project/Makefile.in b/project/Makefile.in index d615b63..69c38ab 100644 --- a/project/Makefile.in +++ b/project/Makefile.in @@ -99,4 +99,5 @@ VENDOR_PATCH_DIR:=$(strip $(subst ",,$(BR2_VENDOR_PATCH_DIR))) #")) GIT_CHECKOUT="$(BASE_DIR)/scripts/git_checkout.sh" +GIT_PULL="$(BASE_DIR)/scripts/git_pull.sh" diff --git a/scripts/git_pull.sh b/scripts/git_pull.sh new file mode 100755 index 0000000..492b750 --- /dev/null +++ b/scripts/git_pull.sh @@ -0,0 +1,32 @@ +#! /bin/sh + +path="$1" + +git_head() +{ + ( cd "$path" && git-rev-list HEAD | head -n 1) +} + + +git_pull() +{ + pushd "$path" + if [ -d ".git/patches/master" ]; then + guilt-pop -a + ( cd ".git/patches/master" && git pull) + fi + + git pull + + [ -d ".git/patches/master" ] && guilt-push -a + + popd +} + +head=`git_head` +git_pull +new_head=`git_head` + +[ "$head" == "$new_head" ] && exit 0 + +exit 1