public void test_support_equally_named_branch_and_tag() throws Exception { prepareSomeHistory(); git("branch build"); git("tag build"); VcsLogProvider.DetailedLogData data = myLogProvider.readFirstBlock( myProjectRoot, new RequirementsImpl(1000, true, Collections.<VcsRef>emptySet())); List<VcsCommitMetadata> expectedLog = log(); assertOrderedEquals(data.getCommits(), expectedLog); assertTrue( ContainerUtil.exists( data.getRefs(), new Condition<VcsRef>() { @Override public boolean value(VcsRef ref) { return ref.getName().equals("build") && ref.getType() == GitRefManager.LOCAL_BRANCH; } })); assertTrue( ContainerUtil.exists( data.getRefs(), new Condition<VcsRef>() { @Override public boolean value(VcsRef ref) { return ref.getName().equals("build") && ref.getType() == GitRefManager.TAG; } })); }
public void test_refresh_when_new_tag_moved() throws VcsException { prepareSomeHistory(); Set<VcsRef> prevRefs = GitTestUtil.readAllRefs(myProjectRoot, myObjectsFactory); git("tag -f ATAG"); List<VcsCommitMetadata> expectedLog = log(); Set<VcsRef> refs = GitTestUtil.readAllRefs(myProjectRoot, myObjectsFactory); VcsLogProvider.DetailedLogData block = myLogProvider.readFirstBlock(myProjectRoot, new RequirementsImpl(1000, true, prevRefs)); assertSameElements(block.getCommits(), expectedLog); assertSameElements(block.getRefs(), refs); }
public void test_new_tag_on_old_commit() throws VcsException { prepareSomeHistory(); Set<VcsRef> prevRefs = GitTestUtil.readAllRefs(myProjectRoot, myObjectsFactory); List<VcsCommitMetadata> log = log(); String firstCommit = log.get(log.size() - 1).getId().asString(); git("tag NEW_TAG " + firstCommit); Set<VcsRef> refs = GitTestUtil.readAllRefs(myProjectRoot, myObjectsFactory); VcsLogProvider.DetailedLogData block = myLogProvider.readFirstBlock(myProjectRoot, new RequirementsImpl(1000, true, prevRefs)); assertSameElements(block.getRefs(), refs); }
public void test_dont_report_origin_HEAD() throws Exception { prepareSomeHistory(); git("update-ref refs/remotes/origin/HEAD master"); VcsLogProvider.DetailedLogData block = myLogProvider.readFirstBlock( myProjectRoot, new RequirementsImpl(1000, false, Collections.<VcsRef>emptySet())); assertFalse( "origin/HEAD should be ignored", ContainerUtil.exists( block.getRefs(), new Condition<VcsRef>() { @Override public boolean value(VcsRef ref) { return ref.getName().equals("origin/HEAD"); } })); }