From 6549af4591e84dd872ce6a92f6ea638770bd9696 Mon Sep 17 00:00:00 2001
From: Christian Halstrick <christian.halstrick@sap.com>
Date: Tue, 6 Oct 2009 11:16:31 +0200
Subject: [PATCH] Fix some warnings regarding unnecessary imports and accessing
 static methods

My Galileo eclipse was complaining about unneeded import statements and
how static methods have been accessed in Diff.java. There was also one method
call which could be removed because he had no sideeffects and the return value
was not used. I fixed this so that there are no warnings anymore.

Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
Change-Id: I48d7e01536aab1524140d72af574e3fd7149cd23
---
 .../src/org/eclipse/jgit/pgm/Diff.java          | 17 ++++-------------
 1 file changed, 4 insertions(+), 13 deletions(-)

diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Diff.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Diff.java
index 3b327efd7..24bcdcc61 100644
--- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Diff.java
+++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Diff.java
@@ -1,4 +1,5 @@
 /*
+ * Copyright (C) 2009, Christian Halstrick <christian.halstrick@sap.com>
  * Copyright (C) 2009, Johannes E. Schindelin
  * Copyright (C) 2009, Johannes Schindelin <johannes.schindelin@gmx.de>
  * and other copyright owners as documented in the project's IP log.
@@ -46,29 +47,20 @@
 
 import java.io.IOException;
 import java.io.PrintStream;
-
 import java.util.ArrayList;
 import java.util.List;
 
 import org.kohsuke.args4j.Argument;
-import org.kohsuke.args4j.ExampleMode;
 import org.kohsuke.args4j.Option;
 
 import org.eclipse.jgit.diff.DiffFormatter;
 import org.eclipse.jgit.diff.MyersDiff;
 import org.eclipse.jgit.diff.RawText;
-
-import org.eclipse.jgit.lib.Constants;
 import org.eclipse.jgit.lib.FileMode;
 import org.eclipse.jgit.lib.ObjectId;
-import org.eclipse.jgit.lib.Ref;
-
-import org.eclipse.jgit.pgm.opt.CmdLineParser;
 import org.eclipse.jgit.pgm.opt.PathTreeFilterHandler;
-
 import org.eclipse.jgit.treewalk.AbstractTreeIterator;
 import org.eclipse.jgit.treewalk.TreeWalk;
-
 import org.eclipse.jgit.treewalk.filter.AndTreeFilter;
 import org.eclipse.jgit.treewalk.filter.TreeFilter;
 
@@ -96,7 +88,6 @@ protected void run() throws Exception {
 			walk.addTree(i);
 		walk.setFilter(AndTreeFilter.create(TreeFilter.ANY_DIFF, pathFilter));
 
-		final int nTree = walk.getTreeCount();
 		while (walk.next())
 			outputDiff(System.out, walk.getPathString(),
 				walk.getObjectId(0), walk.getFileMode(0),
@@ -110,10 +101,10 @@ protected void outputDiff(PrintStream out, String path,
 		out.println("diff --git " + name1 + " " + name2);
 		boolean isNew=false;
 		boolean isDelete=false;
-		if (id1.equals(id1.zeroId())) {
+		if (id1.equals(ObjectId.zeroId())) {
 			out.println("new file mode " + mode2);
 			isNew=true;
-		} else if (id2.equals(id2.zeroId())) {
+		} else if (id2.equals(ObjectId.zeroId())) {
 			out.println("deleted file mode " + mode1);
 			isDelete=true;
 		} else if (!mode1.equals(mode2)) {
@@ -132,7 +123,7 @@ protected void outputDiff(PrintStream out, String path,
 	}
 
 	private RawText getRawText(ObjectId id) throws IOException {
-		if (id.equals(id.zeroId()))
+		if (id.equals(ObjectId.zeroId()))
 			return new RawText(new byte[] { });
 		return new RawText(db.openBlob(id).getCachedBytes());
 	}
-- 
GitLab