|
|
@ -288,13 +288,14 @@ public class RebaseCommandTest extends RepositoryTestCase { |
|
|
|
RebaseResult res = git.rebase().setUpstream("refs/heads/master").call(); |
|
|
|
RebaseResult res = git.rebase().setUpstream("refs/heads/master").call(); |
|
|
|
assertEquals(Status.OK, res.getStatus()); |
|
|
|
assertEquals(Status.OK, res.getStatus()); |
|
|
|
|
|
|
|
|
|
|
|
RevWalk rw = new RevWalk(db); |
|
|
|
try (RevWalk rw = new RevWalk(db)) { |
|
|
|
rw.markStart(rw.parseCommit(db.resolve("refs/heads/topic"))); |
|
|
|
rw.markStart(rw.parseCommit(db.resolve("refs/heads/topic"))); |
|
|
|
assertDerivedFrom(rw.next(), e); |
|
|
|
assertDerivedFrom(rw.next(), e); |
|
|
|
assertDerivedFrom(rw.next(), d); |
|
|
|
assertDerivedFrom(rw.next(), d); |
|
|
|
assertDerivedFrom(rw.next(), c); |
|
|
|
assertDerivedFrom(rw.next(), c); |
|
|
|
assertEquals(b, rw.next()); |
|
|
|
assertEquals(b, rw.next()); |
|
|
|
assertEquals(a, rw.next()); |
|
|
|
assertEquals(a, rw.next()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
List<ReflogEntry> headLog = db.getReflogReader(Constants.HEAD) |
|
|
|
List<ReflogEntry> headLog = db.getReflogReader(Constants.HEAD) |
|
|
|
.getReverseEntries(); |
|
|
|
.getReverseEntries(); |
|
|
@ -354,8 +355,6 @@ public class RebaseCommandTest extends RepositoryTestCase { |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private void doTestRebasePreservingMerges(boolean testConflict) |
|
|
|
private void doTestRebasePreservingMerges(boolean testConflict) |
|
|
|
throws Exception { |
|
|
|
throws Exception { |
|
|
|
RevWalk rw = new RevWalk(db); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// create file1 on master
|
|
|
|
// create file1 on master
|
|
|
|
writeTrashFile(FILE1, FILE1); |
|
|
|
writeTrashFile(FILE1, FILE1); |
|
|
|
git.add().addFilepattern(FILE1).call(); |
|
|
|
git.add().addFilepattern(FILE1).call(); |
|
|
@ -409,8 +408,10 @@ public class RebaseCommandTest extends RepositoryTestCase { |
|
|
|
f = git.commit().setMessage("commit f").call(); |
|
|
|
f = git.commit().setMessage("commit f").call(); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
assertEquals(MergeStatus.MERGED, result.getMergeStatus()); |
|
|
|
assertEquals(MergeStatus.MERGED, result.getMergeStatus()); |
|
|
|
|
|
|
|
try (RevWalk rw = new RevWalk(db)) { |
|
|
|
f = rw.parseCommit(result.getNewHead()); |
|
|
|
f = rw.parseCommit(result.getNewHead()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
RebaseResult res = git.rebase().setUpstream("refs/heads/master") |
|
|
|
RebaseResult res = git.rebase().setUpstream("refs/heads/master") |
|
|
|
.setPreserveMerges(true).call(); |
|
|
|
.setPreserveMerges(true).call(); |
|
|
@ -453,6 +454,7 @@ public class RebaseCommandTest extends RepositoryTestCase { |
|
|
|
assertEquals("file2", read("file2")); |
|
|
|
assertEquals("file2", read("file2")); |
|
|
|
assertEquals("more change", read("file3")); |
|
|
|
assertEquals("more change", read("file3")); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try (RevWalk rw = new RevWalk(db)) { |
|
|
|
rw.markStart(rw.parseCommit(db.resolve("refs/heads/topic"))); |
|
|
|
rw.markStart(rw.parseCommit(db.resolve("refs/heads/topic"))); |
|
|
|
RevCommit newF = rw.next(); |
|
|
|
RevCommit newF = rw.next(); |
|
|
|
assertDerivedFrom(newF, f); |
|
|
|
assertDerivedFrom(newF, f); |
|
|
@ -471,6 +473,7 @@ public class RebaseCommandTest extends RepositoryTestCase { |
|
|
|
assertEquals(b, rw.next()); |
|
|
|
assertEquals(b, rw.next()); |
|
|
|
assertEquals(a, rw.next()); |
|
|
|
assertEquals(a, rw.next()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private String readFile(String path, RevCommit commit) throws IOException { |
|
|
|
private String readFile(String path, RevCommit commit) throws IOException { |
|
|
|
try (TreeWalk walk = TreeWalk.forPath(db, path, commit.getTree())) { |
|
|
|
try (TreeWalk walk = TreeWalk.forPath(db, path, commit.getTree())) { |
|
|
@ -517,7 +520,7 @@ public class RebaseCommandTest extends RepositoryTestCase { |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private void doTestRebasePreservingMergesWithUnrelatedSide( |
|
|
|
private void doTestRebasePreservingMergesWithUnrelatedSide( |
|
|
|
boolean testConflict) throws Exception { |
|
|
|
boolean testConflict) throws Exception { |
|
|
|
RevWalk rw = new RevWalk(db); |
|
|
|
try (RevWalk rw = new RevWalk(db)) { |
|
|
|
rw.sort(RevSort.TOPO); |
|
|
|
rw.sort(RevSort.TOPO); |
|
|
|
|
|
|
|
|
|
|
|
writeTrashFile(FILE1, FILE1); |
|
|
|
writeTrashFile(FILE1, FILE1); |
|
|
@ -600,6 +603,7 @@ public class RebaseCommandTest extends RepositoryTestCase { |
|
|
|
assertEquals(b, rw.next()); |
|
|
|
assertEquals(b, rw.next()); |
|
|
|
assertEquals(a, rw.next()); |
|
|
|
assertEquals(a, rw.next()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void testRebaseParentOntoHeadShouldBeUptoDate() throws Exception { |
|
|
|
public void testRebaseParentOntoHeadShouldBeUptoDate() throws Exception { |
|
|
@ -687,8 +691,10 @@ public class RebaseCommandTest extends RepositoryTestCase { |
|
|
|
checkFile(theFile, "1master\n2\n3\ntopic\n"); |
|
|
|
checkFile(theFile, "1master\n2\n3\ntopic\n"); |
|
|
|
// our old branch should be checked out again
|
|
|
|
// our old branch should be checked out again
|
|
|
|
assertEquals("refs/heads/topic", db.getFullBranch()); |
|
|
|
assertEquals("refs/heads/topic", db.getFullBranch()); |
|
|
|
assertEquals(lastMasterChange, new RevWalk(db).parseCommit( |
|
|
|
try (RevWalk rw = new RevWalk(db)) { |
|
|
|
|
|
|
|
assertEquals(lastMasterChange, rw.parseCommit( |
|
|
|
db.resolve(Constants.HEAD)).getParent(0)); |
|
|
|
db.resolve(Constants.HEAD)).getParent(0)); |
|
|
|
|
|
|
|
} |
|
|
|
assertEquals(origHead, db.readOrigHead()); |
|
|
|
assertEquals(origHead, db.readOrigHead()); |
|
|
|
List<ReflogEntry> headLog = db.getReflogReader(Constants.HEAD) |
|
|
|
List<ReflogEntry> headLog = db.getReflogReader(Constants.HEAD) |
|
|
|
.getReverseEntries(); |
|
|
|
.getReverseEntries(); |
|
|
@ -737,8 +743,10 @@ public class RebaseCommandTest extends RepositoryTestCase { |
|
|
|
RebaseResult res = git.rebase().setUpstream("refs/heads/master").call(); |
|
|
|
RebaseResult res = git.rebase().setUpstream("refs/heads/master").call(); |
|
|
|
assertEquals(Status.OK, res.getStatus()); |
|
|
|
assertEquals(Status.OK, res.getStatus()); |
|
|
|
checkFile(theFile, "1master\n2\n3\ntopic\n"); |
|
|
|
checkFile(theFile, "1master\n2\n3\ntopic\n"); |
|
|
|
assertEquals(lastMasterChange, new RevWalk(db).parseCommit( |
|
|
|
try (RevWalk rw = new RevWalk(db)) { |
|
|
|
|
|
|
|
assertEquals(lastMasterChange, rw.parseCommit( |
|
|
|
db.resolve(Constants.HEAD)).getParent(0)); |
|
|
|
db.resolve(Constants.HEAD)).getParent(0)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
List<ReflogEntry> headLog = db.getReflogReader(Constants.HEAD) |
|
|
|
List<ReflogEntry> headLog = db.getReflogReader(Constants.HEAD) |
|
|
|
.getReverseEntries(); |
|
|
|
.getReverseEntries(); |
|
|
@ -785,8 +793,10 @@ public class RebaseCommandTest extends RepositoryTestCase { |
|
|
|
|
|
|
|
|
|
|
|
// our old branch should be checked out again
|
|
|
|
// our old branch should be checked out again
|
|
|
|
assertEquals("refs/heads/file3", db.getFullBranch()); |
|
|
|
assertEquals("refs/heads/file3", db.getFullBranch()); |
|
|
|
assertEquals(addFile2, new RevWalk(db).parseCommit( |
|
|
|
try (RevWalk rw = new RevWalk(db)) { |
|
|
|
|
|
|
|
assertEquals(addFile2, rw.parseCommit( |
|
|
|
db.resolve(Constants.HEAD)).getParent(0)); |
|
|
|
db.resolve(Constants.HEAD)).getParent(0)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
checkoutBranch("refs/heads/file2"); |
|
|
|
checkoutBranch("refs/heads/file2"); |
|
|
|
assertTrue(new File(db.getWorkTree(), FILE1).exists()); |
|
|
|
assertTrue(new File(db.getWorkTree(), FILE1).exists()); |
|
|
@ -846,9 +856,10 @@ public class RebaseCommandTest extends RepositoryTestCase { |
|
|
|
assertEquals(res.getStatus(), Status.ABORTED); |
|
|
|
assertEquals(res.getStatus(), Status.ABORTED); |
|
|
|
assertEquals("refs/heads/topic", db.getFullBranch()); |
|
|
|
assertEquals("refs/heads/topic", db.getFullBranch()); |
|
|
|
checkFile(FILE1, "1topic", "2", "3", "topic4"); |
|
|
|
checkFile(FILE1, "1topic", "2", "3", "topic4"); |
|
|
|
RevWalk rw = new RevWalk(db); |
|
|
|
try (RevWalk rw = new RevWalk(db)) { |
|
|
|
assertEquals(lastTopicCommit, rw |
|
|
|
assertEquals(lastTopicCommit, |
|
|
|
.parseCommit(db.resolve(Constants.HEAD))); |
|
|
|
rw.parseCommit(db.resolve(Constants.HEAD))); |
|
|
|
|
|
|
|
} |
|
|
|
assertEquals(RepositoryState.SAFE, db.getRepositoryState()); |
|
|
|
assertEquals(RepositoryState.SAFE, db.getRepositoryState()); |
|
|
|
|
|
|
|
|
|
|
|
// rebase- dir in .git must be deleted
|
|
|
|
// rebase- dir in .git must be deleted
|
|
|
@ -909,9 +920,10 @@ public class RebaseCommandTest extends RepositoryTestCase { |
|
|
|
assertEquals(res.getStatus(), Status.ABORTED); |
|
|
|
assertEquals(res.getStatus(), Status.ABORTED); |
|
|
|
assertEquals(lastTopicCommit.getName(), db.getFullBranch()); |
|
|
|
assertEquals(lastTopicCommit.getName(), db.getFullBranch()); |
|
|
|
checkFile(FILE1, "1topic", "2", "3", "topic4"); |
|
|
|
checkFile(FILE1, "1topic", "2", "3", "topic4"); |
|
|
|
RevWalk rw = new RevWalk(db); |
|
|
|
try (RevWalk rw = new RevWalk(db)) { |
|
|
|
assertEquals(lastTopicCommit, |
|
|
|
assertEquals(lastTopicCommit, |
|
|
|
rw.parseCommit(db.resolve(Constants.HEAD))); |
|
|
|
rw.parseCommit(db.resolve(Constants.HEAD))); |
|
|
|
|
|
|
|
} |
|
|
|
assertEquals(RepositoryState.SAFE, db.getRepositoryState()); |
|
|
|
assertEquals(RepositoryState.SAFE, db.getRepositoryState()); |
|
|
|
|
|
|
|
|
|
|
|
// rebase- dir in .git must be deleted
|
|
|
|
// rebase- dir in .git must be deleted
|
|
|
@ -966,12 +978,13 @@ public class RebaseCommandTest extends RepositoryTestCase { |
|
|
|
assertEquals(RepositoryState.SAFE, db.getRepositoryState()); |
|
|
|
assertEquals(RepositoryState.SAFE, db.getRepositoryState()); |
|
|
|
|
|
|
|
|
|
|
|
ObjectId headId = db.resolve(Constants.HEAD); |
|
|
|
ObjectId headId = db.resolve(Constants.HEAD); |
|
|
|
RevWalk rw = new RevWalk(db); |
|
|
|
try (RevWalk rw = new RevWalk(db)) { |
|
|
|
RevCommit rc = rw.parseCommit(headId); |
|
|
|
RevCommit rc = rw.parseCommit(headId); |
|
|
|
RevCommit parent = rw.parseCommit(rc.getParent(0)); |
|
|
|
RevCommit parent = rw.parseCommit(rc.getParent(0)); |
|
|
|
assertEquals("change file1 in topic\n\nThis is conflicting", parent |
|
|
|
assertEquals("change file1 in topic\n\nThis is conflicting", parent |
|
|
|
.getFullMessage()); |
|
|
|
.getFullMessage()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void testStopOnConflictAndContinueWithNoDeltaToMaster() |
|
|
|
public void testStopOnConflictAndContinueWithNoDeltaToMaster() |
|
|
@ -1017,10 +1030,11 @@ public class RebaseCommandTest extends RepositoryTestCase { |
|
|
|
git.rebase().setOperation(Operation.SKIP).call(); |
|
|
|
git.rebase().setOperation(Operation.SKIP).call(); |
|
|
|
|
|
|
|
|
|
|
|
ObjectId headId = db.resolve(Constants.HEAD); |
|
|
|
ObjectId headId = db.resolve(Constants.HEAD); |
|
|
|
RevWalk rw = new RevWalk(db); |
|
|
|
try (RevWalk rw = new RevWalk(db)) { |
|
|
|
RevCommit rc = rw.parseCommit(headId); |
|
|
|
RevCommit rc = rw.parseCommit(headId); |
|
|
|
assertEquals("change file1 in master", rc.getFullMessage()); |
|
|
|
assertEquals("change file1 in master", rc.getFullMessage()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void testStopOnConflictAndFailContinueIfFileIsDirty() |
|
|
|
public void testStopOnConflictAndFailContinueIfFileIsDirty() |
|
|
@ -1308,11 +1322,12 @@ public class RebaseCommandTest extends RepositoryTestCase { |
|
|
|
git.rebase().setOperation(Operation.SKIP).call(); |
|
|
|
git.rebase().setOperation(Operation.SKIP).call(); |
|
|
|
|
|
|
|
|
|
|
|
ObjectId headId = db.resolve(Constants.HEAD); |
|
|
|
ObjectId headId = db.resolve(Constants.HEAD); |
|
|
|
RevWalk rw = new RevWalk(db); |
|
|
|
try (RevWalk rw = new RevWalk(db)) { |
|
|
|
RevCommit rc = rw.parseCommit(headId); |
|
|
|
RevCommit rc = rw.parseCommit(headId); |
|
|
|
RevCommit parent = rw.parseCommit(rc.getParent(0)); |
|
|
|
RevCommit parent = rw.parseCommit(rc.getParent(0)); |
|
|
|
assertEquals("A different commit message", parent.getFullMessage()); |
|
|
|
assertEquals("A different commit message", parent.getFullMessage()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private RevCommit writeFileAndCommit(String fileName, String commitMessage, |
|
|
|
private RevCommit writeFileAndCommit(String fileName, String commitMessage, |
|
|
|
String... lines) throws Exception { |
|
|
|
String... lines) throws Exception { |
|
|
@ -1420,9 +1435,10 @@ public class RebaseCommandTest extends RepositoryTestCase { |
|
|
|
res = git.rebase().setOperation(Operation.ABORT).call(); |
|
|
|
res = git.rebase().setOperation(Operation.ABORT).call(); |
|
|
|
assertEquals(res.getStatus(), Status.ABORTED); |
|
|
|
assertEquals(res.getStatus(), Status.ABORTED); |
|
|
|
assertEquals("refs/heads/topic", db.getFullBranch()); |
|
|
|
assertEquals("refs/heads/topic", db.getFullBranch()); |
|
|
|
RevWalk rw = new RevWalk(db); |
|
|
|
try (RevWalk rw = new RevWalk(db)) { |
|
|
|
assertEquals(conflicting, rw.parseCommit(db.resolve(Constants.HEAD))); |
|
|
|
assertEquals(conflicting, rw.parseCommit(db.resolve(Constants.HEAD))); |
|
|
|
assertEquals(RepositoryState.SAFE, db.getRepositoryState()); |
|
|
|
assertEquals(RepositoryState.SAFE, db.getRepositoryState()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// rebase- dir in .git must be deleted
|
|
|
|
// rebase- dir in .git must be deleted
|
|
|
|
assertFalse(new File(db.getDirectory(), "rebase-merge").exists()); |
|
|
|
assertFalse(new File(db.getDirectory(), "rebase-merge").exists()); |
|
|
@ -2286,7 +2302,7 @@ public class RebaseCommandTest extends RepositoryTestCase { |
|
|
|
assertEquals(RebaseResult.Status.OK, res2.getStatus()); |
|
|
|
assertEquals(RebaseResult.Status.OK, res2.getStatus()); |
|
|
|
|
|
|
|
|
|
|
|
ObjectId headId = db.resolve(Constants.HEAD); |
|
|
|
ObjectId headId = db.resolve(Constants.HEAD); |
|
|
|
RevWalk rw = new RevWalk(db); |
|
|
|
try (RevWalk rw = new RevWalk(db)) { |
|
|
|
RevCommit rc = rw.parseCommit(headId); |
|
|
|
RevCommit rc = rw.parseCommit(headId); |
|
|
|
|
|
|
|
|
|
|
|
ObjectId head1Id = db.resolve(Constants.HEAD + "~1"); |
|
|
|
ObjectId head1Id = db.resolve(Constants.HEAD + "~1"); |
|
|
@ -2295,6 +2311,7 @@ public class RebaseCommandTest extends RepositoryTestCase { |
|
|
|
assertEquals(rc.getFullMessage(), c4.getFullMessage()); |
|
|
|
assertEquals(rc.getFullMessage(), c4.getFullMessage()); |
|
|
|
assertEquals(rc1.getFullMessage(), c2.getFullMessage()); |
|
|
|
assertEquals(rc1.getFullMessage(), c2.getFullMessage()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void testParseRewordCommand() throws Exception { |
|
|
|
public void testParseRewordCommand() throws Exception { |
|
|
@ -2643,7 +2660,7 @@ public class RebaseCommandTest extends RepositoryTestCase { |
|
|
|
} |
|
|
|
} |
|
|
|
}).call(); |
|
|
|
}).call(); |
|
|
|
|
|
|
|
|
|
|
|
RevWalk walk = new RevWalk(db); |
|
|
|
try (RevWalk walk = new RevWalk(db)) { |
|
|
|
ObjectId headId = db.resolve(Constants.HEAD); |
|
|
|
ObjectId headId = db.resolve(Constants.HEAD); |
|
|
|
RevCommit headCommit = walk.parseCommit(headId); |
|
|
|
RevCommit headCommit = walk.parseCommit(headId); |
|
|
|
assertEquals(headCommit.getFullMessage(), |
|
|
|
assertEquals(headCommit.getFullMessage(), |
|
|
@ -2653,6 +2670,7 @@ public class RebaseCommandTest extends RepositoryTestCase { |
|
|
|
RevCommit head1Commit = walk.parseCommit(head2Id); |
|
|
|
RevCommit head1Commit = walk.parseCommit(head2Id); |
|
|
|
assertEquals("changed", head1Commit.getFullMessage()); |
|
|
|
assertEquals("changed", head1Commit.getFullMessage()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void testRebaseInteractiveMultipleSquash() throws Exception { |
|
|
|
public void testRebaseInteractiveMultipleSquash() throws Exception { |
|
|
@ -2722,7 +2740,7 @@ public class RebaseCommandTest extends RepositoryTestCase { |
|
|
|
} |
|
|
|
} |
|
|
|
}).call(); |
|
|
|
}).call(); |
|
|
|
|
|
|
|
|
|
|
|
RevWalk walk = new RevWalk(db); |
|
|
|
try (RevWalk walk = new RevWalk(db)) { |
|
|
|
ObjectId headId = db.resolve(Constants.HEAD); |
|
|
|
ObjectId headId = db.resolve(Constants.HEAD); |
|
|
|
RevCommit headCommit = walk.parseCommit(headId); |
|
|
|
RevCommit headCommit = walk.parseCommit(headId); |
|
|
|
assertEquals(headCommit.getFullMessage(), |
|
|
|
assertEquals(headCommit.getFullMessage(), |
|
|
@ -2734,6 +2752,7 @@ public class RebaseCommandTest extends RepositoryTestCase { |
|
|
|
"Add file1\nnew line\nAdd file2\nnew line\nupdated file1 on master\nnew line", |
|
|
|
"Add file1\nnew line\nAdd file2\nnew line\nupdated file1 on master\nnew line", |
|
|
|
head1Commit.getFullMessage()); |
|
|
|
head1Commit.getFullMessage()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void testRebaseInteractiveMixedSquashAndFixup() throws Exception { |
|
|
|
public void testRebaseInteractiveMixedSquashAndFixup() throws Exception { |
|
|
@ -2804,7 +2823,7 @@ public class RebaseCommandTest extends RepositoryTestCase { |
|
|
|
} |
|
|
|
} |
|
|
|
}).call(); |
|
|
|
}).call(); |
|
|
|
|
|
|
|
|
|
|
|
RevWalk walk = new RevWalk(db); |
|
|
|
try (RevWalk walk = new RevWalk(db)) { |
|
|
|
ObjectId headId = db.resolve(Constants.HEAD); |
|
|
|
ObjectId headId = db.resolve(Constants.HEAD); |
|
|
|
RevCommit headCommit = walk.parseCommit(headId); |
|
|
|
RevCommit headCommit = walk.parseCommit(headId); |
|
|
|
assertEquals(headCommit.getFullMessage(), |
|
|
|
assertEquals(headCommit.getFullMessage(), |
|
|
@ -2814,6 +2833,7 @@ public class RebaseCommandTest extends RepositoryTestCase { |
|
|
|
RevCommit head1Commit = walk.parseCommit(head2Id); |
|
|
|
RevCommit head1Commit = walk.parseCommit(head2Id); |
|
|
|
assertEquals("changed", head1Commit.getFullMessage()); |
|
|
|
assertEquals("changed", head1Commit.getFullMessage()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void testRebaseInteractiveSingleFixup() throws Exception { |
|
|
|
public void testRebaseInteractiveSingleFixup() throws Exception { |
|
|
@ -2855,7 +2875,7 @@ public class RebaseCommandTest extends RepositoryTestCase { |
|
|
|
} |
|
|
|
} |
|
|
|
}).call(); |
|
|
|
}).call(); |
|
|
|
|
|
|
|
|
|
|
|
RevWalk walk = new RevWalk(db); |
|
|
|
try (RevWalk walk = new RevWalk(db)) { |
|
|
|
ObjectId headId = db.resolve(Constants.HEAD); |
|
|
|
ObjectId headId = db.resolve(Constants.HEAD); |
|
|
|
RevCommit headCommit = walk.parseCommit(headId); |
|
|
|
RevCommit headCommit = walk.parseCommit(headId); |
|
|
|
assertEquals("update file2 on master\nnew line", |
|
|
|
assertEquals("update file2 on master\nnew line", |
|
|
@ -2866,6 +2886,7 @@ public class RebaseCommandTest extends RepositoryTestCase { |
|
|
|
assertEquals("Add file2\nnew line", |
|
|
|
assertEquals("Add file2\nnew line", |
|
|
|
head1Commit.getFullMessage()); |
|
|
|
head1Commit.getFullMessage()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void testRebaseInteractiveFixupWithBlankLines() throws Exception { |
|
|
|
public void testRebaseInteractiveFixupWithBlankLines() throws Exception { |
|
|
@ -2903,12 +2924,13 @@ public class RebaseCommandTest extends RepositoryTestCase { |
|
|
|
} |
|
|
|
} |
|
|
|
}).call(); |
|
|
|
}).call(); |
|
|
|
|
|
|
|
|
|
|
|
RevWalk walk = new RevWalk(db); |
|
|
|
try (RevWalk walk = new RevWalk(db)) { |
|
|
|
ObjectId headId = db.resolve(Constants.HEAD); |
|
|
|
ObjectId headId = db.resolve(Constants.HEAD); |
|
|
|
RevCommit headCommit = walk.parseCommit(headId); |
|
|
|
RevCommit headCommit = walk.parseCommit(headId); |
|
|
|
assertEquals("Add file2", |
|
|
|
assertEquals("Add file2", |
|
|
|
headCommit.getFullMessage()); |
|
|
|
headCommit.getFullMessage()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test(expected = InvalidRebaseStepException.class) |
|
|
|
@Test(expected = InvalidRebaseStepException.class) |
|
|
|
public void testRebaseInteractiveFixupFirstCommitShouldFail() |
|
|
|
public void testRebaseInteractiveFixupFirstCommitShouldFail() |
|
|
|