[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
Fri Apr 15 09:07:30 CDT 2011


branch "master" has been updated
       via  e9e090742cf56187981e61df3117280b29f4f761 (commit)
       via  02166802104cc1b5205b60f1a0b0ecb70d1a368e (commit)
       via  4f767218af3a0c68e162e38ad6767effcf80ec9a (commit)
       via  b0324a700966b67f78bbe0325d9c63bdb3279de4 (commit)
       via  2e15a17246200b6c94470e2aa94778962a38d38a (commit)
      from  2712c77fdffd8ea1c46fbf62a3cb85eda89ceb74 (commit)

Summary of changes:
 gitall-asterisk-scf.sh |   66 ++++++++++++++++++++++++++++++-----------------
 1 files changed, 42 insertions(+), 24 deletions(-)


- Log -----------------------------------------------------------------
commit e9e090742cf56187981e61df3117280b29f4f761
Author: Kevin P. Fleming <kpfleming at digium.com>
Date:   Fri Apr 15 09:06:09 2011 -0500

    Remove spurious argument being passed to ssh-add, which causes an error message
    to be generated.

diff --git a/gitall-asterisk-scf.sh b/gitall-asterisk-scf.sh
index 9e37f86..0427aa2 100755
--- a/gitall-asterisk-scf.sh
+++ b/gitall-asterisk-scf.sh
@@ -278,7 +278,7 @@ if test ${SSH_AUTH_SOCK-no} = no && test "${GIT_SSH-no}" = no; then
     eval `ssh-agent`
 
     echo "SSH_AGENT_PID = ${SSH_AGENT_PID}"
-    exec `ssh-add ${1}`
+    exec `ssh-add`
     export kill_agent=yes
 fi
 

commit 02166802104cc1b5205b60f1a0b0ecb70d1a368e
Author: Kevin P. Fleming <kpfleming at digium.com>
Date:   Fri Apr 15 09:00:34 2011 -0500

    Instead of using subshells to change directories before executing git commands,
    use --git-dir and --work-tree arguments to tell git where the relevant content
    lives. This makes the script execute faster on Windows.
    
    In addition, use 'git remote set-url' instead of 'git config remote...' where
    it's an easy replacement.

diff --git a/gitall-asterisk-scf.sh b/gitall-asterisk-scf.sh
index c1d0ec3..9e37f86 100755
--- a/gitall-asterisk-scf.sh
+++ b/gitall-asterisk-scf.sh
@@ -177,19 +177,18 @@ EOF
 
             if [ -d ${repoDir}/.git ]; then
                 # update the origin to what is specified in repoUri
-                ( cd ${repoDir} && git config remote.origin.url ${repoUri} )
-                ( cd ${repoDir} && if test ${gitdepot_push}; then
-                        git config remote.origin.pushurl ${repoPushUri};
-                    else
-                        git config --unset remote.origin.pushurl
-                    fi )
-                if ( cd ${repoDir} && git rev-parse --verify @{upstream} > /dev/null 2>&1 ); then
-                    upstream=$(
-                        cd ${repoDir} &&
-                        git for-each-ref --format="%(upstream:short)" \
-                            $(git rev-parse --symbolic-full-name HEAD))
+                git --git-dir=${repoDir}/.git remote set-url ${repoUri}
+                if test ${gitdepot_push}; then
+                    git --git-dir=${repoDir}/.git remote set-url --push ${repoPushUri}
+                else
+		    # we really should use 'git remote set-url --delete' here, but coming up
+		    # with the proper regex syntax for the URL to be match seems to be difficult
+                    git --git-dir=${repoDir}/.git config --unset remote.origin.pushurl
+                fi
+                if git --git-dir=${repoDir}/.git rev-parse --verify @{upstream} > /dev/null 2>&1; then
+                    upstream=$(git --git-dir=${repoDir}/.git for-each-ref --format="%(upstream:short)" $(git --git-dir=${repoDir}/.git rev-parse --symbolic-full-name HEAD))
                     echo ">> Pulling from ${upstream} (${repoDir})"
-                    ( cd ${repoDir} && git pull )
+                    git --work-tree=${repoDir} --git-dir=${repoDir}/.git pull
                 else
                     echo "-- Skipping ${repoDir}; no upstream branch"
                 fi
@@ -226,7 +225,7 @@ function passthrough()
 	    local -a replace_push=(${replace_pull[@]/PUSH/${gitdepot_push}})
 	    local -a gitargs=(${replace_push[@]})
             echo ">> git" "${gitargs[@]}" "(${repoName})"
-            ( cd ${repoDir} && git "${gitargs[@]}" )
+            git --work-tree=${repoDir} --git-dir=${repoDir}/.git "${gitargs[@]}"
             if test $? -ne 0; then
                 echo >&2
                 echo "!! Failed to '$1' ${repoName}." >&2
@@ -246,7 +245,7 @@ function dry_run()
             echo "!! Repo ${repoName} not yet cloned" >&2
             exit 1
         fi
-        ( cd ${repoDir} && git "$@" --dry-run --quiet )
+        git --work-tree=${repoDir} --git-dir=${RepoDir}/.git "$@" --dry-run --quiet
         if test $? -ne 0; then
             echo >&2
             echo "!! Would fail to '$1' ${repoName}." >&2
@@ -260,7 +259,7 @@ function dry_run()
             repoDir=$(basename ${repo})
             repoName=$(basename "$(cd ${repoDir} && pwd)")
             echo ">> git" "$@" "(${repoName})"
-            ( cd ${repoDir} && git "$@" )
+            git --work-tree=${repoDir} --git-dir=${RepoDir}/.git "$@"
             if test $? -ne 0; then
                 echo "!! Failed to 'push' ${repoName}." >&2
                 exit 1

commit 4f767218af3a0c68e162e38ad6767effcf80ec9a
Author: Kevin P. Fleming <kpfleming at digium.com>
Date:   Thu Apr 14 15:06:25 2011 -0500

    Use the name of the origin URL instead of the local directory name when
    substituting the REPO keyword in passthrough command arguments.

diff --git a/gitall-asterisk-scf.sh b/gitall-asterisk-scf.sh
index 7b72600..c1d0ec3 100755
--- a/gitall-asterisk-scf.sh
+++ b/gitall-asterisk-scf.sh
@@ -220,7 +220,8 @@ function passthrough()
                 echo "!! Repo ${repoName} not yet cloned" >&2
                 exit 1
             fi
-	    local -a replace_repo=(${@/REPO/${repoName}})
+	    originRepo=$(basename "$(git --git-dir=${repoDir}/.git config --get remote.origin.url)")
+	    local -a replace_repo=(${@/REPO/${originRepo}})
 	    local -a replace_pull=(${replace_repo[@]/PULL/${gitdepot_pull}})
 	    local -a replace_push=(${replace_pull[@]/PUSH/${gitdepot_push}})
 	    local -a gitargs=(${replace_push[@]})

commit b0324a700966b67f78bbe0325d9c63bdb3279de4
Author: Kevin P. Fleming <kpfleming at digium.com>
Date:   Thu Apr 14 13:38:31 2011 -0500

    Correct error in keyword replacement.

diff --git a/gitall-asterisk-scf.sh b/gitall-asterisk-scf.sh
index a5206b4..7b72600 100755
--- a/gitall-asterisk-scf.sh
+++ b/gitall-asterisk-scf.sh
@@ -222,7 +222,7 @@ function passthrough()
             fi
 	    local -a replace_repo=(${@/REPO/${repoName}})
 	    local -a replace_pull=(${replace_repo[@]/PULL/${gitdepot_pull}})
-	    local -a replace_push=(${replace_repo[@]/PUSH/${gitdepot_push}})
+	    local -a replace_push=(${replace_pull[@]/PUSH/${gitdepot_push}})
 	    local -a gitargs=(${replace_push[@]})
             echo ">> git" "${gitargs[@]}" "(${repoName})"
             ( cd ${repoDir} && git "${gitargs[@]}" )

commit 2e15a17246200b6c94470e2aa94778962a38d38a
Author: Kevin P. Fleming <kpfleming at digium.com>
Date:   Thu Apr 14 13:21:39 2011 -0500

    Add passthrough support for stash, checkout and commit.
    
    Add magic keyword support for arguments to passthrough commands.

diff --git a/gitall-asterisk-scf.sh b/gitall-asterisk-scf.sh
index 56f001d..a5206b4 100755
--- a/gitall-asterisk-scf.sh
+++ b/gitall-asterisk-scf.sh
@@ -15,13 +15,26 @@ Options:
 
 Commands:
    pull, push, tag, status, branch, diff, submodule, fetch, remote, gc, fsck,
-   log, grep
+   log, grep, stash, checkout, commit
 
    Pull will detect missing repos and clone as necessary.
    Other than pull, all commands accept normal git options.
    Push tries to be safe by running --dry-run prior to the actual push.
      Still recommend *serious* paranoia when running this command.
 
+   All 'passthrough' commands can include keywords in their arguments that will
+   be substituted as the command is executed for each repository:
+      REPO - name of the repository being processed
+      PULL - the base of the git URI used for pulling the gitall repo
+             (including the final separator character)
+      PUSH - the base of the git URI used for pushing the gitall repo
+             (including the final separator character)
+
+   These can be used in various ways; as an example, here is a simple command
+   to add a git 'remote' to each repository that points to developer "john's"
+   clone of the repo:
+       $ gitall-asterisk-scf.sh remote add john PUSHteam/john/REPO
+
 If no command is given, pull is run by default.
 EOF
 }
