From: rpolzer Date: Mon, 4 Oct 2010 10:13:01 +0000 (+0200) Subject: support a separate push URL X-Git-Tag: xonotic-v0.1.0preview~152 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=a68da1f03c501a615c4e5c5ffc102222a04704de;p=xonotic%2Fxonotic.git support a separate push URL --- diff --git a/all b/all index 607db563..8f4d25b7 100755 --- a/all +++ b/all @@ -134,6 +134,18 @@ case "$base" in exit 1 ;; esac +pushbase=`git config remote.origin.pushurl || true` +case "$pushbase" in + */xonotic.git) + pushbase=${pushbase%xonotic.git} + ;; + '') + ;; + *) + echo "The main repo is not xonotic.git, what have you done?" + exit 1 + ;; +esac repourl() { @@ -156,6 +168,27 @@ repourl() fi } +repopushurl() +{ + [ -n "$pushbase" ] || return 0 + repo_t=`echo "$repos_urls" | grep "^$1 " | cut -d '|' -f 2 | tr -d ' '` + if [ -n "$repo_t" ]; then + case "$repo_t" in + *://*) + ;; + *) + echo "$pushbase$repo_t" + ;; + esac + else + if [ x"$1" = x"." ]; then + echo "$pushbase""xonotic.git" + else + echo "$pushbase${1##*/}.git" + fi + fi +} + repobranch() { repo_t=`echo "$repos_urls" | grep "^$1 " | cut -d '|' -f 3 | tr -d ' '` @@ -302,12 +335,18 @@ case "$cmd" in fi for d in $repos; do url=`repourl "$d"` + pushurl=`repopushurl "$d"` branch=`repobranch "$d"` if [ -d "$d0/$d" ]; then if $allow_pull; then enter "$d0/$d" verbose fix_git_config verbose git config remote.origin.url "$url" + if [ -n "$pushurl" ]; then + verbose git config --unset remote.origin.pushurl + else + verbose git config remote.origin.pushurl "$pushurl" + fi verbose git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*" r=`git symbolic-ref HEAD` r=${r#refs/heads/} @@ -331,6 +370,11 @@ case "$cmd" in else verbose git clone "$url" "$d0/$d" enter "$d0/$d" verbose + if [ -n "$pushurl" ]; then + verbose git config --unset remote.origin.pushurl + else + verbose git config remote.origin.pushurl "$pushurl" + fi fix_git_config if [ "$branch" != "master" ]; then verbose git checkout --track -b "$branch" origin/"$branch"