summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit
diff options
context:
space:
mode:
authorMatthias Sohn <matthias.sohn@sap.com>2016-04-08 11:01:17 -0400
committerGerrit Code Review @ Eclipse.org <gerrit@eclipse.org>2016-04-08 11:01:18 -0400
commit08fc807780c5c28c980f204d62de986b23a6c6c1 (patch)
tree1b65f6911e0ac7064f2c4d71d21c6cad72fcbdc1 /org.eclipse.jgit
parent2708b11b6c6f0e6a1ecd4a6e430756501a783bc6 (diff)
parentf2ee537d5532f7c8395c25d9f0db54fee3585416 (diff)
downloadjgit-08fc807780c5c28c980f204d62de986b23a6c6c1.tar.gz
jgit-08fc807780c5c28c980f204d62de986b23a6c6c1.zip
Merge "Prepare 4.3.1-SNAPSHOT versions"
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r--org.eclipse.jgit/META-INF/MANIFEST.MF80
-rw-r--r--org.eclipse.jgit/META-INF/SOURCE-MANIFEST.MF4
-rw-r--r--org.eclipse.jgit/pom.xml2
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/AddCommand.java6
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/CheckoutCommand.java12
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/lib/ConfigConstants.java6
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/treewalk/AbstractTreeIterator.java9
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/treewalk/FileTreeIterator.java34
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/treewalk/TreeWalk.java7
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/treewalk/WorkingTreeIterator.java35
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/treewalk/WorkingTreeOptions.java13
11 files changed, 150 insertions, 58 deletions
diff --git a/org.eclipse.jgit/META-INF/MANIFEST.MF b/org.eclipse.jgit/META-INF/MANIFEST.MF
index 3e155a7d3e..1832ed3a37 100644
--- a/org.eclipse.jgit/META-INF/MANIFEST.MF
+++ b/org.eclipse.jgit/META-INF/MANIFEST.MF
@@ -2,12 +2,12 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %plugin_name
Bundle-SymbolicName: org.eclipse.jgit
-Bundle-Version: 4.3.0.qualifier
+Bundle-Version: 4.3.1.qualifier
Bundle-Localization: plugin
Bundle-Vendor: %provider_name
Bundle-ActivationPolicy: lazy
-Export-Package: org.eclipse.jgit.annotations;version="4.3.0",
- org.eclipse.jgit.api;version="4.3.0";
+Export-Package: org.eclipse.jgit.annotations;version="4.3.1",
+ org.eclipse.jgit.api;version="4.3.1";
uses:="org.eclipse.jgit.revwalk,
org.eclipse.jgit.treewalk.filter,
org.eclipse.jgit.diff,
@@ -21,47 +21,47 @@ Export-Package: org.eclipse.jgit.annotations;version="4.3.0",
org.eclipse.jgit.submodule,
org.eclipse.jgit.transport,
org.eclipse.jgit.merge",
- org.eclipse.jgit.api.errors;version="4.3.0";uses:="org.eclipse.jgit.lib,org.eclipse.jgit.errors",
- org.eclipse.jgit.attributes;version="4.3.0",
- org.eclipse.jgit.blame;version="4.3.0";
+ org.eclipse.jgit.api.errors;version="4.3.1";uses:="org.eclipse.jgit.lib,org.eclipse.jgit.errors",
+ org.eclipse.jgit.attributes;version="4.3.1",
+ org.eclipse.jgit.blame;version="4.3.1";
uses:="org.eclipse.jgit.lib,
org.eclipse.jgit.revwalk,
org.eclipse.jgit.treewalk.filter,
org.eclipse.jgit.diff",
- org.eclipse.jgit.diff;version="4.3.0";
+ org.eclipse.jgit.diff;version="4.3.1";
uses:="org.eclipse.jgit.patch,
org.eclipse.jgit.lib,
org.eclipse.jgit.treewalk,
org.eclipse.jgit.revwalk,
org.eclipse.jgit.treewalk.filter,
org.eclipse.jgit.util",
- org.eclipse.jgit.dircache;version="4.3.0";
+ org.eclipse.jgit.dircache;version="4.3.1";
uses:="org.eclipse.jgit.lib,
org.eclipse.jgit.treewalk,
org.eclipse.jgit.util,
org.eclipse.jgit.events,
org.eclipse.jgit.attributes",
- org.eclipse.jgit.errors;version="4.3.0";
+ org.eclipse.jgit.errors;version="4.3.1";
uses:="org.eclipse.jgit.lib,
org.eclipse.jgit.internal.storage.pack,
org.eclipse.jgit.transport,
org.eclipse.jgit.dircache",
- org.eclipse.jgit.events;version="4.3.0";uses:="org.eclipse.jgit.lib",
- org.eclipse.jgit.fnmatch;version="4.3.0",
- org.eclipse.jgit.gitrepo;version="4.3.0";
+ org.eclipse.jgit.events;version="4.3.1";uses:="org.eclipse.jgit.lib",
+ org.eclipse.jgit.fnmatch;version="4.3.1",
+ org.eclipse.jgit.gitrepo;version="4.3.1";
uses:="org.eclipse.jgit.api,
org.eclipse.jgit.lib,
org.eclipse.jgit.revwalk,
org.xml.sax.helpers,
org.xml.sax",
- org.eclipse.jgit.gitrepo.internal;version="4.3.0";x-internal:=true,
- org.eclipse.jgit.hooks;version="4.3.0";uses:="org.eclipse.jgit.lib",
- org.eclipse.jgit.ignore;version="4.3.0",
- org.eclipse.jgit.ignore.internal;version="4.3.0";x-friends:="org.eclipse.jgit.test",
- org.eclipse.jgit.internal;version="4.3.0";x-friends:="org.eclipse.jgit.test,org.eclipse.jgit.http.test",
- org.eclipse.jgit.internal.ketch;version="4.3.0";x-friends:="org.eclipse.jgit.junit,org.eclipse.jgit.test,org.eclipse.jgit.pgm",
- org.eclipse.jgit.internal.storage.dfs;version="4.3.0";x-friends:="org.eclipse.jgit.test,org.eclipse.jgit.http.server",
- org.eclipse.jgit.internal.storage.file;version="4.3.0";
+ org.eclipse.jgit.gitrepo.internal;version="4.3.1";x-internal:=true,
+ org.eclipse.jgit.hooks;version="4.3.1";uses:="org.eclipse.jgit.lib",
+ org.eclipse.jgit.ignore;version="4.3.1",
+ org.eclipse.jgit.ignore.internal;version="4.3.1";x-friends:="org.eclipse.jgit.test",
+ org.eclipse.jgit.internal;version="4.3.1";x-friends:="org.eclipse.jgit.test,org.eclipse.jgit.http.test",
+ org.eclipse.jgit.internal.ketch;version="4.3.1";x-friends:="org.eclipse.jgit.junit,org.eclipse.jgit.test,org.eclipse.jgit.pgm",
+ org.eclipse.jgit.internal.storage.dfs;version="4.3.1";x-friends:="org.eclipse.jgit.test,org.eclipse.jgit.http.server",
+ org.eclipse.jgit.internal.storage.file;version="4.3.1";
x-friends:="org.eclipse.jgit.test,
org.eclipse.jgit.junit,
org.eclipse.jgit.junit.http,
@@ -69,9 +69,9 @@ Export-Package: org.eclipse.jgit.annotations;version="4.3.0",
org.eclipse.jgit.lfs.server,
org.eclipse.jgit.pgm,
org.eclipse.jgit.pgm.test",
- org.eclipse.jgit.internal.storage.pack;version="4.3.0";x-friends:="org.eclipse.jgit.junit,org.eclipse.jgit.test,org.eclipse.jgit.pgm",
- org.eclipse.jgit.internal.storage.reftree;version="4.3.0";x-friends:="org.eclipse.jgit.junit,org.eclipse.jgit.test,org.eclipse.jgit.pgm",
- org.eclipse.jgit.lib;version="4.3.0";
+ org.eclipse.jgit.internal.storage.pack;version="4.3.1";x-friends:="org.eclipse.jgit.junit,org.eclipse.jgit.test,org.eclipse.jgit.pgm",
+ org.eclipse.jgit.internal.storage.reftree;version="4.3.1";x-friends:="org.eclipse.jgit.junit,org.eclipse.jgit.test,org.eclipse.jgit.pgm",
+ org.eclipse.jgit.lib;version="4.3.1";
uses:="org.eclipse.jgit.revwalk,
org.eclipse.jgit.treewalk.filter,
org.eclipse.jgit.util,
@@ -81,32 +81,32 @@ Export-Package: org.eclipse.jgit.annotations;version="4.3.0",
org.eclipse.jgit.treewalk,
org.eclipse.jgit.transport,
org.eclipse.jgit.submodule",
- org.eclipse.jgit.merge;version="4.3.0";
+ org.eclipse.jgit.merge;version="4.3.1";
uses:="org.eclipse.jgit.lib,
org.eclipse.jgit.treewalk,
org.eclipse.jgit.revwalk,
org.eclipse.jgit.diff,
org.eclipse.jgit.dircache,
org.eclipse.jgit.api",
- org.eclipse.jgit.nls;version="4.3.0",
- org.eclipse.jgit.notes;version="4.3.0";
+ org.eclipse.jgit.nls;version="4.3.1",
+ org.eclipse.jgit.notes;version="4.3.1";
uses:="org.eclipse.jgit.lib,
org.eclipse.jgit.treewalk,
org.eclipse.jgit.revwalk,
org.eclipse.jgit.merge",
- org.eclipse.jgit.patch;version="4.3.0";uses:="org.eclipse.jgit.lib,org.eclipse.jgit.diff",
- org.eclipse.jgit.revplot;version="4.3.0";uses:="org.eclipse.jgit.lib,org.eclipse.jgit.revwalk",
- org.eclipse.jgit.revwalk;version="4.3.0";
+ org.eclipse.jgit.patch;version="4.3.1";uses:="org.eclipse.jgit.lib,org.eclipse.jgit.diff",
+ org.eclipse.jgit.revplot;version="4.3.1";uses:="org.eclipse.jgit.lib,org.eclipse.jgit.revwalk",
+ org.eclipse.jgit.revwalk;version="4.3.1";
uses:="org.eclipse.jgit.lib,
org.eclipse.jgit.treewalk,
org.eclipse.jgit.treewalk.filter,
org.eclipse.jgit.diff,
org.eclipse.jgit.revwalk.filter",
- org.eclipse.jgit.revwalk.filter;version="4.3.0";uses:="org.eclipse.jgit.revwalk,org.eclipse.jgit.lib,org.eclipse.jgit.util",
- org.eclipse.jgit.storage.file;version="4.3.0";uses:="org.eclipse.jgit.lib,org.eclipse.jgit.util",
- org.eclipse.jgit.storage.pack;version="4.3.0";uses:="org.eclipse.jgit.lib",
- org.eclipse.jgit.submodule;version="4.3.0";uses:="org.eclipse.jgit.lib,org.eclipse.jgit.treewalk.filter,org.eclipse.jgit.treewalk",
- org.eclipse.jgit.transport;version="4.3.0";
+ org.eclipse.jgit.revwalk.filter;version="4.3.1";uses:="org.eclipse.jgit.revwalk,org.eclipse.jgit.lib,org.eclipse.jgit.util",
+ org.eclipse.jgit.storage.file;version="4.3.1";uses:="org.eclipse.jgit.lib,org.eclipse.jgit.util",
+ org.eclipse.jgit.storage.pack;version="4.3.1";uses:="org.eclipse.jgit.lib",
+ org.eclipse.jgit.submodule;version="4.3.1";uses:="org.eclipse.jgit.lib,org.eclipse.jgit.treewalk.filter,org.eclipse.jgit.treewalk",
+ org.eclipse.jgit.transport;version="4.3.1";
uses:="org.eclipse.jgit.transport.resolver,
org.eclipse.jgit.revwalk,
org.eclipse.jgit.internal.storage.pack,
@@ -118,22 +118,22 @@ Export-Package: org.eclipse.jgit.annotations;version="4.3.0",
org.eclipse.jgit.transport.http,
org.eclipse.jgit.errors,
org.eclipse.jgit.storage.pack",
- org.eclipse.jgit.transport.http;version="4.3.0";uses:="javax.net.ssl",
- org.eclipse.jgit.transport.resolver;version="4.3.0";uses:="org.eclipse.jgit.lib,org.eclipse.jgit.transport",
- org.eclipse.jgit.treewalk;version="4.3.0";
+ org.eclipse.jgit.transport.http;version="4.3.1";uses:="javax.net.ssl",
+ org.eclipse.jgit.transport.resolver;version="4.3.1";uses:="org.eclipse.jgit.lib,org.eclipse.jgit.transport",
+ org.eclipse.jgit.treewalk;version="4.3.1";
uses:="org.eclipse.jgit.lib,
org.eclipse.jgit.revwalk,
org.eclipse.jgit.attributes,
org.eclipse.jgit.treewalk.filter,
org.eclipse.jgit.util,
org.eclipse.jgit.dircache",
- org.eclipse.jgit.treewalk.filter;version="4.3.0";uses:="org.eclipse.jgit.treewalk",
- org.eclipse.jgit.util;version="4.3.0";
+ org.eclipse.jgit.treewalk.filter;version="4.3.1";uses:="org.eclipse.jgit.treewalk",
+ org.eclipse.jgit.util;version="4.3.1";
uses:="org.eclipse.jgit.lib,
org.eclipse.jgit.transport.http,
org.eclipse.jgit.storage.file,
org.ietf.jgss",
- org.eclipse.jgit.util.io;version="4.3.0"
+ org.eclipse.jgit.util.io;version="4.3.1"
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Require-Bundle: com.jcraft.jsch;bundle-version="[0.1.37,0.2.0)"
Import-Package: com.googlecode.javaewah;version="[0.7.9,0.8.0)",
diff --git a/org.eclipse.jgit/META-INF/SOURCE-MANIFEST.MF b/org.eclipse.jgit/META-INF/SOURCE-MANIFEST.MF
index 6cdf122152..b95d013113 100644
--- a/org.eclipse.jgit/META-INF/SOURCE-MANIFEST.MF
+++ b/org.eclipse.jgit/META-INF/SOURCE-MANIFEST.MF
@@ -3,5 +3,5 @@ Bundle-ManifestVersion: 2
Bundle-Name: org.eclipse.jgit - Sources
Bundle-SymbolicName: org.eclipse.jgit.source
Bundle-Vendor: Eclipse.org - JGit
-Bundle-Version: 4.3.0.qualifier
-Eclipse-SourceBundle: org.eclipse.jgit;version="4.3.0.qualifier";roots="."
+Bundle-Version: 4.3.1.qualifier
+Eclipse-SourceBundle: org.eclipse.jgit;version="4.3.1.qualifier";roots="."
diff --git a/org.eclipse.jgit/pom.xml b/org.eclipse.jgit/pom.xml
index a65ec96073..eac3738ab6 100644
--- a/org.eclipse.jgit/pom.xml
+++ b/org.eclipse.jgit/pom.xml
@@ -53,7 +53,7 @@
<parent>
<groupId>org.eclipse.jgit</groupId>
<artifactId>org.eclipse.jgit-parent</artifactId>
- <version>4.3.0-SNAPSHOT</version>
+ <version>4.3.1-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.jgit</artifactId>
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/AddCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/AddCommand.java
index 3b94f16f1a..1f37833a41 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/AddCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/AddCommand.java
@@ -45,6 +45,7 @@ package org.eclipse.jgit.api;
import static org.eclipse.jgit.lib.Constants.OBJ_BLOB;
import static org.eclipse.jgit.lib.FileMode.GITLINK;
+import static org.eclipse.jgit.lib.FileMode.TYPE_GITLINK;
import static org.eclipse.jgit.lib.FileMode.TYPE_TREE;
import java.io.IOException;
@@ -201,7 +202,10 @@ public class AddCommand extends GitCommand<DirCache> {
continue;
}
- if (f.getEntryRawMode() == TYPE_TREE) {
+ if ((f.getEntryRawMode() == TYPE_TREE
+ && f.getIndexFileMode(c) != FileMode.GITLINK) ||
+ (f.getEntryRawMode() == TYPE_GITLINK
+ && f.getIndexFileMode(c) == FileMode.TREE)) {
// Index entry exists and is symlink, gitlink or file,
// otherwise the tree would have been entered above.
// Replace the index entry by diving into tree of files.
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/CheckoutCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/CheckoutCommand.java
index c37c317c51..6c80289452 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/CheckoutCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/CheckoutCommand.java
@@ -430,6 +430,8 @@ public class CheckoutCommand extends GitCommand<Ref> {
continue;
final EolStreamType eolStreamType = treeWalk.getEolStreamType();
+ final String filterCommand = treeWalk
+ .getFilterCommand(Constants.ATTR_FILTER_TYPE_SMUDGE);
editor.add(new PathEdit(path) {
public void apply(DirCacheEntry ent) {
int stage = ent.getStage();
@@ -437,15 +439,15 @@ public class CheckoutCommand extends GitCommand<Ref> {
if (checkoutStage != null) {
if (stage == checkoutStage.number)
checkoutPath(ent, r, new CheckoutMetadata(
- eolStreamType, null));
+ eolStreamType, filterCommand));
} else {
UnmergedPathException e = new UnmergedPathException(
ent);
throw new JGitInternalException(e.getMessage(), e);
}
} else {
- checkoutPath(ent, r,
- new CheckoutMetadata(eolStreamType, null));
+ checkoutPath(ent, r, new CheckoutMetadata(eolStreamType,
+ filterCommand));
}
}
});
@@ -464,12 +466,14 @@ public class CheckoutCommand extends GitCommand<Ref> {
final ObjectId blobId = treeWalk.getObjectId(0);
final FileMode mode = treeWalk.getFileMode(0);
final EolStreamType eolStreamType = treeWalk.getEolStreamType();
+ final String filterCommand = treeWalk
+ .getFilterCommand(Constants.ATTR_FILTER_TYPE_SMUDGE);
editor.add(new PathEdit(treeWalk.getPathString()) {
public void apply(DirCacheEntry ent) {
ent.setObjectId(blobId);
ent.setFileMode(mode);
checkoutPath(ent, r,
- new CheckoutMetadata(eolStreamType, null));
+ new CheckoutMetadata(eolStreamType, filterCommand));
}
});
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ConfigConstants.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ConfigConstants.java
index 3233eba008..9e3e0b78fd 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ConfigConstants.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ConfigConstants.java
@@ -235,6 +235,12 @@ public class ConfigConstants {
*/
public static final String CONFIG_KEY_HIDEDOTFILES = "hidedotfiles";
+ /**
+ * The "dirnogitlinks" key
+ * @since 4.3
+ */
+ public static final String CONFIG_KEY_DIRNOGITLINKS = "dirNoGitLinks";
+
/** The "precomposeunicode" key */
public static final String CONFIG_KEY_PRECOMPOSEUNICODE = "precomposeunicode";
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/AbstractTreeIterator.java b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/AbstractTreeIterator.java
index dc835e4f36..07fc829db4 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/AbstractTreeIterator.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/AbstractTreeIterator.java
@@ -729,4 +729,13 @@ public abstract class AbstractTreeIterator {
public String toString() {
return getClass().getSimpleName() + "[" + getEntryPathString() + "]"; //$NON-NLS-1$
}
+
+ /**
+ * @return whether or not this Iterator is iterating through the Work Tree
+ *
+ * @since 4.3
+ */
+ public boolean isWorkTree() {
+ return false;
+ }
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/FileTreeIterator.java b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/FileTreeIterator.java
index eb4f1a87d0..db81e1af9b 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/FileTreeIterator.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/FileTreeIterator.java
@@ -94,7 +94,10 @@ public class FileTreeIterator extends WorkingTreeIterator {
* the repository whose working tree will be scanned.
*/
public FileTreeIterator(Repository repo) {
- this(repo, DefaultFileModeStrategy.INSTANCE);
+ this(repo,
+ repo.getConfig().get(WorkingTreeOptions.KEY).isDirNoGitLinks() ?
+ NoGitlinksStrategy.INSTANCE :
+ DefaultFileModeStrategy.INSTANCE);
}
/**
@@ -291,6 +294,35 @@ public class FileTreeIterator extends WorkingTreeIterator {
}
}
+ /**
+ * A FileModeStrategy that implements native git's DIR_NO_GITLINKS
+ * behavior. This is the same as the default FileModeStrategy, except
+ * all directories will be treated as directories regardless of whether
+ * or not they contain a .git directory or file.
+ *
+ * @since 4.3
+ */
+ static public class NoGitlinksStrategy implements FileModeStrategy {
+
+ /**
+ * a singleton instance of the default FileModeStrategy
+ */
+ public final static NoGitlinksStrategy INSTANCE = new NoGitlinksStrategy();
+
+ @Override
+ public FileMode getMode(File f, FS.Attributes attributes) {
+ if (attributes.isSymbolicLink()) {
+ return FileMode.SYMLINK;
+ } else if (attributes.isDirectory()) {
+ return FileMode.TREE;
+ } else if (attributes.isExecutable()) {
+ return FileMode.EXECUTABLE_FILE;
+ } else {
+ return FileMode.REGULAR_FILE;
+ }
+ }
+ }
+
/**
* Wrapper for a standard Java IO file
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/TreeWalk.java b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/TreeWalk.java
index aecbac11ea..501d676735 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/TreeWalk.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/TreeWalk.java
@@ -1187,7 +1187,12 @@ public class TreeWalk implements AutoCloseable, AttributesProvider {
for (int i = 0; i < trees.length; i++) {
final AbstractTreeIterator t = trees[i];
final AbstractTreeIterator n;
- if (t.matches == ch && !t.eof() && FileMode.TREE.equals(t.mode))
+ // If we find a GITLINK when attempting to enter a subtree, then the
+ // GITLINK must exist as a TREE in the index, meaning the working tree
+ // entry should be treated as a TREE
+ if (t.matches == ch && !t.eof() &&
+ (FileMode.TREE.equals(t.mode)
+ || (FileMode.GITLINK.equals(t.mode) && t.isWorkTree())))
n = t.createSubtreeIterator(reader, idBuffer);
else
n = t.createEmptyTreeIterator();
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 ca8f9aa373..39176c621e 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/WorkingTreeIterator.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/WorkingTreeIterator.java
@@ -264,7 +264,7 @@ public abstract class WorkingTreeIterator extends AbstractTreeIterator {
// the cached index information for the path.
//
DirCacheIterator i = state.walk.getTree(state.dirCacheTree,
- DirCacheIterator.class);
+ DirCacheIterator.class);
if (i != null) {
DirCacheEntry ent = i.getDirCacheEntry();
if (ent != null && compareMetadata(ent) == MetadataDiff.EQUAL) {
@@ -289,6 +289,11 @@ public abstract class WorkingTreeIterator extends AbstractTreeIterator {
return zeroid;
}
+ @Override
+ public boolean isWorkTree() {
+ return true;
+ }
+
/**
* Get submodule id for given entry.
*
@@ -916,17 +921,31 @@ public abstract class WorkingTreeIterator extends AbstractTreeIterator {
*/
public FileMode getIndexFileMode(final DirCacheIterator indexIter) {
final FileMode wtMode = getEntryFileMode();
- if (indexIter == null)
- return wtMode;
- if (getOptions().isFileMode())
+ if (indexIter == null) {
return wtMode;
+ }
final FileMode iMode = indexIter.getEntryFileMode();
- if (FileMode.REGULAR_FILE == wtMode
- && FileMode.EXECUTABLE_FILE == iMode)
+ if (getOptions().isFileMode() && iMode != FileMode.GITLINK && iMode != FileMode.TREE) {
+ return wtMode;
+ }
+ if (!getOptions().isFileMode()) {
+ if (FileMode.REGULAR_FILE == wtMode
+ && FileMode.EXECUTABLE_FILE == iMode) {
+ return iMode;
+ }
+ if (FileMode.EXECUTABLE_FILE == wtMode
+ && FileMode.REGULAR_FILE == iMode) {
+ return iMode;
+ }
+ }
+ if (FileMode.GITLINK == iMode
+ && FileMode.TREE == wtMode) {
return iMode;
- if (FileMode.EXECUTABLE_FILE == wtMode
- && FileMode.REGULAR_FILE == iMode)
+ }
+ if (FileMode.TREE == iMode
+ && FileMode.GITLINK == wtMode) {
return iMode;
+ }
return wtMode;
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/WorkingTreeOptions.java b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/WorkingTreeOptions.java
index a8990b1e95..dea07c1973 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/WorkingTreeOptions.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/WorkingTreeOptions.java
@@ -73,6 +73,8 @@ public class WorkingTreeOptions {
private final HideDotFiles hideDotFiles;
+ private final boolean dirNoGitLinks;
+
private WorkingTreeOptions(final Config rc) {
fileMode = rc.getBoolean(ConfigConstants.CONFIG_CORE_SECTION,
ConfigConstants.CONFIG_KEY_FILEMODE, true);
@@ -87,6 +89,9 @@ public class WorkingTreeOptions {
hideDotFiles = rc.getEnum(ConfigConstants.CONFIG_CORE_SECTION, null,
ConfigConstants.CONFIG_KEY_HIDEDOTFILES,
HideDotFiles.DOTGITONLY);
+ dirNoGitLinks = rc.getBoolean(ConfigConstants.CONFIG_CORE_SECTION, null,
+ ConfigConstants.CONFIG_KEY_DIRNOGITLINKS,
+ false);
}
/** @return true if the execute bit on working files should be trusted. */
@@ -131,4 +136,12 @@ public class WorkingTreeOptions {
public HideDotFiles getHideDotFiles() {
return hideDotFiles;
}
+
+ /**
+ * @return whether or not we treat nested repos as directories.
+ * If true, folders containing .git entries will not be
+ * treated as gitlinks.
+ * @since 4.3
+ */
+ public boolean isDirNoGitLinks() { return dirNoGitLinks; }
}