From ec62584f8a8447b6c928b5b0cd1d20607511ca7a Mon Sep 17 00:00:00 2001 From: Michael Marineau Date: Thu, 24 Oct 2013 11:33:19 -0700 Subject: [PATCH] fix(tag_release): Fix cleanup of old branch manifests. --- tag_release | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/tag_release b/tag_release index 3531c380a6..1a28c87567 100755 --- a/tag_release +++ b/tag_release @@ -26,14 +26,12 @@ TAG_NAME="v${FLAGS_build}.${FLAGS_branch}.${FLAGS_patch}" cd "${GCLIENT_ROOT}/.repo/manifests" -# Clean up existing branch manifest(s) -if [[ $(ls branch-*.xml 2>/dev/null) ]]; then - for old_branch in branch-*.xml; do - if [[ "${old_branch}" != "${BRANCH_NAME}.xml" ]]; then - git rm -f "${old_branch}" - fi - done -fi +# Clean up existing branch manifest(s) excluding: +# - the current branch if the file already exists. +# - one previous branch, useful for comparing releases. +OLD_BRANCHES=$(find -maxdepth 1 -name 'build-*.xml' \ + -not -name "${BRANCH_NAME}.xml" | sort -rn | tail -n -1) +git rm -f ${OLD_BRANCHES} repo manifest -o "${BRANCH_NAME}.xml" -r tee version.txt <