|
|
@ -665,16 +665,10 @@ public class DiffFormatter implements AutoCloseable { |
|
|
|
format(res.header, res.a, res.b); |
|
|
|
format(res.header, res.a, res.b); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private static void writeGitLinkDiffText(OutputStream o, DiffEntry ent) |
|
|
|
private static byte[] writeGitLinkText(AbbreviatedObjectId id) |
|
|
|
throws IOException { |
|
|
|
throws IOException { |
|
|
|
if (ent.getOldMode() == GITLINK) { |
|
|
|
return encodeASCII("Subproject commit " + id.name() //$NON-NLS-1$
|
|
|
|
o.write(encodeASCII("-Subproject commit " + ent.getOldId().name() //$NON-NLS-1$
|
|
|
|
+ "\n"); |
|
|
|
+ "\n")); //$NON-NLS-1$
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (ent.getNewMode() == GITLINK) { |
|
|
|
|
|
|
|
o.write(encodeASCII("+Subproject commit " + ent.getNewId().name() //$NON-NLS-1$
|
|
|
|
|
|
|
|
+ "\n")); //$NON-NLS-1$
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private String format(AbbreviatedObjectId id) { |
|
|
|
private String format(AbbreviatedObjectId id) { |
|
|
@ -938,13 +932,7 @@ public class DiffFormatter implements AutoCloseable { |
|
|
|
|
|
|
|
|
|
|
|
formatHeader(buf, ent); |
|
|
|
formatHeader(buf, ent); |
|
|
|
|
|
|
|
|
|
|
|
if (ent.getOldMode() == GITLINK || ent.getNewMode() == GITLINK) { |
|
|
|
if (ent.getOldId() == null || ent.getNewId() == null) { |
|
|
|
formatOldNewPaths(buf, ent); |
|
|
|
|
|
|
|
writeGitLinkDiffText(buf, ent); |
|
|
|
|
|
|
|
editList = new EditList(); |
|
|
|
|
|
|
|
type = PatchType.UNIFIED; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} else if (ent.getOldId() == null || ent.getNewId() == null) { |
|
|
|
|
|
|
|
// Content not changed (e.g. only mode, pure rename)
|
|
|
|
// Content not changed (e.g. only mode, pure rename)
|
|
|
|
editList = new EditList(); |
|
|
|
editList = new EditList(); |
|
|
|
type = PatchType.UNIFIED; |
|
|
|
type = PatchType.UNIFIED; |
|
|
@ -952,8 +940,15 @@ public class DiffFormatter implements AutoCloseable { |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
assertHaveRepository(); |
|
|
|
assertHaveRepository(); |
|
|
|
|
|
|
|
|
|
|
|
byte[] aRaw = open(OLD, ent); |
|
|
|
byte[] aRaw, bRaw; |
|
|
|
byte[] bRaw = open(NEW, ent); |
|
|
|
|
|
|
|
|
|
|
|
if (ent.getOldMode() == GITLINK || ent.getNewMode() == GITLINK) { |
|
|
|
|
|
|
|
aRaw = writeGitLinkText(ent.getOldId()); |
|
|
|
|
|
|
|
bRaw = writeGitLinkText(ent.getNewId()); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
aRaw = open(OLD, ent); |
|
|
|
|
|
|
|
bRaw = open(NEW, ent); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (aRaw == BINARY || bRaw == BINARY //
|
|
|
|
if (aRaw == BINARY || bRaw == BINARY //
|
|
|
|
|| RawText.isBinary(aRaw) || RawText.isBinary(bRaw)) { |
|
|
|
|| RawText.isBinary(aRaw) || RawText.isBinary(bRaw)) { |
|
|
|