Browse Source

SubmoduleDeinitTest fails on Windows

Bug: 538068
Change-Id: I982e8b12936582e8e119f45d7a3bf4888d3e0e1a
Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
stable-5.1
Andrey Loskutov 6 years ago
parent
commit
5a95e7e74b
  1. 10
      org.eclipse.jgit.test/tst/org/eclipse/jgit/submodule/SubmoduleDeinitTest.java
  2. 10
      org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleDeinitCommand.java

10
org.eclipse.jgit.test/tst/org/eclipse/jgit/submodule/SubmoduleDeinitTest.java

@ -136,10 +136,12 @@ public class SubmoduleDeinitTest extends RepositoryTestCase {
generator.next(); generator.next();
//want to create a commit inside the repo... //want to create a commit inside the repo...
Repository submoduleLocalRepo = generator.getRepository(); try (Repository submoduleLocalRepo = generator.getRepository()) {
JGitTestUtil.writeTrashFile(submoduleLocalRepo, "file.txt", "new data"); JGitTestUtil.writeTrashFile(submoduleLocalRepo, "file.txt",
Git.wrap(submoduleLocalRepo).commit().setAll(true).setMessage("local commit").call(); "new data");
Git.wrap(submoduleLocalRepo).commit().setAll(true)
.setMessage("local commit").call();
}
SubmoduleDeinitResult result = runDeinit(new SubmoduleDeinitCommand(db).addPath("sub")); SubmoduleDeinitResult result = runDeinit(new SubmoduleDeinitCommand(db).addPath("sub"));
assertEquals(path, result.getPath()); assertEquals(path, result.getPath());
assertEquals(SubmoduleDeinitCommand.SubmoduleDeinitStatus.DIRTY, result.getStatus()); assertEquals(SubmoduleDeinitCommand.SubmoduleDeinitStatus.DIRTY, result.getStatus());

10
org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleDeinitCommand.java

@ -227,11 +227,11 @@ public class SubmoduleDeinitCommand
return SubmoduleDeinitStatus.DIRTY; return SubmoduleDeinitStatus.DIRTY;
} }
Repository submoduleRepo = w.getRepository(); try (Repository submoduleRepo = w.getRepository()) {
Status status = Git.wrap(submoduleRepo).status().call();
Status status = Git.wrap(submoduleRepo).status().call(); return status.isClean() ? SubmoduleDeinitStatus.SUCCESS
return status.isClean() ? SubmoduleDeinitStatus.SUCCESS : SubmoduleDeinitStatus.DIRTY;
: SubmoduleDeinitStatus.DIRTY; }
} }
} }

Loading…
Cancel
Save