}
- /**
- * Init .git in the target dir
- * @return true if there was no fetch in the target dir before
- * @throws VcsException in teh case of any problems
- */
- private boolean initGitRepository() throws VcsException {
- boolean firstFetch = false;
+ private void initGitRepository() throws VcsException {
if (!new File(myTargetDirectory, ".git").exists()) {
- initDirectory();
+ initDirectory(false);
- firstFetch = true;
} else {
- String remoteUrl = getRemoteUrl();
- if (!remoteUrl.equals(myRoot.getRepositoryFetchURL().toString())) {
+ try {
+ configureRemoteUrl(new File(myTargetDirectory, ".git"));
+ setupExistingRepository();
+ configureSparseCheckout();
+ } catch (Exception e) {
+ LOG.warn("Do clean checkout due to errors while configure use of local mirrors", e);
- initDirectory();
+ initDirectory(true);
- firstFetch = true;
- } else {
- try {
- setupExistingRepository();
- configureSparseCheckout();
- } catch (Exception e) {
- LOG.warn("Do clean checkout due to errors while configure use of local mirrors", e);
- initDirectory(true);
- firstFetch = true;
- }
}
}
- return firstFetch;
+ removeOrphanedIdxFiles(new File(myTargetDirectory, ".git"));
}
protected void setupNewRepository() throws VcsException {