configure repo for submodules via env
This commit is contained in:
parent
669aa9ecf1
commit
36d1f1f112
2 changed files with 13 additions and 4 deletions
|
@ -40,6 +40,7 @@ if [[ $- = *i* ]] ; then
|
||||||
[ -z "${MYSHELLCONFIG_GIT_CHECKOUT_TIMEOUT+x}" ] && export MYSHELLCONFIG_GIT_CHECKOUT_TIMEOUT=20s
|
[ -z "${MYSHELLCONFIG_GIT_CHECKOUT_TIMEOUT+x}" ] && export MYSHELLCONFIG_GIT_CHECKOUT_TIMEOUT=20s
|
||||||
[ -z "${MYSHELLCONFIG_GIT_SYNC+x}" ] && export MYSHELLCONFIG_GIT_SYNC=true
|
[ -z "${MYSHELLCONFIG_GIT_SYNC+x}" ] && export MYSHELLCONFIG_GIT_SYNC=true
|
||||||
[ -z "${MYSHELLCONFIG_GIT_UPDATE_SUBMODULES_DEFAULT+x}" ] && export MYSHELLCONFIG_GIT_UPDATE_SUBMODULES_DEFAULT=true
|
[ -z "${MYSHELLCONFIG_GIT_UPDATE_SUBMODULES_DEFAULT+x}" ] && export MYSHELLCONFIG_GIT_UPDATE_SUBMODULES_DEFAULT=true
|
||||||
|
[ -z "${MYSHElLCONFIG_GIT_SUBMODULE_SERVER_DEFUALt+x}" ] && export MYSHElLCONFIG_GIT_SUBMODULE_SERVER_DEFAULT="git://git.schuerz.at/github.com"
|
||||||
# hardcoded git
|
# hardcoded git
|
||||||
export SGIT="git -C ${MYSHELLCONFIG_BASE}"
|
export SGIT="git -C ${MYSHELLCONFIG_BASE}"
|
||||||
|
|
||||||
|
|
|
@ -86,12 +86,20 @@ logdebug "update submodules"
|
||||||
rc=0
|
rc=0
|
||||||
|
|
||||||
logdebug "update submodules" >&2
|
logdebug "update submodules" >&2
|
||||||
|
git config --file=.gitmodules -l | \
|
||||||
|
grep url= | \
|
||||||
|
awk -F "=" -v srv="${MYSHElLCONFIG_GIT_SUBMODULE_SERVER-${MYSHElLCONFIG_GIT_SUBMODULE_SERVER_DEFAULT}" \
|
||||||
|
'{print $1" "gensub(/^.*github.com/,srv,$2)}' | \
|
||||||
|
while read a b; do
|
||||||
|
echo git config --file=.gitmodules "${a}" "${b}"
|
||||||
|
done
|
||||||
|
|
||||||
# Submodules always have origin and master as repo and branch to track
|
# Submodules always have origin and master as repo and branch to track
|
||||||
$SGIT submodule init 1>>"${MYSHELLCONFIG_LOGFILE}" 2>&1|| { logwarn "update submodules failed on ini"; rc=5; }
|
#$SGIT submodule init 1>>"${MYSHELLCONFIG_LOGFILE}" 2>&1|| { logwarn "update submodules failed on ini"; rc=5; }
|
||||||
$SGIT submodule sync 1>>"${MYSHELLCONFIG_LOGFILE}" 2>&1|| { logwarn "sync submodules failed on sync"; rc=6; }
|
$SGIT submodule sync 1>>"${MYSHELLCONFIG_LOGFILE}" 2>&1|| { logwarn "sync submodules failed on sync"; rc=6; }
|
||||||
$SGIT submodule foreach "git checkout master" 1>>"${MYSHELLCONFIG_LOGFILE}" 2>&1 || { logwarn "checkout master submodules failed on set upstream"; rc=7; }
|
#$SGIT submodule foreach "git checkout master" 1>>"${MYSHELLCONFIG_LOGFILE}" 2>&1 || { logwarn "checkout master submodules failed on set upstream"; rc=7; }
|
||||||
$SGIT submodule foreach "git branch -u origin/master master" 1>>"${MYSHELLCONFIG_LOGFILE}" 2>&1|| { logwarn "set-upstream submodules failed on set upstream"; rc=8; }
|
#$SGIT submodule foreach "git branch -u origin/master master" 1>>"${MYSHELLCONFIG_LOGFILE}" 2>&1|| { logwarn "set-upstream submodules failed on set upstream"; rc=8; }
|
||||||
$SGIT submodule update --recursive --remote --merge 1>>"${MYSHELLCONFIG_LOGFILE}" 2>&1 || { logwarn " update submodules failed on update"; rc=9; }
|
$SGIT submodule update --init --recursive --remote --merge 1>>"${MYSHELLCONFIG_LOGFILE}" 2>&1 || { logwarn " update submodules failed on update"; rc=9; }
|
||||||
logdebug "submodules updated" >&2
|
logdebug "submodules updated" >&2
|
||||||
|
|
||||||
logdebug "update submodules ENDE"
|
logdebug "update submodules ENDE"
|
||||||
|
|
Loading…
Reference in a new issue