[asterisk-scf-commits] asterisk-scf/integration/gitall.git branch "master" updated.

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Thu Oct 7 09:38:31 CDT 2010


branch "master" has been updated
       via  e0a03af528e4d223862b2a65945fdd867517bb95 (commit)
      from  57fbea191261e8da84bc34318283880bbe3f84c1 (commit)

Summary of changes:
 gitall-asterisk-scf.sh |   35 +++++++++++++++++++++++++++++++----
 1 files changed, 31 insertions(+), 4 deletions(-)


- Log -----------------------------------------------------------------
commit e0a03af528e4d223862b2a65945fdd867517bb95
Author: David M. Lee <dlee at digium.com>
Date:   Thu Oct 7 08:22:30 2010 -0500

    Auto-pull the gitall repo, when possible.

diff --git a/gitall-asterisk-scf.sh b/gitall-asterisk-scf.sh
index 4e88f3c..5856a19 100755
--- a/gitall-asterisk-scf.sh
+++ b/gitall-asterisk-scf.sh
@@ -1,7 +1,7 @@
 #!/bin/bash
 
 #Usage:
-# 
+#
 # getAsterskScf.sh
 #
 
@@ -16,12 +16,38 @@ if test ${SSH_AUTH_SOCK-no} = no; then
 
    echo "SSH_AGENT_PID = ${SSH_AGENT_PID}"
    exec `ssh-add ${1}`
-   kill_agent=yes
+   export kill_agent=yes
+fi
+
+# check to see if gitall needs a pull
+echo ">> Fetching gitall"
+git fetch --all
+echo
+
+# if there is an upstream branch, and it has changes we don't
+if git rev-parse --verify @{upstream} > /dev/null 2>&1 &&
+   ! test -z "$(git log ^HEAD @{upstream})"; then
+   # We can't just git pull, because that would modify the running script,
+   # which tends to upset bash.  So we'll exec out to the git pull, and try
+   # this script again.
+   #
+   # DONT_PULL_GITALL is a recursion guard, in case of git weirdness.
+   if test ${DONT_PULL_GITALL-no} = no; then
+      echo ">> Updating gitall"
+      exec bash -c "git pull && DONT_PULL_GITALL=yes $0"
+   else
+      cat <<EOF >&2
+
+Cowardly refusing to pull gitall repo and re-run $0.
+Run git pull and try again.
+EOF
+      exit 1
+   fi
 fi
 
 gitdepot=git at git.asterisk.org
 
-# tree should probably be set by menu prompts or command line args 
+# tree should probably be set by menu prompts or command line args
 # one day
 tree=asterisk-scf
 
@@ -46,7 +72,7 @@ for repo in "${repos[@]}"; do
       echo ">> Cloning from $repoUri to ${repo[i]}"
       git clone --recursive ${repoUri} ${repoDir}
    fi
-   echo " "   
+   echo " "
 done
 
 if [ ! -d pjproject ]; then
@@ -59,5 +85,6 @@ if [ ! -d pjproject ]; then
 fi
 
 if test ${kill_agent-no} != no; then
+   echo "killing ssh-agent"
    kill $SSH_AGENT_PID
 fi

-----------------------------------------------------------------------


-- 
asterisk-scf/integration/gitall.git



More information about the asterisk-scf-commits mailing list