#! /usr/bin/env bash

VERSION_CHANGE_TRIGGERS="setup.py MANIFEST.in openfisca_country_template"

if [[ "$CIRCLE_BRANCH" == "master" ]]
then LAST_MASTER_VERSION="HEAD^"
else LAST_MASTER_VERSION="origin/master"
fi

if git diff-index --quiet $LAST_MASTER_VERSION -- $VERSION_CHANGE_TRIGGERS ":(exclude)*.md"
then echo "No functional changes detected."
else exit 1
fi

#! /usr/bin/env bash

VERSION_CHANGE_TRIGGERS="setup.py MANIFEST.in openfisca_country_template"

last_tagged_commit=`git describe --tags --abbrev=0 --first-parent`  # --first-parent ensures we don't follow tags not published in master through an unlikely intermediary merge commit

if git diff-index --quiet $last_tagged_commit -- $VERSION_CHANGE_TRIGGERS ":(exclude)*.md"
then echo "No functional changes detected."
else exit 1
fi

Increase resilience of last tagged version search
Increase resilience of last tagged version search

Do not rely on master merge commits to necessarily have been tagged and published: if there is an issue there, we would enter a cycle of failing deployments
