Browse Source

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
stable-0.7
Christian Halstrick 15 years ago
parent
commit
6549af4591
  1. 17
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Diff.java

17
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 @@ package org.eclipse.jgit.pgm;
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 @@ class Diff extends TextBuiltin {
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 @@ class Diff extends TextBuiltin {
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 @@ class Diff extends TextBuiltin {
}
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());
}

Loading…
Cancel
Save