File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change 2121echo " This deletes the xclocs, xliff_in, xliff_out folders"
2222echo " This deletes the file, ${MESSAGE_FILE} , with the lokalise download timestamp"
2323echo " This restores all submodules to their current branch (reset, clean)"
24+ echo " If '${TRANSLATION_BRANCH} ' branch exists and submodule is NOT on that branch:"
25+ echo " then '${TRANSLATION_BRANCH} ' branch is deleted"
2426
2527continue_or_quit ${0}
2628
@@ -31,9 +33,19 @@ rm -f "${MESSAGE_FILE}"
3133
3234for project in ${PROJECTS} ; do
3335 IFS=" :" read user dir branch <<< " $project"
34- echo " Reset and clean $dir "
36+ echo
37+ echo " *** Reset and clean $dir "
3538 cd $dir
3639 git reset --hard; git clean -fd;
40+ current_branch=$( git branch --show-current 2> /dev/null)
41+ if [[ " ${current_branch} " == " ${TRANSLATION_BRANCH} " ]]; then
42+ echo " already on $TRANSLATION_BRANCH , take no action"
43+ elif [ -n " $( git branch --list " $TRANSLATION_BRANCH " ) " ]; then
44+ echo " Local branch '$TRANSLATION_BRANCH ' exists, deleting it."
45+ git branch -D " ${TRANSLATION_BRANCH} "
46+ else
47+ echo " no branch named $TRANSLATION_BRANCH exists, take no action"
48+ fi
3749 cd -
3850done
3951
You can’t perform that action at this time.
0 commit comments