From b3f4abdda1f00c7ca72f3c7c95e180e28b9aa776 Mon Sep 17 00:00:00 2001 From: RĂ¼diger Herrmann Date: Fri, 20 May 2016 14:06:08 +0200 Subject: Redirect all Show output to outs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Show command wrote all diffs to System.out instead of 'outs. Bug: 494143 Change-Id: Ibc78e9a058b7a32d536e03e294c1d933b6c26ba7 Signed-off-by: RĂ¼diger Herrmann Signed-off-by: Matthias Sohn --- org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Show.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'org.eclipse.jgit.pgm/src/org/eclipse/jgit') diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Show.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Show.java index c5986b01aa..6892c9973f 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Show.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Show.java @@ -63,6 +63,7 @@ import org.eclipse.jgit.lib.Constants; import org.eclipse.jgit.lib.FileMode; import org.eclipse.jgit.lib.ObjectId; import org.eclipse.jgit.lib.PersonIdent; +import org.eclipse.jgit.lib.Repository; import org.eclipse.jgit.pgm.internal.CLIText; import org.eclipse.jgit.pgm.opt.PathTreeFilterHandler; import org.eclipse.jgit.revwalk.RevCommit; @@ -81,8 +82,7 @@ class Show extends TextBuiltin { private final DateFormat fmt; - private final DiffFormatter diffFmt = new DiffFormatter( // - new BufferedOutputStream(System.out)); + private DiffFormatter diffFmt; @Argument(index = 0, metaVar = "metaVar_object") private String objectName; @@ -165,6 +165,12 @@ class Show extends TextBuiltin { fmt = new SimpleDateFormat("EEE MMM dd HH:mm:ss yyyy ZZZZZ", Locale.US); //$NON-NLS-1$ } + @Override + protected void init(final Repository repository, final String gitDir) { + super.init(repository, gitDir); + diffFmt = new DiffFormatter(new BufferedOutputStream(outs)); + } + @SuppressWarnings("boxing") @Override protected void run() throws Exception { -- cgit v1.2.3