@ -48,6 +48,7 @@ import org.eclipse.jgit.api.Git;
import org.eclipse.jgit.api.MergeResult ;
import org.eclipse.jgit.api.MergeResult ;
import org.eclipse.jgit.lib.CLIRepositoryTestCase ;
import org.eclipse.jgit.lib.CLIRepositoryTestCase ;
import org.eclipse.jgit.lib.Constants ;
import org.eclipse.jgit.lib.Constants ;
import org.eclipse.jgit.lib.PersonIdent ;
import org.eclipse.jgit.revwalk.RevCommit ;
import org.eclipse.jgit.revwalk.RevCommit ;
import org.junit.Rule ;
import org.junit.Rule ;
import org.junit.Test ;
import org.junit.Test ;
@ -90,7 +91,7 @@ public class BlameTest extends CLIRepositoryTestCase {
git . add ( ) . addFilepattern ( "inIndex.txt" ) . call ( ) ;
git . add ( ) . addFilepattern ( "inIndex.txt" ) . call ( ) ;
}
}
assertStringArrayEquals (
assertStringArrayEquals (
" (Not Committed Yet 1) index" ,
"00000000 (Not Committed Yet 2009-08-15 20:12:58 -0330 1) index" ,
execute ( "git blame inIndex.txt" ) ) ;
execute ( "git blame inIndex.txt" ) ) ;
}
}
@ -136,22 +137,24 @@ public class BlameTest extends CLIRepositoryTestCase {
writeTrashFile ( "file" ,
writeTrashFile ( "file" ,
"Conflicting change from side branch\n" ) ;
"Conflicting change from side branch\n" ) ;
git . add ( ) . addFilepattern ( "file" ) . call ( ) ;
git . add ( ) . addFilepattern ( "file" ) . call ( ) ;
RevCommit side = git . commit ( ) . setMessage ( "side commit" ) . call ( ) ;
RevCommit side = git . commit ( ) . setMessage ( "side commit" )
. setCommitter ( new PersonIdent ( "gitter" , "" ) ) . call ( ) ;
git . checkout ( ) . setName ( Constants . MASTER ) . call ( ) ;
git . checkout ( ) . setName ( Constants . MASTER ) . call ( ) ;
writeTrashFile ( "file" , "Change on master branch\n" ) ;
writeTrashFile ( "file" , "Change on master branch\n" ) ;
git . add ( ) . addFilepattern ( "file" ) . call ( ) ;
git . add ( ) . addFilepattern ( "file" ) . call ( ) ;
git . commit ( ) . setMessage ( "Commit conflict on master" ) . call ( ) ;
git . commit ( ) . setMessage ( "Commit conflict on master" )
. setCommitter ( new PersonIdent ( "gitter" , "" ) ) . call ( ) ;
MergeResult result = git . merge ( )
MergeResult result = git . merge ( )
. include ( "side" , side ) . call ( ) ;
. include ( "side" , side ) . call ( ) ;
assertTrue ( "Expected conflict on 'file'" ,
assertTrue ( "Expected conflict on 'file'" ,
result . getConflicts ( ) . containsKey ( "file" ) ) ;
result . getConflicts ( ) . containsKey ( "file" ) ) ;
}
}
String [ ] expected = {
String [ ] expected = {
" (Not Committed Yet 1) <<<<<<< HEAD" ,
"00000000 (Not Committed Yet 2009-08-15 20:12:58 -0330 1) <<<<<<< HEAD" ,
"7a918de5 (GIT_COMMITTER_NAME 2009-08-15 20:12:58 -0330 2) Change on master branch" ,
"0f5b671c (gitter 2009-08-15 20:12:58 -0330 2) Change on master branch" ,
" (Not Committed Yet 3) =======" ,
"00000000 (Not Committed Yet 2009-08-15 20:12:58 -0330 3) =======" ,
"beb52f68 (GIT_COMMITTER_NAME 2009-08-15 20:12:58 -0330 4) Conflicting change from side branch" ,
"ae78cff6 (gitter 2009-08-15 20:12:58 -0330 4) Conflicting change from side branch" ,
" (Not Committed Yet 5) >>>>>>> side" } ;
"00000000 (Not Committed Yet 2009-08-15 20:12:58 -0330 5) >>>>>>> side" } ;
assertArrayOfLinesEquals ( expected , execute ( "git blame file" ) ) ;
assertArrayOfLinesEquals ( expected , execute ( "git blame file" ) ) ;
}
}
}
}