better repo detection; only fetch once