@@ -49,8 +62,9 @@ function collapse()
     echo "${head}"
 }
 
-gitdepot=`git config --get remote.origin.url | sed "s at asterisk-scf/integration/gitall.*@@"`
+gitdepot_pull=`git config --get remote.origin.url | sed "s at asterisk-scf/integration/gitall.*@@"`
 gitdepot_push=`git config --get remote.origin.pushurl | sed "s at asterisk-scf/integration/gitall.*@@"`
+gitdepot_push=${gitdepot_push:-${gitdepot_pull}}
 
 # tree should probably be set by menu prompts or command line args
 # one day
@@ -73,7 +87,7 @@ cmd=pull
 
 while test $# -gt 0; do
     case $1 in
-        tag|status|branch|diff|submodule|fetch|remote|gc|fsck|log|grep)
+        tag|status|branch|diff|submodule|fetch|remote|gc|fsck|log|grep|stash|checkout|commit)
             cmd=passthrough
             break
             ;;
@@ -158,7 +172,7 @@ EOF
     for repo in "${repos[@]}"; do
         {
             repoDir=$(basename ${repo})
-            repoUri=${gitdepot}${tree}/${repo}
+            repoUri=${gitdepot_pull}${tree}/${repo}
             repoPushUri=${gitdepot_push}${tree}/${repo}
 
             if [ -d ${repoDir}/.git ]; then
@@ -206,11 +220,15 @@ function passthrough()
                 echo "!! Repo ${repoName} not yet cloned" >&2
                 exit 1
             fi
-            echo ">> git" "$@" "(${repoName})"
-            ( cd ${repoDir} && git "$@" )
+	    local -a replace_repo=(${@/REPO/${repoName}})
+	    local -a replace_pull=(${replace_repo[@]/PULL/${gitdepot_pull}})
+	    local -a replace_push=(${replace_repo[@]/PUSH/${gitdepot_push}})
+	    local -a gitargs=(${replace_push[@]})
+            echo ">> git" "${gitargs[@]}" "(${repoName})"
+            ( cd ${repoDir} && git "${gitargs[@]}" )
             if test $? -ne 0; then
                 echo >&2
-                echo "!! Failed to $1 ${repoName}." >&2
+                echo "!! Failed to '$1' ${repoName}." >&2
                 exit 1
             fi
         } 2>&1 | collapse
@@ -230,7 +248,7 @@ function dry_run()
         ( cd ${repoDir} && git "$@" --dry-run --quiet )
         if test $? -ne 0; then
             echo >&2
-            echo "!! Would fail to $1 ${repoName}." >&2
+            echo "!! Would fail to '$1' ${repoName}." >&2
             exit 1
         fi
     done
@@ -243,7 +261,7 @@ function dry_run()
             echo ">> git" "$@" "(${repoName})"
             ( cd ${repoDir} && git "$@" )
             if test $? -ne 0; then
-                echo "!! Failed to push ${repoName}." >&2
+                echo "!! Failed to 'push' ${repoName}." >&2
                 exit 1
             fi
         } 2>&1 | collapse

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


-- 
asterisk-scf/integration/gitall.git



More information about the asterisk-scf-commits mailing list