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);
  }
  @Before
  public void setUp() throws Throwable {
    IdeaTestApplication.getInstance();

    myTestName = createTestName();
    myProjectFixture =
        IdeaTestFixtureFactory.getFixtureFactory().createFixtureBuilder(myTestName).getFixture();

    edt(
        new ThrowableRunnable<Exception>() {
          @Override
          public void run() throws Exception {
            myProjectFixture.setUp();
          }
        });

    myProject = myProjectFixture.getProject();

    myProjectRoot = myProject.getBasePath();
    myProjectDir = myProject.getBaseDir();
    myTestRoot = myProjectRoot;

    myGit = ServiceManager.getService(myProject, Git.class);
    mySettings = GitVcsSettings.getInstance(myProject);
    mySettings.getAppSettings().setPathToGit(GitExecutor.PathHolder.GIT_EXECUTABLE);

    // dynamic overriding is used instead of making it in plugin.xml,
    // because MockVcsHelper is not ready to be a full featured implementation for all tests.
    myVcsHelper =
        GitTestUtil.overrideService(myProject, AbstractVcsHelper.class, MockVcsHelper.class);
    myChangeListManager = ChangeListManagerImpl.getInstanceImpl(myProject);
    myNotificator = (TestVcsNotifier) ServiceManager.getService(myProject, VcsNotifier.class);
    myVcs = GitVcs.getInstance(myProject);
    myRepositoryManager = GitUtil.getRepositoryManager(myProject);

    virtualCommits = new GitTestVirtualCommitsHolder();
    myAsyncTasks = new ArrayList<>();

    cd(myProjectRoot);
    myRepository = GitTestUtil.createRepository(myProject, myProjectRoot);

    ProjectLevelVcsManagerImpl vcsManager =
        (ProjectLevelVcsManagerImpl) ProjectLevelVcsManager.getInstance(myProject);
    AbstractVcs vcs = vcsManager.findVcsByName("Git");
    Assert.assertEquals(1, vcsManager.getRootsUnderVcs(vcs).length);

    GitTestUtil.assumeSupportedGitVersion(myVcs);
    LOG.info(getStartTestMarker());
  }
 @Override
 protected void setUp() throws Exception {
   super.setUp();
   GitTestUtil.createRepository(myProject, myProjectPath, false);
   myRebaser =
       new GitRebaser(
           myProject, ServiceManager.getService(Git.class), new EmptyProgressIndicator());
   myFirstCommit = makeCommit();
   BuiltInServerManager.getInstance().waitForStart();
 }
 private static void assertBranches(
     Collection<GitBranch> actual, Collection<GitTestBranch> expected) {
   GitTestUtil.assertEqualCollections(
       actual,
       expected,
       new GitTestUtil.EqualityChecker<GitBranch, GitTestBranch>() {
         @Override
         public boolean areEqual(@NotNull GitBranch actual, @NotNull GitTestBranch expected) {
           return branchesAreEqual(actual, expected);
         }
       });
 }
 @Before(value = "@nestedroot", order = 2)
 public void setUpStandardMultipleRootsConfig() {
   cd(myProjectRoot);
   File community = mkdir("community");
   GitTestUtil.createRepository(myProject, community.getPath());
 }