String target = null;\r
try {\r
target = repository.getFullBranch();\r
- if (!target.startsWith(Constants.R_HEADS)) {\r
- // refers to an actual commit, probably a tag\r
- // find latest tag that matches the commit, if any\r
- List<RefModel> tagModels = getTags(repository, true, -1);\r
- if (tagModels.size() > 0) {\r
- RefModel tag = null;\r
- Date lastDate = new Date(0);\r
- for (RefModel tagModel : tagModels) {\r
- if (tagModel.getReferencedObjectId().getName().equals(target) &&\r
- tagModel.getDate().after(lastDate)) {\r
- tag = tagModel;\r
- lastDate = tag.getDate();\r
- }\r
- }\r
- target = tag.getName();\r
- }\r
- }\r
} catch (Throwable t) {\r
error(t, repository, "{0} failed to get symbolic HEAD target");\r
}\r