X-Git-Url: http://gitweb.hugovil.com/?a=blobdiff_plain;f=scripts%2Fgit-project-list.sh;h=748002603b9b6ff49efc3926770bf3169fdcdf15;hb=75de37b596a25e6bcc8951b0f474f0c051d84dd7;hp=0ca38defb362a8c8679e08f82633c999da20de98;hpb=2088f7ccfe5a78c7410a38d725c1ff6884864429;p=hvutilities.git diff --git a/scripts/git-project-list.sh b/scripts/git-project-list.sh index 0ca38de..7480026 100755 --- a/scripts/git-project-list.sh +++ b/scripts/git-project-list.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 list_revisions() { @@ -35,29 +27,19 @@ list_revisions() local r=${1} pushd "${r}" 1> /dev/null - local sha=$(git log --oneline HEAD~1..HEAD) - echo "${r}: ${sha}" + local sha=$(git log --abbrev=10 --pretty='format:%h %s' HEAD~1..HEAD) + + local line=' ' + printf "%s %s %s\n" ${r} "${line:${#r}}" "${sha}" popd 1> /dev/null } -list_revisions ./ - -# 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}, skipping" continue fi - # Update only git repos - if [ ! -d "${r}/.git" ]; then - echo "Not a GIT repository" - exit 1 - fi - list_revisions ${r} -done < ${SUBREPOS_LIST} +done