diff options
author | Christian Halstrick <christian.halstrick@sap.com> | 2010-12-06 10:03:39 +0100 |
---|---|---|
committer | Chris Aniszczyk <caniszczyk@gmail.com> | 2010-12-08 10:15:48 -0600 |
commit | e3881de258b4db6a0d9284e6154a11f3c7eacf37 (patch) | |
tree | b63155f4639cd838e08f255ee79cec37c8cae087 | |
parent | 51e2646d4a17a22210111675030dee54f4cfee49 (diff) | |
download | jgit-e3881de258b4db6a0d9284e6154a11f3c7eacf37.tar.gz jgit-e3881de258b4db6a0d9284e6154a11f3c7eacf37.zip |
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>
3 files changed, 20 insertions, 28 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheCheckout.java b/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheCheckout.java index 01cecf40f8..1e08d98a2e 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheCheckout.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheCheckout.java @@ -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; } } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/merge/ResolveMerger.java b/org.eclipse.jgit/src/org/eclipse/jgit/merge/ResolveMerger.java index 4cf57e8400..dbb04deadf 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/merge/ResolveMerger.java +++ b/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; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/WorkingTreeIterator.java b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/WorkingTreeIterator.java index ac3a83104c..c9257e39eb 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/WorkingTreeIterator.java +++ b/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; |