From e073016c17b3fd2ed31d39c01c456771e8897b21 Mon Sep 17 00:00:00 2001 From: Roland Haeder Date: Tue, 16 Aug 2016 21:49:48 +0200 Subject: [PATCH] Only cherry-pick if really there is something to do. Signed-off-by: Roland Haeder --- cherry-jprojects.sh | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/cherry-jprojects.sh b/cherry-jprojects.sh index ef82bae..38b9890 100755 --- a/cherry-jprojects.sh +++ b/cherry-jprojects.sh @@ -3,6 +3,8 @@ . ./.jprojects.sh || exit 255 for project in ${LIST}; do + COMMITS_FILE="${JPROJECTS_HOME}/${project}/.gitcommits" + if [ "${project}" = "jprojects-scripts" ] then echo "$0: Skipping jprojects-scripts ..." @@ -11,18 +13,27 @@ for project in ${LIST}; do then echo "$0: Project '${project}' does not exist." continue - elif [ ! -f "${JPROJECTS_HOME}/${project}/.gitcommits" ] + elif [ ! -f "${COMMITS_FILE}" ] then # No .gitcommits file, skip this silently continue fi - COMMIT_IDS=`cat "${JPROJECTS_HOME}/${project}/.gitcommits"` - COMMITS_FILE="${JPROJECTS_HOME}/${project}/.gitcommits" + COMMIT_IDS=`cat "${COMMITS_FILE}"` + + if [ -n "${COMMIT_IDS}" ] + then + cd "${JPROJECTS_HOME}/${project}" + echo "$0: Pulling all for project '${project}' ..." + git pull --all + else + echo "$0: Nothing to cherry-pick for '${project}'." + rm "${COMMITS_FILE}" + continue + fi echo "$0: Cherry-picking on project '${project}' ..." for commit in ${COMMIT_IDS}; do - cd "${JPROJECTS_HOME}/${project}" echo "$0: Working on commit '${commit}' ..." FOUND_ID=`git rev-list "${commit}" --max-count=1 2>&1` STATUS="$?" -- 2.39.5