make it right

This commit is contained in:
Jakobus Schürz 2020-10-28 22:11:53 +01:00
parent d31e043303
commit 485ae9656a

View file

@ -84,25 +84,29 @@ fi
if ${MYSHELLCONFIG_GIT_SUBMODULES_UPDATE-${MYSHELLCONFIG_GIT_SUBMODULES_UPDATE_DEFAULT-true}}; then if ${MYSHELLCONFIG_GIT_SUBMODULES_UPDATE-${MYSHELLCONFIG_GIT_SUBMODULES_UPDATE_DEFAULT-true}}; then
logdebug "update submodules" logdebug "update submodules"
rc=0 rc=0
srv="${MYSHELLCONFIG_GIT_SUBMODULES_SERVER-${MYSHELLCONFIG_GIT_SUBMODULES_SERVER_DEFAULT}}" # srv="${MYSHELLCONFIG_GIT_SUBMODULES_SERVER-${MYSHELLCONFIG_GIT_SUBMODULES_SERVER_DEFAULT}}"
logwarn "srv $srv" # logwarn "srv $srv"
$SGIT config --file=.gitmodules -l | \ # $SGIT config --file=.gitmodules -l | \
grep url= | \ # grep url= | \
awk -F "=" -v srv="${srv%/}${srv:+/}" \ # awk -F "=" -v srv="${srv%/}${srv:+/}" \
'{gsub(/^.*github.com\//,srv,$2); print $1" "$2}' | \ # '{gsub(/^.*github.com\//,srv,$2); print $1" "$2}' | \
while read a b; do # while read a b; do
logdebug "$SGIT config --file=.gitmodules ${a} ${b}" # logdebug "$SGIT config --file=.gitmodules ${a} ${b}"
$SGIT config --file=.gitmodules "${a}" "${b}" # $SGIT config --file=.gitmodules "${a}" "${b}"
done # 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; }
logdebug "$($SGIT submodule sync)" || { 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 --init --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; }
$SGIT submodule update --init --remote --merge 1>>"${MYSHELLCONFIG_LOGFILE}" 2>&1 || { logwarn " update submodules failed on update"; rc=9; }
$SGIT checkout .gitmodules # run git submodule sync only ich local repo should use submodule urls from main-project
# so don't use it here
# logdebug "$($SGIT submodule sync)" || { logwarn "sync submodules failed on sync"; rc=6; }
logdebug "$($SGIT submodule update --init --recursive)"
#$SGIT submodule update --init --remote --merge 1>>"${MYSHELLCONFIG_LOGFILE}" 2>&1 || { logwarn " update submodules failed on update"; rc=9; }
#$SGIT checkout .gitmodules
logdebug "submodules updated successfully" >&2 logdebug "submodules updated successfully" >&2
else else