Fix race condition in repository calculation.

When requesting two repository values (e.g. root and branch) using impromptu.repository[method], if a primary repository had not yet been found, the methods would attempt to find the primary repository twice. Since the primary repository is tracked globally, one attempt would succeed, causing the second attempt to fail. This consolidates the primary repository calculation such that it is only performed once.