Browse Source

TreeRevFilter: Refresh code to latest coding standards

Use brackets in all "if" statements and remove the "final" from local
variables and method arguments.

https://wiki.eclipse.org/EGit/Contributor_Guide#Coding_standards

Change-Id: I185f3112848fc1218cd7adb9828488f03fa4ddfc
Signed-off-by: Ivan Frade <ifrade@google.com>
stable-5.5
Ivan Frade 5 years ago
parent
commit
848d9f0d71
  1. 41
      org.eclipse.jgit/src/org/eclipse/jgit/revwalk/TreeRevFilter.java

41
org.eclipse.jgit/src/org/eclipse/jgit/revwalk/TreeRevFilter.java

@ -116,8 +116,7 @@ public class TreeRevFilter extends RevFilter {
* @param rewriteFlag
* flag to color commits to be removed from the simplified DAT.
*/
TreeRevFilter(final RevWalk walker, final TreeFilter t,
final int rewriteFlag) {
TreeRevFilter(RevWalk walker, TreeFilter t, int rewriteFlag) {
pathFilter = new TreeWalk(walker.reader);
pathFilter.setFilter(t);
pathFilter.setRecursive(t.shouldBeRecursive());
@ -137,14 +136,15 @@ public class TreeRevFilter extends RevFilter {
IncorrectObjectTypeException, IOException {
// Reset the tree filter to scan this commit and parents.
//
final RevCommit[] pList = c.parents;
final int nParents = pList.length;
final TreeWalk tw = pathFilter;
final ObjectId[] trees = new ObjectId[nParents + 1];
RevCommit[] pList = c.parents;
int nParents = pList.length;
TreeWalk tw = pathFilter;
ObjectId[] trees = new ObjectId[nParents + 1];
for (int i = 0; i < nParents; i++) {
final RevCommit p = c.parents[i];
if ((p.flags & PARSED) == 0)
RevCommit p = c.parents[i];
if ((p.flags & PARSED) == 0) {
p.parseHeaders(walker);
}
trees[i] = p.getTree();
}
trees[nParents] = c.getTree();
@ -156,11 +156,12 @@ public class TreeRevFilter extends RevFilter {
int chgs = 0, adds = 0;
while (tw.next()) {
chgs++;
if (tw.getRawMode(0) == 0 && tw.getRawMode(1) != 0)
if (tw.getRawMode(0) == 0 && tw.getRawMode(1) != 0) {
adds++;
else
} else {
break; // no point in looking at this further.
}
}
if (chgs == 0) {
// No changes, so our tree is effectively the same as
@ -185,8 +186,9 @@ public class TreeRevFilter extends RevFilter {
// We have no parents to compare against. Consider us to be
// REWRITE only if we have no paths matching our filter.
//
if (tw.next())
if (tw.next()) {
return true;
}
c.flags |= rewriteFlag;
return false;
}
@ -196,20 +198,21 @@ public class TreeRevFilter extends RevFilter {
// it does not contribute changes to us. Such a parent may be an
// uninteresting side branch.
//
final int[] chgs = new int[nParents];
final int[] adds = new int[nParents];
int[] chgs = new int[nParents];
int[] adds = new int[nParents];
while (tw.next()) {
final int myMode = tw.getRawMode(nParents);
int myMode = tw.getRawMode(nParents);
for (int i = 0; i < nParents; i++) {
final int pMode = tw.getRawMode(i);
if (myMode == pMode && tw.idEqual(i, nParents))
int pMode = tw.getRawMode(i);
if (myMode == pMode && tw.idEqual(i, nParents)) {
continue;
}
chgs[i]++;
if (pMode == 0 && myMode != 0)
if (pMode == 0 && myMode != 0) {
adds[i]++;
}
}
}
boolean same = false;
boolean diff = false;
@ -220,7 +223,7 @@ public class TreeRevFilter extends RevFilter {
// parent commit.
//
final RevCommit p = pList[i];
RevCommit p = pList[i];
if ((p.flags & UNINTERESTING) != 0) {
// This parent was marked as not interesting by the
// application. We should look for another parent

Loading…
Cancel
Save