Esempio n. 1
0
  @Test
  public void merge_a_branch_without_a_dep() throws Exception {
    setup();

    // do a merges.
    WithCwd wd = new WithCwd(project.getRepo().getWorkTree());
    {
      // switch to the branch with the lib
      git.args("checkout", "blue").start().get();

      // merge the master branch, which doesn't have the lib yet
      git.args("merge", "--no-ff", "master").start().get();

      // that should have just committed cleanly, that's it
    }
    wd.close();

    // now verify.
    File depWorkTreePath =
        new File(project.getRepo().getWorkTree() + "/lib/beta").getCanonicalFile();
    File depGitDataPath =
        new File(project.getRepo().getDirectory() + "/modules/lib/beta").getCanonicalFile();

    // i do hope there's a filesystem there now
    assertTrue("dependency module path exists on fs", depWorkTreePath.exists());
    assertTrue("dependency module path is dir", depWorkTreePath.isDirectory());

    // check that anyone else can read this state with a straight face; status should be clean
    new Josh("git")
        .args("status")
        .cwd(project.getRepo().getWorkTree()) /*.opts(Opts.NullIO)*/
        .start()
        .get();
    new Josh("git").args("status").cwd(depWorkTreePath) /*.opts(Opts.NullIO)*/.start().get();
  }
Esempio n. 2
0
  @Test
  public void update_while_merging_a_branch_without_a_dep() throws Exception {
    setup();

    // do a merges.
    WithCwd wd = new WithCwd(project.getRepo().getWorkTree());
    {
      // switch to the branch with the lib
      git.args("checkout", "blue").start().get();

      // add a conflicting file so we get halted mid merge (inb4: no, '--no-commit' isn't quite the
      // same)
      IOForge.saveFile("qwer", new File("somefile").getCanonicalFile());
      git.args("add", "--", "somefile").start().get();
      git.args("commit", "-m", "bluecommit").start().get();

      // merge the master branch, which doesn't have the lib yet.  should conflict (exit code is
      // nonzero)
      git.args("merge", "--no-ff", "master").okExit(1).start().get();

      // we're stuck in a merge conflict.  try to mdm-update during it
      assertJoy(Mdm.run("update", "--strict"));

      // finish the merge.
      git.args("add", "somefile").start().get();
      git.args("commit", "--no-edit").start().get();
    }
    wd.close();

    // now verify.
    File depWorkTreePath =
        new File(project.getRepo().getWorkTree() + "/lib/beta").getCanonicalFile();
    File depGitDataPath =
        new File(project.getRepo().getDirectory() + "/modules/lib/beta").getCanonicalFile();

    // i do hope there's a filesystem there now
    assertTrue("dependency module path exists on fs", depWorkTreePath.exists());
    assertTrue("dependency module path is dir", depWorkTreePath.isDirectory());

    // check that anyone else can read this state with a straight face; status should be clean
    new Josh("git")
        .args("status")
        .cwd(project.getRepo().getWorkTree()) /*.opts(Opts.NullIO)*/
        .start()
        .get();
    new Josh("git").args("status").cwd(depWorkTreePath) /*.opts(Opts.NullIO)*/.start().get();
  }