Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Halstrick2016-08-07 17:59:49 +0000
committerAndrey Loskutov2016-08-24 07:05:41 +0000
commitda9eef85e7fff1c1c64c4302b897d20aff24b448 (patch)
tree0587f83a0b49ca1bdb9f50324cf173d553c13803
parentb8260b5e790c839f0071dec8067aa3c8d04022eb (diff)
downloadjgit-da9eef85e7fff1c1c64c4302b897d20aff24b448.tar.gz
jgit-da9eef85e7fff1c1c64c4302b897d20aff24b448.tar.xz
jgit-da9eef85e7fff1c1c64c4302b897d20aff24b448.zip
Don't check lastModified, length on folders for submodules
The metadata comparison of submodules is not reliable because of the last modified timestamp and directory length. Bug: 498759 Change-Id: If5db69ef3868e475ac477d3e8a7750b268799b0c
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/treewalk/WorkingTreeIterator.java16
1 files changed, 13 insertions, 3 deletions
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 c8de3de83c..9a3fa8060b 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/WorkingTreeIterator.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/WorkingTreeIterator.java
@@ -268,7 +268,9 @@ public abstract class WorkingTreeIterator extends AbstractTreeIterator {
DirCacheIterator.class);
if (i != null) {
DirCacheEntry ent = i.getDirCacheEntry();
- if (ent != null && compareMetadata(ent) == MetadataDiff.EQUAL) {
+ if (ent != null && compareMetadata(ent) == MetadataDiff.EQUAL
+ && ((ent.getFileMode().getBits()
+ & FileMode.TYPE_MASK) != FileMode.TYPE_GITLINK)) {
contentIdOffset = i.idOffset();
contentIdFromPtr = ptr;
return contentId = i.idBuffer();
@@ -843,10 +845,15 @@ public abstract class WorkingTreeIterator extends AbstractTreeIterator {
if (entry.isUpdateNeeded())
return MetadataDiff.DIFFER_BY_METADATA;
- if (!entry.isSmudged() && entry.getLength() != (int) getEntryLength())
+ if (isModeDifferent(entry.getRawMode()))
return MetadataDiff.DIFFER_BY_METADATA;
- if (isModeDifferent(entry.getRawMode()))
+ // Don't check for length or lastmodified on folders
+ int type = mode & FileMode.TYPE_MASK;
+ if (type == FileMode.TYPE_TREE || type == FileMode.TYPE_GITLINK)
+ return MetadataDiff.EQUAL;
+
+ if (!entry.isSmudged() && entry.getLength() != (int) getEntryLength())
return MetadataDiff.DIFFER_BY_METADATA;
// Git under windows only stores seconds so we round the timestamp
@@ -915,6 +922,9 @@ public abstract class WorkingTreeIterator extends AbstractTreeIterator {
// Lets do a content check
return contentCheck(entry, reader);
case EQUAL:
+ if (mode == FileMode.SYMLINK.getBits()) {
+ return contentCheck(entry, reader);
+ }
return false;
case DIFFER_BY_METADATA:
if (mode == FileMode.SYMLINK.getBits())

Back to the top