X-Git-Url: http://gitweb.hugovil.com/?a=blobdiff_plain;f=scripts%2Fgit-project-fetch.sh;h=8c17043a20c5cf2c4f3bf08160b8d2a940335ce3;hb=29adab903b9ea78325d40d641f1c29d10a3f6b97;hp=483e2ff51af07be46e641a4f730d84dc302b44a2;hpb=d240fda92b8bd822645ebeca8831d204746376da;p=hvutilities.git diff --git a/scripts/git-project-fetch.sh b/scripts/git-project-fetch.sh index 483e2ff..8c17043 100755 --- a/scripts/git-project-fetch.sh +++ b/scripts/git-project-fetch.sh @@ -2,11 +2,7 @@ SCRIPT="`readlink -e $0`" SCRIPTPATH=$(dirname ${SCRIPT}) - -SUBREPOS_LIST=.gitsubrepos - -# Uncomment to have verbose debug output -##debug=1 +source ${SCRIPTPATH}/hv-git-functions.sh print_usage() { @@ -19,11 +15,7 @@ if [ "x${1}" = "x--help" ]; then exit 1 fi -if [ ! -f ${SUBREPOS_LIST} ]; then - echo "Missing file for list of subrepos: ${SUBREPOS_LIST}" - print_usage - exit 1 -fi +hv_git_validate_subrepos_list remote_update_repo() { @@ -37,7 +29,7 @@ remote_update_repo() echo "Repo ${r}:" pushd "${r}" 1> /dev/null - git remote update 1> /dev/null + git fetch --all --prune 1> /dev/null vco master git pull --ff-only vco latest @@ -45,24 +37,13 @@ remote_update_repo() popd 1> /dev/null } -remote_update_repo ./ - -# Read list of repositories from file named .gitsubrepos -while IFS=$'\n' read r ; do - [[ "${r}" =~ \#.* ]] && continue # Skip comment lines - [ -z ${r} ] && continue # Skip enmpty lines - +for r in ./ $(hv_git_get_subrepos_list); do # Make sure directory exists if [ ! -d "${r}" ]; then - echo "Missing repos ${r}" - exit 1 - fi - - # Update only git repos - if [ ! -d "${r}/.git" ]; then - echo "Not a GIT repository" - exit 1 + echo "Missing repos ${r}, skipping" + continue fi remote_update_repo ${r} -done < ${SUBREPOS_LIST} + rc=${?} +done