From a68da1f03c501a615c4e5c5ffc102222a04704de Mon Sep 17 00:00:00 2001 From: rpolzer Date: Mon, 4 Oct 2010 12:13:01 +0200 Subject: [PATCH] support a separate push URL --- all | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) 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" -- 2.39.2