Merge commit '7eb07eebff9bc1297c87a04ee4d703b491bc8ca2'

This commit is contained in:
Lorenzo Manacorda
2016-10-19 12:37:12 +02:00
4 changed files with 20 additions and 5 deletions

View File

@@ -40,6 +40,13 @@ commit_timestamp() {
git show -s --format=%ct "$rev"
}
# Is the SHA1 actually present in the repo?
# It could be it isn't, e.g. after a force push
is_valid_commit() {
local rev=$1
git rev-parse --quiet --verify "$rev^{commit}" > /dev/null
}
cached_revision=$(cached_image_rev)
if [ -z "$cached_revision" ]; then
echo ">>> No cached image found; rebuilding"
@@ -47,6 +54,12 @@ if [ -z "$cached_revision" ]; then
exit 0
fi
if ! is_valid_commit "$cached_revision"; then
echo ">>> Git commit of cached image not found in repo; rebuilding"
rebuild
exit 0
fi
echo ">>> Found cached image rev $cached_revision"
if has_changes "$cached_revision" "$CIRCLE_SHA1" ; then
echo ">>> Found changes, rebuilding"