From b233de51bae78c67e2974a467685f33518c4c518 Mon Sep 17 00:00:00 2001 From: =?utf8?q?S=C3=A9bastien=20Han?= Date: Mon, 19 Dec 2016 10:05:44 +0100 Subject: [PATCH] contrib: use prune to fetch MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Sometimes git keeps data from remotes that are not up-to-date, i.e: remote branches. Using `--prune` will delete non-existing remote branches from git's caches. Signed-off-by: Sébastien Han --- contrib/push-roles-to-ansible-galaxy.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contrib/push-roles-to-ansible-galaxy.sh b/contrib/push-roles-to-ansible-galaxy.sh index 8c4d6dcfd..b1dbf9f74 100755 --- a/contrib/push-roles-to-ansible-galaxy.sh +++ b/contrib/push-roles-to-ansible-galaxy.sh @@ -29,7 +29,7 @@ function pull_origin { function reset_hard_origin { # let's bring everything back to normal git checkout $LOCAL_BRANCH - git fetch origin + git fetch origin --prune git fetch --tags git reset --hard origin/master } @@ -63,7 +63,7 @@ for ROLE in $ROLES; do reset_hard_origin # First we filter branches by rewriting master with the content of roles/$ROLE # this gives us a new commit history - for BRANCH in $(git branch -r | egrep 'origin/master|origin/ansible-1.9|origin/stable-' | grep -v origin/HEAD | cut -d '/' -f2); do + for BRANCH in $(git branch --list --remotes "origin/stable-*" "origin/master" "origin/ansible-1.9" | cut -d '/' -f2); do git checkout -B $BRANCH origin/$BRANCH git filter-branch -f --prune-empty --subdirectory-filter roles/$ROLE git push -f $REMOTE $BRANCH -- 2.47.3