scrutinizer-ci / scrutinizer

Legacy repository - archives past feature requests/bug reports
https://scrutinizer-ci.com/docs
140 stars 36 forks source link

Reduce time spent cloning repos before checks #147

Open addshore opened 10 years ago

addshore commented 10 years ago

Currently everything is cloned with a depth of 50 to try to make sure we have everything we want to check. For large repos this can take a long time and for github especially there are alternatives that would drastically cut this time.

The best methods are listed below:

If I am a branch or commit use the hash to get the zip

wget https://github.com/USER/REPO/archive/HASH.zip && unzip HASH.zip -d . && rm HASH.zip

The above avoids downloading any history at all for commits we dont need it for! and downloading a zip should be quicker than a git clone anyway. If the download fails due to rate limit fall back to a clone (we cant fall back to the method below as we cant fetch specific commits by hash in that way)

If I am a pull request

git init && git fetch https://github.com/USER/REPO +refs/pull/PULLNO/merge && git checkout -qf FETCH_HEAD

This avoids any history that is unneeded but will still checkout the pull we need merged into the given branch Should also be much faster than a clone and will require no fallback as we dont use the API

hashar commented 10 years ago

git archive is worth a shot as well. It is super fast if you don't care about the history / commit informations.