Browse Source

Removed unread parameters

Some method parameters in WorkingTreeIterator are never used. Remove
them. Especially the removal of the FS parameter in isModified()
simplifies upcoming performance optimizations.

Change-Id: I7c449589283a4a6b6e23f2586cd784febdca8bcd
Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
stable-0.10
Christian Halstrick 14 years ago committed by Chris Aniszczyk
parent
commit
e3881de258
  1. 19
      org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheCheckout.java
  2. 2
      org.eclipse.jgit/src/org/eclipse/jgit/merge/ResolveMerger.java
  3. 27
      org.eclipse.jgit/src/org/eclipse/jgit/treewalk/WorkingTreeIterator.java

19
org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheCheckout.java vendored

@ -311,8 +311,8 @@ public class DirCacheCheckout {
if (m != null) {
if (i == null || f == null || !m.idEqual(i)
|| (i.getDirCacheEntry() != null && (f.isModified(
i.getDirCacheEntry(), true, config_filemode(),
repo.getFS()) || i.getDirCacheEntry().getStage() != 0))) {
i.getDirCacheEntry(), true, config_filemode()) ||
i.getDirCacheEntry().getStage() != 0))) {
update(m.getEntryPathString(), m.getEntryObjectId(),
m.getEntryFileMode());
} else
@ -575,9 +575,7 @@ public class DirCacheCheckout {
case 0xFFD: // 12 13 14
if (hId.equals(iId)) {
dce = i.getDirCacheEntry();
if (f == null
|| f.isModified(dce, true, config_filemode(),
repo.getFS()))
if (f == null || f.isModified(dce, true, config_filemode()))
conflict(name, i.getDirCacheEntry(), h, m);
else
remove(name);
@ -644,7 +642,7 @@ public class DirCacheCheckout {
if (m==null && walk.isDirectoryFileConflict()) {
if (dce != null
&& (f == null || f.isModified(dce, true,
config_filemode(), repo.getFS())))
config_filemode())))
conflict(name, i.getDirCacheEntry(), h, m);
else
remove(name);
@ -666,9 +664,7 @@ public class DirCacheCheckout {
*/
if (hId.equals(iId)) {
if (f == null
|| f.isModified(dce, true, config_filemode(),
repo.getFS()))
if (f == null || f.isModified(dce, true, config_filemode()))
conflict(name, i.getDirCacheEntry(), h, m);
else
remove(name);
@ -680,7 +676,7 @@ public class DirCacheCheckout {
else if (hId.equals(iId) && !mId.equals(iId)) {
if (dce != null
&& (f == null || f.isModified(dce, true,
config_filemode(), repo.getFS())))
config_filemode())))
conflict(name, i.getDirCacheEntry(), h, m);
else
update(name, mId, m.getEntryFileMode());
@ -805,7 +801,8 @@ public class DirCacheCheckout {
wtIt = tw.getTree(1, WorkingTreeIterator.class);
if (dcIt == null || wtIt == null)
return true;
if (wtIt.isModified(dcIt.getDirCacheEntry(), true, config_filemode(), repo.getFS())) {
if (wtIt.isModified(dcIt.getDirCacheEntry(), true,
config_filemode())) {
return true;
}
}

2
org.eclipse.jgit/src/org/eclipse/jgit/merge/ResolveMerger.java

@ -447,7 +447,7 @@ public class ResolveMerger extends ThreeWayMerger {
if (work != null
&& (!nonTree(work.getEntryRawMode()) || work
.isModified(index.getDirCacheEntry(), true,
true, db.getFS()))) {
true))) {
failingPathes.put(tw.getPathString(),
MergeFailureReason.DIRTY_WORKTREE);
return false;

27
org.eclipse.jgit/src/org/eclipse/jgit/treewalk/WorkingTreeIterator.java

@ -70,7 +70,6 @@ import org.eclipse.jgit.ignore.IgnoreRule;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.FileMode;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.util.FS;
import org.eclipse.jgit.util.IO;
import org.eclipse.jgit.util.io.EolCanonicalizingInputStream;
@ -225,15 +224,15 @@ public abstract class WorkingTreeIterator extends AbstractTreeIterator {
state.initializeDigestAndReadBuffer();
final long len = e.getLength();
if (!mightNeedCleaning(e))
if (!mightNeedCleaning())
return computeHash(is, len);
if (len <= MAXIMUM_FILE_SIZE_TO_READ_FULLY) {
ByteBuffer rawbuf = IO.readWholeStream(is, (int) len);
byte[] raw = rawbuf.array();
int n = rawbuf.limit();
if (!isBinary(e, raw, n)) {
rawbuf = filterClean(e, raw, n);
if (!isBinary(raw, n)) {
rawbuf = filterClean(raw, n);
raw = rawbuf.array();
n = rawbuf.limit();
}
@ -244,14 +243,14 @@ public abstract class WorkingTreeIterator extends AbstractTreeIterator {
return computeHash(is, len);
final long canonLen;
final InputStream lenIs = filterClean(e, e.openInputStream());
final InputStream lenIs = filterClean(e.openInputStream());
try {
canonLen = computeLength(lenIs);
} finally {
safeClose(lenIs);
}
return computeHash(filterClean(e, is), canonLen);
return computeHash(filterClean(is), canonLen);
} finally {
safeClose(is);
}
@ -271,7 +270,7 @@ public abstract class WorkingTreeIterator extends AbstractTreeIterator {
}
}
private boolean mightNeedCleaning(Entry entry) {
private boolean mightNeedCleaning() {
switch (getOptions().getAutoCRLF()) {
case FALSE:
default:
@ -283,7 +282,7 @@ public abstract class WorkingTreeIterator extends AbstractTreeIterator {
}
}
private boolean isBinary(Entry entry, byte[] content, int sz) {
private boolean isBinary(byte[] content, int sz) {
return RawText.isBinary(content, sz);
}
@ -296,13 +295,13 @@ public abstract class WorkingTreeIterator extends AbstractTreeIterator {
}
}
private ByteBuffer filterClean(Entry entry, byte[] src, int n)
private ByteBuffer filterClean(byte[] src, int n)
throws IOException {
InputStream in = new ByteArrayInputStream(src);
return IO.readWholeStream(filterClean(entry, in), n);
return IO.readWholeStream(filterClean(in), n);
}
private InputStream filterClean(Entry entry, InputStream in) {
private InputStream filterClean(InputStream in) {
return new EolCanonicalizingInputStream(in);
}
@ -544,14 +543,10 @@ public abstract class WorkingTreeIterator extends AbstractTreeIterator {
* @param checkFilemode
* whether the executable-bit in the filemode should be checked
* to detect modifications
* @param fs
* The filesystem this repo uses. Needed to find out whether the
* executable-bits are supported
*
* @return true if content is most likely different.
*/
public boolean isModified(DirCacheEntry entry, boolean forceContentCheck,
boolean checkFilemode, FS fs) {
boolean checkFilemode) {
if (entry.isAssumeValid())
return false;

Loading…
Cancel
Save