if (r != null) {\r
updateConfiguration(r, repository);\r
// only update symbolic head if it changes\r
- if (!StringUtils.isEmpty(repository.defaultHead) &&\r
- !repository.defaultHead.equals(JGitUtils.getSymbolicHeadTarget(r))) {\r
+ String currentHead = JGitUtils.getSymbolicHeadTarget(r);\r
+ if (!StringUtils.isEmpty(repository.defaultHead) &&\r
+ !repository.defaultHead.equals(currentHead)) {\r
+ logger.info(MessageFormat.format("Relinking {0} HEAD from {1} to {2}", \r
+ repository.name, currentHead, repository.defaultHead));\r
JGitUtils.setSymbolicHeadTarget(r, repository.defaultHead);\r
+\r
+ // clear the cache\r
+ clearRepositoryCache(repository.name);\r
}\r
+\r
+ // close the repository object\r
r.close();\r
}\r
}\r