Example #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();
  }
 private static void delete(File directory) {
   for (File file : directory.listFiles()) {
     if (file.isDirectory()) {
       delete(file);
     } else {
       assertTrue(file.delete());
     }
   }
   assertTrue(directory.delete());
 }
Example #3
0
 public static boolean recurseDelete(File f) {
   if (f.isDirectory()) {
     for (File sub : f.listFiles()) {
       if (!recurseDelete(sub)) {
         System.err.println(
             "!!!! WARNING: best effort to remove " + sub.getAbsolutePath() + " FAILED !!!!!");
         return false;
       }
     }
   }
   return f.delete();
 }
Example #4
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();
  }
Example #5
0
  private void checkFolderExists(String path) throws BrutException {
    File f = new File(sTestNewDir, path);

    assertTrue(f.isDirectory());
  }