|
|
@ -104,6 +104,12 @@ public class DiffCommand extends GitCommand<List<DiffEntry>> { |
|
|
|
super(repo); |
|
|
|
super(repo); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private DiffFormatter getDiffFormatter() { |
|
|
|
|
|
|
|
return out != null && !showNameAndStatusOnly |
|
|
|
|
|
|
|
? new DiffFormatter(new BufferedOutputStream(out)) |
|
|
|
|
|
|
|
: new DiffFormatter(NullOutputStream.INSTANCE); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* {@inheritDoc} |
|
|
|
* {@inheritDoc} |
|
|
|
* <p> |
|
|
|
* <p> |
|
|
@ -114,14 +120,9 @@ public class DiffCommand extends GitCommand<List<DiffEntry>> { |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public List<DiffEntry> call() throws GitAPIException { |
|
|
|
public List<DiffEntry> call() throws GitAPIException { |
|
|
|
final DiffFormatter diffFmt; |
|
|
|
try (DiffFormatter diffFmt = getDiffFormatter()) { |
|
|
|
if (out != null && !showNameAndStatusOnly) |
|
|
|
diffFmt.setRepository(repo); |
|
|
|
diffFmt = new DiffFormatter(new BufferedOutputStream(out)); |
|
|
|
diffFmt.setProgressMonitor(monitor); |
|
|
|
else |
|
|
|
|
|
|
|
diffFmt = new DiffFormatter(NullOutputStream.INSTANCE); |
|
|
|
|
|
|
|
diffFmt.setRepository(repo); |
|
|
|
|
|
|
|
diffFmt.setProgressMonitor(monitor); |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
if (cached) { |
|
|
|
if (cached) { |
|
|
|
if (oldTree == null) { |
|
|
|
if (oldTree == null) { |
|
|
|
ObjectId head = repo.resolve(HEAD + "^{tree}"); //$NON-NLS-1$
|
|
|
|
ObjectId head = repo.resolve(HEAD + "^{tree}"); //$NON-NLS-1$
|
|
|
@ -159,8 +160,6 @@ public class DiffCommand extends GitCommand<List<DiffEntry>> { |
|
|
|
} |
|
|
|
} |
|
|
|
} catch (IOException e) { |
|
|
|
} catch (IOException e) { |
|
|
|
throw new JGitInternalException(e.getMessage(), e); |
|
|
|
throw new JGitInternalException(e.getMessage(), e); |
|
|
|
} finally { |
|
|
|
|
|
|
|
diffFmt.close(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|