Skip to content

Commit 8cb66a0

Browse files
committed
update Script to clean up older translation branches
1 parent e208050 commit 8cb66a0

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

Scripts/manual_cleanup.sh

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ echo
2121
echo " This deletes the xclocs, xliff_in, xliff_out folders"
2222
echo " This deletes the file, ${MESSAGE_FILE}, with the lokalise download timestamp"
2323
echo " 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

2527
continue_or_quit ${0}
2628

@@ -31,9 +33,19 @@ rm -f "${MESSAGE_FILE}"
3133

3234
for 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 -
3850
done
3951

0 commit comments

Comments
 (0)