Code is empty on Pull Request reviews

Looking at what is done by circleci after cloning the github repo, assuming that there is no tag:

git reset --hard "$CIRCLE_SHA1"
git checkout -q -B "$CIRCLE_BRANCH"
git reset --hard "$CIRCLE_SHA1"

This looks buggy to me. It’s pointing master to the the commit being built (which in this case is HEAD of test-sonar), then it checks out the branch (test-sonar) and points it as well to the same sha1. As a result, the local reference to master is wrong (pointing to the test-sonar instead of master).

I will try to report it to circleci.

Edit: bug report created https://discuss.circleci.com/t/git-checkout-of-a-branch-destroys-local-reference-to-master/23781

4 Likes