add option to force repoupdate
This commit is contained in:
parent
e95b3328dd
commit
46a8939e75
1 changed files with 44 additions and 38 deletions
|
@ -44,7 +44,11 @@ while [ $# -gt 0 ]; do
|
||||||
PRE="${MSC_GIT_REMOTE_NAME}"
|
PRE="${MSC_GIT_REMOTE_NAME}"
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
-s|--submodules-update)
|
-r|--force-repo-update)
|
||||||
|
dosubmodupdate="true"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-s|--force-submodules-update)
|
||||||
dosubmodupdate="true"
|
dosubmodupdate="true"
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
|
@ -68,7 +72,7 @@ done
|
||||||
if [ $(stat --printf %Y ${MSC_GIT_UPD_SUBMOD_STATFILE} 2>/dev/null || echo 0 ) \
|
if [ $(stat --printf %Y ${MSC_GIT_UPD_SUBMOD_STATFILE} 2>/dev/null || echo 0 ) \
|
||||||
-lt $(date --date="${MSC_GIT_SUBMODULES_UPDATE_INTERVALL-${MSC_GIT_SUBMODULES_UPDATE_INTERVALL_DEFAULT}} hours ago" "+%s") \
|
-lt $(date --date="${MSC_GIT_SUBMODULES_UPDATE_INTERVALL-${MSC_GIT_SUBMODULES_UPDATE_INTERVALL_DEFAULT}} hours ago" "+%s") \
|
||||||
-a ${MSC_GIT_SUBMODULES_UPDATE-${MSC_GIT_SUBMODULES_UPDATE_DEFAULT-true}} ]; then
|
-a ${MSC_GIT_SUBMODULES_UPDATE-${MSC_GIT_SUBMODULES_UPDATE_DEFAULT-true}} ]; then
|
||||||
[ -z "${dosrepoupdate+x}" ] && dorepoupdate="true"
|
[ -z "${dorepoupdate+x}" ] && dorepoupdate="true"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $(stat --printf %Y ${MSC_GIT_UPD_REPO_STATFILE} 2>/dev/null || echo 0 ) \
|
if [ $(stat --printf %Y ${MSC_GIT_UPD_REPO_STATFILE} 2>/dev/null || echo 0 ) \
|
||||||
|
@ -78,6 +82,7 @@ if [ $(stat --printf %Y ${MSC_GIT_UPD_REPO_STATFILE} 2>/dev/null || echo 0 ) \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#echo $SGIT fetch ${MSC_GIT_REMOTE_NAME} -p 1>&2
|
#echo $SGIT fetch ${MSC_GIT_REMOTE_NAME} -p 1>&2
|
||||||
|
if $dorepoupdate; then
|
||||||
loginfo "fetch repo${dosubmodupdate:+ and submodules}"
|
loginfo "fetch repo${dosubmodupdate:+ and submodules}"
|
||||||
$SGIT fetch ${dosubmodupdate:+--recurse-submodules} ${MSC_GIT_REMOTE_NAME} -p 2>>"${MSC_LOGFILE}"|| { logwarn fetch failed; gitupdateend; exit 1; }
|
$SGIT fetch ${dosubmodupdate:+--recurse-submodules} ${MSC_GIT_REMOTE_NAME} -p 2>>"${MSC_LOGFILE}"|| { logwarn fetch failed; gitupdateend; exit 1; }
|
||||||
if ${dosubmodupdate:-false}; then
|
if ${dosubmodupdate:-false}; then
|
||||||
|
@ -126,6 +131,7 @@ if ${dosubmodupdate:-false}; then
|
||||||
touch $MSC_GIT_UPD_SUBMOD_STATFILE
|
touch $MSC_GIT_UPD_SUBMOD_STATFILE
|
||||||
logwarn "submodules synced"
|
logwarn "submodules synced"
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
EXIT
|
EXIT
|
||||||
exit $rc
|
exit $rc
|
||||||
|
|
Loading…
Reference in a new issue