use of com.gitblit.models.RefModel in project gitblit by gitblit.
the class LuceneExecutorTest method newRepositoryModel.
private RepositoryModel newRepositoryModel(Repository repository) {
RepositoryModel model = new RepositoryModel();
model.name = FileUtils.getRelativePath(GitBlitSuite.REPOSITORIES, repository.getDirectory());
model.hasCommits = JGitUtils.hasCommits(repository);
// index all local branches
model.indexedBranches = new ArrayList<String>();
for (RefModel ref : JGitUtils.getLocalBranches(repository, true, -1)) {
model.indexedBranches.add(ref.getName());
}
return model;
}
use of com.gitblit.models.RefModel in project gitblit by gitblit.
the class JGitUtilsTest method testTags.
@Test
public void testTags() throws Exception {
Repository repository = GitBlitSuite.getJGitRepository();
assertTrue(JGitUtils.getTags(repository, true, 5).size() == 5);
for (RefModel model : JGitUtils.getTags(repository, true, -1)) {
if (model.getObjectId().getName().equals("d28091fb2977077471138fe97da1440e0e8ae0da")) {
assertTrue("Not an annotated tag!", model.isAnnotatedTag());
}
assertTrue(model.getName().startsWith(Constants.R_TAGS));
assertTrue(model.equals(model));
assertFalse(model.equals(""));
assertTrue(model.hashCode() == model.getReferencedObjectId().hashCode() + model.getName().hashCode());
}
repository.close();
repository = GitBlitSuite.getGitectiveRepository();
for (RefModel model : JGitUtils.getTags(repository, true, -1)) {
if (model.getObjectId().getName().equals("035254295a9bba11f72b1f9d6791a6b957abee7b")) {
assertFalse(model.isAnnotatedTag());
assertTrue(model.getAuthorIdent().getEmailAddress().equals("kevinsawicki@gmail.com"));
assertEquals("Add scm and issue tracker elements to pom.xml\n", model.getFullMessage());
}
}
repository.close();
}
Aggregations