Use File.exist? to check if a repository exists
Initializing Rugged objects is way too expensive just to check if a
repository exists. Even though we cache this data once in a while we
have to refresh this. On GitLab.com we have seen Repository#exists?
taking up to _1 minute_ to complete in the absolute worst case, though
usually it sits around a second or so.
Using File.exist? to instead check if $GIT_DIR/refs exists is a much
faster way of checking if a repository was initialized properly.
Showing
Please
register
or
sign in
to comment