Git shallow clone followed by checkout -cf $hash fails my build

What happened here: I made some changes to my GitHub repo and pushed it. Minutes after, I went back and updated the README and pushed again.

Then I’ve got this error on my build:

https://travis-ci.org/fiorix/jsonschema2go/jobs/452139839#L55

I believe what’s happening is that the shallow clone, depth=1, only has my latest (head) commit bcd91 and not the previous, dd7488, which is the changeset being tested.

The subsequent build for bcd91 worked just fine, as expected: https://travis-ci.org/fiorix/jsonschema2go/builds/452142874

There may be some intermittent issue where people push too fast and their tests fail.

This is explained in our document. You should really define a value higher than 1 for the depth.