Skip to content

Commit a29261d

Browse files
author
Ray Schamp
committed
Fixes for Travis environment
Base everything on the $repository variable
1 parent 5d0d55f commit a29261d

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

prune-gh-pages.sh

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,12 @@ fi
2525
current=$(git rev-parse --abbrev-ref HEAD)
2626

2727
# Checkout most recent gh-pages
28-
git fetch origin
29-
git checkout -f gh-pages
30-
git reset --hard origin/gh-pages
28+
git fetch --force $repository gh-pages:gh-pages
29+
git checkout gh-pages
30+
git clean -fdx
3131

3232
# Make an array of directories to not delete, from the list of remote branches
33-
branches=$(git branch -r --list origin/*)
34-
35-
# Strip off the remote name prefix
36-
branches="${branches[@]//origin\//}"
33+
branches=$(git ls-remote --refs --quiet $repository | awk '{print $2}' | sed -e 's/refs\/heads\///')
3734

3835
# Add parent directories of branches to the exclusion list (e.g. greenkeeper/)
3936
for branch in $branches; do
@@ -42,7 +39,7 @@ for branch in $branches; do
4239
fi
4340
done
4441

45-
# Dedupe all the greenkeepers
42+
# Dedupe all the greenkeepers (or other duplicate parent directories)
4643
branches=$(echo "${branches[@]}" | tr ' ' '\n' | sort -u | tr '\n' ' ')
4744

4845
# Remove all directories that don't have corresponding branches

0 commit comments

Comments
 (0)