Browse Source

CommitCommandTest: Open Git and TreeWalk in try-with-resource

Change-Id: I65a6fd7028e209c300d992c2756100c09ab4dc19
Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
stable-4.2
David Pursehouse 9 years ago
parent
commit
ff90192a05
  1. 526
      org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CommitCommandTest.java

526
org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CommitCommandTest.java

@ -186,297 +186,302 @@ public class CommitCommandTest extends RepositoryTestCase {
@Test @Test
public void commitNewSubmodule() throws Exception { public void commitNewSubmodule() throws Exception {
Git git = new Git(db); try (Git git = new Git(db)) {
writeTrashFile("file.txt", "content"); writeTrashFile("file.txt", "content");
git.add().addFilepattern("file.txt").call(); git.add().addFilepattern("file.txt").call();
RevCommit commit = git.commit().setMessage("create file").call(); RevCommit commit = git.commit().setMessage("create file").call();
SubmoduleAddCommand command = new SubmoduleAddCommand(db); SubmoduleAddCommand command = new SubmoduleAddCommand(db);
String path = "sub"; String path = "sub";
command.setPath(path); command.setPath(path);
String uri = db.getDirectory().toURI().toString(); String uri = db.getDirectory().toURI().toString();
command.setURI(uri); command.setURI(uri);
Repository repo = command.call(); Repository repo = command.call();
assertNotNull(repo); assertNotNull(repo);
addRepoToClose(repo); addRepoToClose(repo);
SubmoduleWalk generator = SubmoduleWalk.forIndex(db); SubmoduleWalk generator = SubmoduleWalk.forIndex(db);
assertTrue(generator.next()); assertTrue(generator.next());
assertEquals(path, generator.getPath()); assertEquals(path, generator.getPath());
assertEquals(commit, generator.getObjectId()); assertEquals(commit, generator.getObjectId());
assertEquals(uri, generator.getModulesUrl()); assertEquals(uri, generator.getModulesUrl());
assertEquals(path, generator.getModulesPath()); assertEquals(path, generator.getModulesPath());
assertEquals(uri, generator.getConfigUrl()); assertEquals(uri, generator.getConfigUrl());
Repository subModRepo = generator.getRepository(); Repository subModRepo = generator.getRepository();
assertNotNull(subModRepo); assertNotNull(subModRepo);
subModRepo.close(); subModRepo.close();
assertEquals(commit, repo.resolve(Constants.HEAD)); assertEquals(commit, repo.resolve(Constants.HEAD));
RevCommit submoduleCommit = git.commit().setMessage("submodule add") RevCommit submoduleCommit = git.commit().setMessage("submodule add")
.setOnly(path).call(); .setOnly(path).call();
assertNotNull(submoduleCommit); assertNotNull(submoduleCommit);
TreeWalk walk = new TreeWalk(db); try (TreeWalk walk = new TreeWalk(db)) {
walk.addTree(commit.getTree()); walk.addTree(commit.getTree());
walk.addTree(submoduleCommit.getTree()); walk.addTree(submoduleCommit.getTree());
walk.setFilter(TreeFilter.ANY_DIFF); walk.setFilter(TreeFilter.ANY_DIFF);
List<DiffEntry> diffs = DiffEntry.scan(walk); List<DiffEntry> diffs = DiffEntry.scan(walk);
assertEquals(1, diffs.size()); assertEquals(1, diffs.size());
DiffEntry subDiff = diffs.get(0); DiffEntry subDiff = diffs.get(0);
assertEquals(FileMode.MISSING, subDiff.getOldMode()); assertEquals(FileMode.MISSING, subDiff.getOldMode());
assertEquals(FileMode.GITLINK, subDiff.getNewMode()); assertEquals(FileMode.GITLINK, subDiff.getNewMode());
assertEquals(ObjectId.zeroId(), subDiff.getOldId().toObjectId()); assertEquals(ObjectId.zeroId(), subDiff.getOldId().toObjectId());
assertEquals(commit, subDiff.getNewId().toObjectId()); assertEquals(commit, subDiff.getNewId().toObjectId());
assertEquals(path, subDiff.getNewPath()); assertEquals(path, subDiff.getNewPath());
}
}
} }
@Test @Test
public void commitSubmoduleUpdate() throws Exception { public void commitSubmoduleUpdate() throws Exception {
Git git = new Git(db); try (Git git = new Git(db)) {
writeTrashFile("file.txt", "content"); writeTrashFile("file.txt", "content");
git.add().addFilepattern("file.txt").call(); git.add().addFilepattern("file.txt").call();
RevCommit commit = git.commit().setMessage("create file").call(); RevCommit commit = git.commit().setMessage("create file").call();
writeTrashFile("file.txt", "content2"); writeTrashFile("file.txt", "content2");
git.add().addFilepattern("file.txt").call(); git.add().addFilepattern("file.txt").call();
RevCommit commit2 = git.commit().setMessage("edit file").call(); RevCommit commit2 = git.commit().setMessage("edit file").call();
SubmoduleAddCommand command = new SubmoduleAddCommand(db); SubmoduleAddCommand command = new SubmoduleAddCommand(db);
String path = "sub"; String path = "sub";
command.setPath(path); command.setPath(path);
String uri = db.getDirectory().toURI().toString(); String uri = db.getDirectory().toURI().toString();
command.setURI(uri); command.setURI(uri);
Repository repo = command.call(); Repository repo = command.call();
assertNotNull(repo); assertNotNull(repo);
addRepoToClose(repo); addRepoToClose(repo);
SubmoduleWalk generator = SubmoduleWalk.forIndex(db); SubmoduleWalk generator = SubmoduleWalk.forIndex(db);
assertTrue(generator.next()); assertTrue(generator.next());
assertEquals(path, generator.getPath()); assertEquals(path, generator.getPath());
assertEquals(commit2, generator.getObjectId()); assertEquals(commit2, generator.getObjectId());
assertEquals(uri, generator.getModulesUrl()); assertEquals(uri, generator.getModulesUrl());
assertEquals(path, generator.getModulesPath()); assertEquals(path, generator.getModulesPath());
assertEquals(uri, generator.getConfigUrl()); assertEquals(uri, generator.getConfigUrl());
Repository subModRepo = generator.getRepository(); Repository subModRepo = generator.getRepository();
assertNotNull(subModRepo); assertNotNull(subModRepo);
subModRepo.close(); subModRepo.close();
assertEquals(commit2, repo.resolve(Constants.HEAD)); assertEquals(commit2, repo.resolve(Constants.HEAD));
RevCommit submoduleAddCommit = git.commit().setMessage("submodule add") RevCommit submoduleAddCommit = git.commit().setMessage("submodule add")
.setOnly(path).call(); .setOnly(path).call();
assertNotNull(submoduleAddCommit); assertNotNull(submoduleAddCommit);
RefUpdate update = repo.updateRef(Constants.HEAD); RefUpdate update = repo.updateRef(Constants.HEAD);
update.setNewObjectId(commit); update.setNewObjectId(commit);
assertEquals(Result.FORCED, update.forceUpdate()); assertEquals(Result.FORCED, update.forceUpdate());
RevCommit submoduleEditCommit = git.commit() RevCommit submoduleEditCommit = git.commit()
.setMessage("submodule add").setOnly(path).call(); .setMessage("submodule add").setOnly(path).call();
assertNotNull(submoduleEditCommit); assertNotNull(submoduleEditCommit);
TreeWalk walk = new TreeWalk(db); try (TreeWalk walk = new TreeWalk(db)) {
walk.addTree(submoduleAddCommit.getTree()); walk.addTree(submoduleAddCommit.getTree());
walk.addTree(submoduleEditCommit.getTree()); walk.addTree(submoduleEditCommit.getTree());
walk.setFilter(TreeFilter.ANY_DIFF); walk.setFilter(TreeFilter.ANY_DIFF);
List<DiffEntry> diffs = DiffEntry.scan(walk); List<DiffEntry> diffs = DiffEntry.scan(walk);
assertEquals(1, diffs.size()); assertEquals(1, diffs.size());
DiffEntry subDiff = diffs.get(0); DiffEntry subDiff = diffs.get(0);
assertEquals(FileMode.GITLINK, subDiff.getOldMode()); assertEquals(FileMode.GITLINK, subDiff.getOldMode());
assertEquals(FileMode.GITLINK, subDiff.getNewMode()); assertEquals(FileMode.GITLINK, subDiff.getNewMode());
assertEquals(commit2, subDiff.getOldId().toObjectId()); assertEquals(commit2, subDiff.getOldId().toObjectId());
assertEquals(commit, subDiff.getNewId().toObjectId()); assertEquals(commit, subDiff.getNewId().toObjectId());
assertEquals(path, subDiff.getNewPath()); assertEquals(path, subDiff.getNewPath());
assertEquals(path, subDiff.getOldPath()); assertEquals(path, subDiff.getOldPath());
}
}
} }
@Test @Test
public void commitUpdatesSmudgedEntries() throws Exception { public void commitUpdatesSmudgedEntries() throws Exception {
Git git = new Git(db); try (Git git = new Git(db)) {
File file1 = writeTrashFile("file1.txt", "content1");
File file1 = writeTrashFile("file1.txt", "content1"); assertTrue(file1.setLastModified(file1.lastModified() - 5000));
assertTrue(file1.setLastModified(file1.lastModified() - 5000)); File file2 = writeTrashFile("file2.txt", "content2");
File file2 = writeTrashFile("file2.txt", "content2"); assertTrue(file2.setLastModified(file2.lastModified() - 5000));
assertTrue(file2.setLastModified(file2.lastModified() - 5000)); File file3 = writeTrashFile("file3.txt", "content3");
File file3 = writeTrashFile("file3.txt", "content3"); assertTrue(file3.setLastModified(file3.lastModified() - 5000));
assertTrue(file3.setLastModified(file3.lastModified() - 5000));
assertNotNull(git.add().addFilepattern("file1.txt")
assertNotNull(git.add().addFilepattern("file1.txt") .addFilepattern("file2.txt").addFilepattern("file3.txt").call());
.addFilepattern("file2.txt").addFilepattern("file3.txt").call()); RevCommit commit = git.commit().setMessage("add files").call();
RevCommit commit = git.commit().setMessage("add files").call(); assertNotNull(commit);
assertNotNull(commit);
DirCache cache = DirCache.read(db.getIndexFile(), db.getFS());
DirCache cache = DirCache.read(db.getIndexFile(), db.getFS()); int file1Size = cache.getEntry("file1.txt").getLength();
int file1Size = cache.getEntry("file1.txt").getLength(); int file2Size = cache.getEntry("file2.txt").getLength();
int file2Size = cache.getEntry("file2.txt").getLength(); int file3Size = cache.getEntry("file3.txt").getLength();
int file3Size = cache.getEntry("file3.txt").getLength(); ObjectId file2Id = cache.getEntry("file2.txt").getObjectId();
ObjectId file2Id = cache.getEntry("file2.txt").getObjectId(); ObjectId file3Id = cache.getEntry("file3.txt").getObjectId();
ObjectId file3Id = cache.getEntry("file3.txt").getObjectId(); assertTrue(file1Size > 0);
assertTrue(file1Size > 0); assertTrue(file2Size > 0);
assertTrue(file2Size > 0); assertTrue(file3Size > 0);
assertTrue(file3Size > 0);
// Smudge entries
// Smudge entries cache = DirCache.lock(db.getIndexFile(), db.getFS());
cache = DirCache.lock(db.getIndexFile(), db.getFS()); cache.getEntry("file1.txt").setLength(0);
cache.getEntry("file1.txt").setLength(0); cache.getEntry("file2.txt").setLength(0);
cache.getEntry("file2.txt").setLength(0); cache.getEntry("file3.txt").setLength(0);
cache.getEntry("file3.txt").setLength(0); cache.write();
cache.write(); assertTrue(cache.commit());
assertTrue(cache.commit());
// Verify entries smudged
// Verify entries smudged cache = DirCache.read(db.getIndexFile(), db.getFS());
cache = DirCache.read(db.getIndexFile(), db.getFS()); assertEquals(0, cache.getEntry("file1.txt").getLength());
assertEquals(0, cache.getEntry("file1.txt").getLength()); assertEquals(0, cache.getEntry("file2.txt").getLength());
assertEquals(0, cache.getEntry("file2.txt").getLength()); assertEquals(0, cache.getEntry("file3.txt").getLength());
assertEquals(0, cache.getEntry("file3.txt").getLength());
long indexTime = db.getIndexFile().lastModified();
long indexTime = db.getIndexFile().lastModified(); db.getIndexFile().setLastModified(indexTime - 5000);
db.getIndexFile().setLastModified(indexTime - 5000);
write(file1, "content4");
write(file1, "content4"); assertTrue(file1.setLastModified(file1.lastModified() + 2500));
assertTrue(file1.setLastModified(file1.lastModified() + 2500)); assertNotNull(git.commit().setMessage("edit file").setOnly("file1.txt")
assertNotNull(git.commit().setMessage("edit file").setOnly("file1.txt") .call());
.call());
cache = db.readDirCache();
cache = db.readDirCache(); assertEquals(file1Size, cache.getEntry("file1.txt").getLength());
assertEquals(file1Size, cache.getEntry("file1.txt").getLength()); assertEquals(file2Size, cache.getEntry("file2.txt").getLength());
assertEquals(file2Size, cache.getEntry("file2.txt").getLength()); assertEquals(file3Size, cache.getEntry("file3.txt").getLength());
assertEquals(file3Size, cache.getEntry("file3.txt").getLength()); assertEquals(file2Id, cache.getEntry("file2.txt").getObjectId());
assertEquals(file2Id, cache.getEntry("file2.txt").getObjectId()); assertEquals(file3Id, cache.getEntry("file3.txt").getObjectId());
assertEquals(file3Id, cache.getEntry("file3.txt").getObjectId()); }
} }
@Test @Test
public void commitIgnoresSmudgedEntryWithDifferentId() throws Exception { public void commitIgnoresSmudgedEntryWithDifferentId() throws Exception {
Git git = new Git(db); try (Git git = new Git(db)) {
File file1 = writeTrashFile("file1.txt", "content1");
File file1 = writeTrashFile("file1.txt", "content1"); assertTrue(file1.setLastModified(file1.lastModified() - 5000));
assertTrue(file1.setLastModified(file1.lastModified() - 5000)); File file2 = writeTrashFile("file2.txt", "content2");
File file2 = writeTrashFile("file2.txt", "content2"); assertTrue(file2.setLastModified(file2.lastModified() - 5000));
assertTrue(file2.setLastModified(file2.lastModified() - 5000));
assertNotNull(git.add().addFilepattern("file1.txt")
assertNotNull(git.add().addFilepattern("file1.txt") .addFilepattern("file2.txt").call());
.addFilepattern("file2.txt").call()); RevCommit commit = git.commit().setMessage("add files").call();
RevCommit commit = git.commit().setMessage("add files").call(); assertNotNull(commit);
assertNotNull(commit);
DirCache cache = DirCache.read(db.getIndexFile(), db.getFS());
DirCache cache = DirCache.read(db.getIndexFile(), db.getFS()); int file1Size = cache.getEntry("file1.txt").getLength();
int file1Size = cache.getEntry("file1.txt").getLength(); int file2Size = cache.getEntry("file2.txt").getLength();
int file2Size = cache.getEntry("file2.txt").getLength(); assertTrue(file1Size > 0);
assertTrue(file1Size > 0); assertTrue(file2Size > 0);
assertTrue(file2Size > 0);
writeTrashFile("file2.txt", "content3");
writeTrashFile("file2.txt", "content3"); assertNotNull(git.add().addFilepattern("file2.txt").call());
assertNotNull(git.add().addFilepattern("file2.txt").call()); writeTrashFile("file2.txt", "content4");
writeTrashFile("file2.txt", "content4");
// Smudge entries
// Smudge entries cache = DirCache.lock(db.getIndexFile(), db.getFS());
cache = DirCache.lock(db.getIndexFile(), db.getFS()); cache.getEntry("file1.txt").setLength(0);
cache.getEntry("file1.txt").setLength(0); cache.getEntry("file2.txt").setLength(0);
cache.getEntry("file2.txt").setLength(0); cache.write();
cache.write(); assertTrue(cache.commit());
assertTrue(cache.commit());
// Verify entries smudged
// Verify entries smudged cache = db.readDirCache();
cache = db.readDirCache(); assertEquals(0, cache.getEntry("file1.txt").getLength());
assertEquals(0, cache.getEntry("file1.txt").getLength()); assertEquals(0, cache.getEntry("file2.txt").getLength());
assertEquals(0, cache.getEntry("file2.txt").getLength());
long indexTime = db.getIndexFile().lastModified();
long indexTime = db.getIndexFile().lastModified(); db.getIndexFile().setLastModified(indexTime - 5000);
db.getIndexFile().setLastModified(indexTime - 5000);
write(file1, "content5");
write(file1, "content5"); assertTrue(file1.setLastModified(file1.lastModified() + 1000));
assertTrue(file1.setLastModified(file1.lastModified() + 1000));
assertNotNull(git.commit().setMessage("edit file").setOnly("file1.txt")
assertNotNull(git.commit().setMessage("edit file").setOnly("file1.txt") .call());
.call());
cache = db.readDirCache();
cache = db.readDirCache(); assertEquals(file1Size, cache.getEntry("file1.txt").getLength());
assertEquals(file1Size, cache.getEntry("file1.txt").getLength()); assertEquals(0, cache.getEntry("file2.txt").getLength());
assertEquals(0, cache.getEntry("file2.txt").getLength()); }
} }
@Test @Test
public void commitAfterSquashMerge() throws Exception { public void commitAfterSquashMerge() throws Exception {
Git git = new Git(db); try (Git git = new Git(db)) {
writeTrashFile("file1", "file1");
writeTrashFile("file1", "file1"); git.add().addFilepattern("file1").call();
git.add().addFilepattern("file1").call(); RevCommit first = git.commit().setMessage("initial commit").call();
RevCommit first = git.commit().setMessage("initial commit").call();
assertTrue(new File(db.getWorkTree(), "file1").exists()); assertTrue(new File(db.getWorkTree(), "file1").exists());
createBranch(first, "refs/heads/branch1"); createBranch(first, "refs/heads/branch1");
checkoutBranch("refs/heads/branch1"); checkoutBranch("refs/heads/branch1");
writeTrashFile("file2", "file2"); writeTrashFile("file2", "file2");
git.add().addFilepattern("file2").call(); git.add().addFilepattern("file2").call();
git.commit().setMessage("second commit").call(); git.commit().setMessage("second commit").call();
assertTrue(new File(db.getWorkTree(), "file2").exists()); assertTrue(new File(db.getWorkTree(), "file2").exists());
checkoutBranch("refs/heads/master"); checkoutBranch("refs/heads/master");
MergeResult result = git.merge() MergeResult result = git.merge()
.include(db.exactRef("refs/heads/branch1")) .include(db.exactRef("refs/heads/branch1"))
.setSquash(true) .setSquash(true)
.call(); .call();
assertTrue(new File(db.getWorkTree(), "file1").exists()); assertTrue(new File(db.getWorkTree(), "file1").exists());
assertTrue(new File(db.getWorkTree(), "file2").exists()); assertTrue(new File(db.getWorkTree(), "file2").exists());
assertEquals(MergeResult.MergeStatus.FAST_FORWARD_SQUASHED, assertEquals(MergeResult.MergeStatus.FAST_FORWARD_SQUASHED,
result.getMergeStatus()); result.getMergeStatus());
// comment not set, should be inferred from SQUASH_MSG // comment not set, should be inferred from SQUASH_MSG
RevCommit squashedCommit = git.commit().call(); RevCommit squashedCommit = git.commit().call();
assertEquals(1, squashedCommit.getParentCount()); assertEquals(1, squashedCommit.getParentCount());
assertNull(db.readSquashCommitMsg()); assertNull(db.readSquashCommitMsg());
assertEquals("commit: Squashed commit of the following:", db assertEquals("commit: Squashed commit of the following:", db
.getReflogReader(Constants.HEAD).getLastEntry().getComment()); .getReflogReader(Constants.HEAD).getLastEntry().getComment());
assertEquals("commit: Squashed commit of the following:", db assertEquals("commit: Squashed commit of the following:", db
.getReflogReader(db.getBranch()).getLastEntry().getComment()); .getReflogReader(db.getBranch()).getLastEntry().getComment());
}
} }
@Test(expected = WrongRepositoryStateException.class) @Test(expected = WrongRepositoryStateException.class)
public void commitAmendOnInitialShouldFail() throws Exception { public void commitAmendOnInitialShouldFail() throws Exception {
Git git = new Git(db); try (Git git = new Git(db)) {
git.commit().setAmend(true).setMessage("initial commit").call(); git.commit().setAmend(true).setMessage("initial commit").call();
}
} }
@Test @Test
public void commitAmendWithoutAuthorShouldSetOriginalAuthorAndAuthorTime() public void commitAmendWithoutAuthorShouldSetOriginalAuthorAndAuthorTime()
throws Exception { throws Exception {
Git git = new Git(db); try (Git git = new Git(db)) {
writeTrashFile("file1", "file1");
writeTrashFile("file1", "file1"); git.add().addFilepattern("file1").call();
git.add().addFilepattern("file1").call();
final String authorName = "First Author"; final String authorName = "First Author";
final String authorEmail = "author@example.org"; final String authorEmail = "author@example.org";
final Date authorDate = new Date(1349621117000L); final Date authorDate = new Date(1349621117000L);
PersonIdent firstAuthor = new PersonIdent(authorName, authorEmail, PersonIdent firstAuthor = new PersonIdent(authorName, authorEmail,
authorDate, TimeZone.getTimeZone("UTC")); authorDate, TimeZone.getTimeZone("UTC"));
git.commit().setMessage("initial commit").setAuthor(firstAuthor).call(); git.commit().setMessage("initial commit").setAuthor(firstAuthor).call();
RevCommit amended = git.commit().setAmend(true) RevCommit amended = git.commit().setAmend(true)
.setMessage("amend commit").call(); .setMessage("amend commit").call();
PersonIdent amendedAuthor = amended.getAuthorIdent(); PersonIdent amendedAuthor = amended.getAuthorIdent();
assertEquals(authorName, amendedAuthor.getName()); assertEquals(authorName, amendedAuthor.getName());
assertEquals(authorEmail, amendedAuthor.getEmailAddress()); assertEquals(authorEmail, amendedAuthor.getEmailAddress());
assertEquals(authorDate.getTime(), amendedAuthor.getWhen().getTime()); assertEquals(authorDate.getTime(), amendedAuthor.getWhen().getTime());
}
} }
@Test @Test
public void commitAmendWithAuthorShouldUseIt() throws Exception { public void commitAmendWithAuthorShouldUseIt() throws Exception {
Git git = new Git(db); try (Git git = new Git(db)) {
writeTrashFile("file1", "file1");
writeTrashFile("file1", "file1"); git.add().addFilepattern("file1").call();
git.add().addFilepattern("file1").call(); git.commit().setMessage("initial commit").call();
git.commit().setMessage("initial commit").call();
RevCommit amended = git.commit().setAmend(true) RevCommit amended = git.commit().setAmend(true)
.setAuthor("New Author", "newauthor@example.org") .setAuthor("New Author", "newauthor@example.org")
.setMessage("amend commit").call(); .setMessage("amend commit").call();
PersonIdent amendedAuthor = amended.getAuthorIdent(); PersonIdent amendedAuthor = amended.getAuthorIdent();
assertEquals("New Author", amendedAuthor.getName()); assertEquals("New Author", amendedAuthor.getName());
assertEquals("newauthor@example.org", amendedAuthor.getEmailAddress()); assertEquals("newauthor@example.org", amendedAuthor.getEmailAddress());
}
} }
@Test @Test
@ -532,18 +537,19 @@ public class CommitCommandTest extends RepositoryTestCase {
+ "[unmerged2, mode:100644, stage:3]", + "[unmerged2, mode:100644, stage:3]",
indexState(0)); indexState(0));
Git git = new Git(db); try (Git git = new Git(db)) {
RevCommit commit = git.commit().setOnly("unmerged1") RevCommit commit = git.commit().setOnly("unmerged1")
.setMessage("Only one file").call(); .setMessage("Only one file").call();
assertEquals("[other, mode:100644]" + "[unmerged1, mode:100644]" assertEquals("[other, mode:100644]" + "[unmerged1, mode:100644]"
+ "[unmerged2, mode:100644, stage:1]" + "[unmerged2, mode:100644, stage:1]"
+ "[unmerged2, mode:100644, stage:2]" + "[unmerged2, mode:100644, stage:2]"
+ "[unmerged2, mode:100644, stage:3]", + "[unmerged2, mode:100644, stage:3]",
indexState(0)); indexState(0));
try (TreeWalk walk = TreeWalk.forPath(db, "unmerged1", commit.getTree())) { try (TreeWalk walk = TreeWalk.forPath(db, "unmerged1", commit.getTree())) {
assertEquals(FileMode.REGULAR_FILE, walk.getFileMode(0)); assertEquals(FileMode.REGULAR_FILE, walk.getFileMode(0));
}
} }
} }

Loading…
Cancel
Save