summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit/src
diff options
context:
space:
mode:
authorChristian Halstrick <christian.halstrick@sap.com>2018-11-28 06:11:05 -0500
committerGerrit Code Review @ Eclipse.org <gerrit@eclipse.org>2018-11-28 06:11:05 -0500
commit158294f9126330f717394a027a4a7b1290538e9f (patch)
tree0001257a9505083dd891ccf7c9ba23ba149a4ba3 /org.eclipse.jgit/src
parentc5306b84ae03293423c2d706f7541589838367b7 (diff)
parent4678f4b7354404f1ea40af6f213d3b2f7d674e3f (diff)
downloadjgit-158294f9126330f717394a027a4a7b1290538e9f.tar.gz
jgit-158294f9126330f717394a027a4a7b1290538e9f.zip
Merge "Fix IndexDiffs for git links"
Diffstat (limited to 'org.eclipse.jgit/src')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/treewalk/WorkingTreeIterator.java2
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/util/Paths.java14
2 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 7c6bfb9d63..1fa1db5847 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/WorkingTreeIterator.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/WorkingTreeIterator.java
@@ -1045,7 +1045,7 @@ public abstract class WorkingTreeIterator extends AbstractTreeIterator {
}
}
if (FileMode.GITLINK == iMode
- && FileMode.TREE == wtMode) {
+ && FileMode.TREE == wtMode && !getOptions().isDirNoGitLinks()) {
return iMode;
}
if (FileMode.TREE == iMode
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/Paths.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/Paths.java
index 6be7ddbe12..be1b95e0d4 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/util/Paths.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/Paths.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2016, Google Inc.
+ * Copyright (C) 2016, 2018 Google Inc.
* and other copyright owners as documented in the project's IP log.
*
* This program and the accompanying materials are made available
@@ -43,6 +43,7 @@
package org.eclipse.jgit.util;
+import static org.eclipse.jgit.lib.FileMode.TYPE_GITLINK;
import static org.eclipse.jgit.lib.FileMode.TYPE_MASK;
import static org.eclipse.jgit.lib.FileMode.TYPE_TREE;
@@ -106,7 +107,7 @@ public class Paths {
aPath, aPos, aEnd, aMode,
bPath, bPos, bEnd, bMode);
if (cmp == 0) {
- cmp = lastPathChar(aMode) - lastPathChar(bMode);
+ cmp = modeCompare(aMode, bMode);
}
return cmp;
}
@@ -183,6 +184,15 @@ public class Paths {
return 0;
}
+ private static int modeCompare(int aMode, int bMode) {
+ if ((aMode & TYPE_MASK) == TYPE_GITLINK
+ || (bMode & TYPE_MASK) == TYPE_GITLINK) {
+ // Git links can be equal to files or folders
+ return 0;
+ }
+ return lastPathChar(aMode) - lastPathChar(bMode);
+ }
+
private Paths() {
}
}