@ -1059,7 +1059,6 @@ public class RebaseCommandTest extends RepositoryTestCase {
}
}
@Test
@Test
@SuppressWarnings ( "null" )
public void testRebaseWithUnstagedTopicChange ( ) throws Exception {
public void testRebaseWithUnstagedTopicChange ( ) throws Exception {
// create file1, add and commit
// create file1, add and commit
writeTrashFile ( FILE1 , "file1" ) ;
writeTrashFile ( FILE1 , "file1" ) ;
@ -1084,19 +1083,14 @@ public class RebaseCommandTest extends RepositoryTestCase {
writeTrashFile ( "file2" , "unstaged file2" ) ;
writeTrashFile ( "file2" , "unstaged file2" ) ;
// rebase
// rebase
JGitInternalException exception = null ;
RebaseResult result = git . rebase ( ) . setUpstream ( "refs/heads/master" )
try {
. call ( ) ;
git . rebase ( ) . setUpstream ( "refs/heads/master" ) . call ( ) ;
assertEquals ( Status . CONFLICTS , result . getStatus ( ) ) ;
} catch ( JGitInternalException e ) {
assertEquals ( 1 , result . getConflicts ( ) . size ( ) ) ;
exception = e ;
assertEquals ( "file2" , result . getConflicts ( ) . get ( 0 ) ) ;
}
assertNotNull ( exception ) ;
assertEquals ( "Checkout conflict with files: \nfile2" ,
exception . getMessage ( ) ) ;
}
}
@Test
@Test
@SuppressWarnings ( "null" )
public void testRebaseWithUncommittedTopicChange ( ) throws Exception {
public void testRebaseWithUncommittedTopicChange ( ) throws Exception {
// create file1, add and commit
// create file1, add and commit
writeTrashFile ( FILE1 , "file1" ) ;
writeTrashFile ( FILE1 , "file1" ) ;
@ -1122,23 +1116,17 @@ public class RebaseCommandTest extends RepositoryTestCase {
git . add ( ) . addFilepattern ( "file2" ) . call ( ) ;
git . add ( ) . addFilepattern ( "file2" ) . call ( ) ;
// do not commit
// do not commit
// rebase
RebaseResult result = git . rebase ( ) . setUpstream ( "refs/heads/master" )
JGitInternalException exception = null ;
. call ( ) ;
try {
assertEquals ( Status . CONFLICTS , result . getStatus ( ) ) ;
git . rebase ( ) . setUpstream ( "refs/heads/master" ) . call ( ) ;
assertEquals ( 1 , result . getConflicts ( ) . size ( ) ) ;
} catch ( JGitInternalException e ) {
assertEquals ( "file2" , result . getConflicts ( ) . get ( 0 ) ) ;
exception = e ;
}
assertNotNull ( exception ) ;
assertEquals ( "Checkout conflict with files: \nfile2" ,
exception . getMessage ( ) ) ;
checkFile ( uncommittedFile , "uncommitted file2" ) ;
checkFile ( uncommittedFile , "uncommitted file2" ) ;
assertEquals ( RepositoryState . SAFE , git . getRepository ( ) . getRepositoryState ( ) ) ;
assertEquals ( RepositoryState . SAFE , git . getRepository ( ) . getRepositoryState ( ) ) ;
}
}
@Test
@Test
@SuppressWarnings ( "null" )
public void testRebaseWithUnstagedMasterChange ( ) throws Exception {
public void testRebaseWithUnstagedMasterChange ( ) throws Exception {
// create file1, add and commit
// create file1, add and commit
writeTrashFile ( FILE1 , "file1" ) ;
writeTrashFile ( FILE1 , "file1" ) ;
@ -1163,19 +1151,14 @@ public class RebaseCommandTest extends RepositoryTestCase {
writeTrashFile ( FILE1 , "unstaged modified file1" ) ;
writeTrashFile ( FILE1 , "unstaged modified file1" ) ;
// rebase
// rebase
JGitInternalException exception = null ;
RebaseResult result = git . rebase ( ) . setUpstream ( "refs/heads/master" )
try {
. call ( ) ;
git . rebase ( ) . setUpstream ( "refs/heads/master" ) . call ( ) ;
assertEquals ( Status . CONFLICTS , result . getStatus ( ) ) ;
} catch ( JGitInternalException e ) {
assertEquals ( 1 , result . getConflicts ( ) . size ( ) ) ;
exception = e ;
assertEquals ( FILE1 , result . getConflicts ( ) . get ( 0 ) ) ;
}
assertNotNull ( exception ) ;
assertEquals ( "Checkout conflict with files: \nfile1" ,
exception . getMessage ( ) ) ;
}
}
@Test
@Test
@SuppressWarnings ( "null" )
public void testRebaseWithUncommittedMasterChange ( ) throws Exception {
public void testRebaseWithUncommittedMasterChange ( ) throws Exception {
// create file1, add and commit
// create file1, add and commit
writeTrashFile ( FILE1 , "file1" ) ;
writeTrashFile ( FILE1 , "file1" ) ;
@ -1202,15 +1185,11 @@ public class RebaseCommandTest extends RepositoryTestCase {
// do not commit
// do not commit
// rebase
// rebase
JGitInternalException exception = null ;
RebaseResult result = git . rebase ( ) . setUpstream ( "refs/heads/master" )
try {
. call ( ) ;
git . rebase ( ) . setUpstream ( "refs/heads/master" ) . call ( ) ;
assertEquals ( Status . CONFLICTS , result . getStatus ( ) ) ;
} catch ( JGitInternalException e ) {
assertEquals ( 1 , result . getConflicts ( ) . size ( ) ) ;
exception = e ;
assertEquals ( FILE1 , result . getConflicts ( ) . get ( 0 ) ) ;
}
assertNotNull ( exception ) ;
assertEquals ( "Checkout conflict with files: \nfile1" ,
exception . getMessage ( ) ) ;
}
}
@Test
@Test
@ -1496,14 +1475,13 @@ public class RebaseCommandTest extends RepositoryTestCase {
File theFile = writeTrashFile ( FILE1 , "dirty the file" ) ;
File theFile = writeTrashFile ( FILE1 , "dirty the file" ) ;
// and attempt to rebase
// and attempt to rebase
try {
RebaseResult rebaseResult = git . rebase ( )
RebaseResult rebaseResult = git . rebase ( )
. setUpstream ( "refs/heads/master" ) . call ( ) ;
. setUpstream ( "refs/heads/master" ) . call ( ) ;
fail ( "Checkout with conflict should have occured, not "
assertEquals ( Status . CONFLICTS , rebaseResult . getStatus ( ) ) ;
+ rebaseResult . getStatus ( ) ) ;
assertEquals ( 1 , rebaseResult . getConflicts ( ) . size ( ) ) ;
} catch ( JGitInternalException e ) {
assertEquals ( FILE1 , rebaseResult . getConflicts ( ) . get ( 0 ) ) ;
checkFile ( theFile , "dirty the file" ) ;
checkFile ( theFile , "dirty the file" ) ;
}
assertEquals ( RepositoryState . SAFE , git . getRepository ( )
assertEquals ( RepositoryState . SAFE , git . getRepository ( )
. getRepositoryState ( ) ) ;
. getRepositoryState ( ) ) ;