Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check existence of SHA1 before running git diff #1924

Closed

Conversation

asymmetric
Copy link
Contributor

This fixes a bug whereby a cached Docker image would always end up being used, if the git commit it was built from was not reachable anymore.

@asymmetric asymmetric closed this Oct 14, 2016
Copy link
Contributor

@krnowak krnowak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks fine and dandy, minor nitpicks.

# it could be it isn't, e.g. after a force push
commit_valid() {
local rev=$1
git rev-parse --quiet --verify "$rev^{commit}"

This comment was marked as abuse.

cached_revision=$(cached_image_rev)
if [ -z "$cached_revision" ]; then
echo ">>> No cached image found; rebuilding"
rebuild
exit 0
fi

if ! commit_valid "$cached_revision"; then
echo ">>> cached SHA1 not found in repo, rebuilding"

This comment was marked as abuse.

@tomwilkie
Copy link
Contributor

Can you file this against build-tools.git pls? Then update the subtree in here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants