@ -46,6 +46,7 @@ package org.eclipse.jgit.diff;
import static org.eclipse.jgit.lib.Constants.encode ;
import static org.eclipse.jgit.lib.Constants.encode ;
import static org.eclipse.jgit.lib.Constants.encodeASCII ;
import static org.eclipse.jgit.lib.Constants.encodeASCII ;
import static org.eclipse.jgit.lib.FileMode.GITLINK ;
import java.io.IOException ;
import java.io.IOException ;
import java.io.OutputStream ;
import java.io.OutputStream ;
@ -232,16 +233,27 @@ public class DiffFormatter {
out . write ( encode ( "--- " + oldName + '\n' ) ) ;
out . write ( encode ( "--- " + oldName + '\n' ) ) ;
out . write ( encode ( "+++ " + newName + '\n' ) ) ;
out . write ( encode ( "+++ " + newName + '\n' ) ) ;
byte [ ] aRaw = open ( ent . getOldMode ( ) , ent . getOldId ( ) ) ;
if ( ent . getOldMode ( ) = = GITLINK | | ent . getNewMode ( ) = = GITLINK ) {
byte [ ] bRaw = open ( ent . getNewMode ( ) , ent . getNewId ( ) ) ;
if ( ent . getOldMode ( ) = = GITLINK ) {
out . write ( encodeASCII ( "-Subproject commit "
+ ent . getOldId ( ) . name ( ) + "\n" ) ) ;
}
if ( ent . getNewMode ( ) = = GITLINK ) {
out . write ( encodeASCII ( "+Subproject commit "
+ ent . getNewId ( ) . name ( ) + "\n" ) ) ;
}
} else {
byte [ ] aRaw = open ( ent . getOldMode ( ) , ent . getOldId ( ) ) ;
byte [ ] bRaw = open ( ent . getNewMode ( ) , ent . getNewId ( ) ) ;
if ( RawText . isBinary ( aRaw ) | | RawText . isBinary ( bRaw ) ) {
if ( RawText . isBinary ( aRaw ) | | RawText . isBinary ( bRaw ) ) {
out . write ( encodeASCII ( "Binary files differ\n" ) ) ;
out . write ( encodeASCII ( "Binary files differ\n" ) ) ;
} else {
} else {
RawText a = newRawText ( aRaw ) ;
RawText a = newRawText ( aRaw ) ;
RawText b = newRawText ( bRaw ) ;
RawText b = newRawText ( bRaw ) ;
formatEdits ( a , b , new MyersDiff ( a , b ) . getEdits ( ) ) ;
formatEdits ( a , b , new MyersDiff ( a , b ) . getEdits ( ) ) ;
}
}
}
}
}