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 if SHA1 exists before calling git diff
on it
#42
Check if SHA1 exists before calling git diff
on it
#42
Conversation
aed5553
to
74ff322
Compare
@tomwilkie Here's the change from weaveworks/scope#1924. Not sure why the CI build is failing though. |
@@ -40,13 +40,27 @@ commit_timestamp() { | |||
git show -s --format=%ct "$rev" | |||
} | |||
|
|||
# is the SHA1 actually present in the repo? | |||
# it cold be it isn't, e.g. after a force push |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
commit_valid() { | ||
local rev=$1 | ||
git rev-parse --quiet --verify "$rev^{commit}" > /dev/null | ||
[ $? -eq 0 ] |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
74ff322
to
bdffbda
Compare
In the case of a force push, the commit might not exist anymore, and the `git diff` in `has_changes` will fail, but the failure would be silently ignored (since the error message would be passed to `wc`). `wc -l` would return 1, so effectively the same image would be reused over and over.
bdffbda
to
224a145
Compare
@2opremio updated, could you please take a look? |
The CircleCI build is breaking with golang/lint#246 . Can you try running a more recent version of Go? |
I tried changing the Version run by CircleCI to |
LGTM, let's fix the build issue separately |
In the case of a force push, the commit will not exist anymore, and the
git diff
inhas_changes
will fail, but the failure would be silentlyignored (since the error message would be passed to
wc
).wc -l
would return 1, so effectively the same image would be reusedover and over.