summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit
diff options
context:
space:
mode:
authorThomas Wolf <twolf@apache.org>2022-07-20 18:30:18 +0200
committerThomas Wolf <twolf@apache.org>2022-08-13 15:14:15 +0200
commitd9c0629ffe45ba96f853672268c391dd7caa82fe (patch)
tree53acdb88cb1e00225c959ef4d4cf556b936ab585 /org.eclipse.jgit
parent1ee0b9b79fed6746d32e69bf7bd0264b718395a6 (diff)
downloadjgit-d9c0629ffe45ba96f853672268c391dd7caa82fe.tar.gz
jgit-d9c0629ffe45ba96f853672268c391dd7caa82fe.zip
Fix adding symlinks to the index when core.symlinks=false
With core.symlinks=false, symlinks are checked out as plain files. When such a file is re-added to the index, and the index already contains a symlink there, add the file as a symlink. Previous code changed the index entry to a regular file. Bug: 580412 Change-Id: I5497bedc3da89c8b10120b8077c56bc5b67cb791 Signed-off-by: Thomas Wolf <twolf@apache.org>
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/treewalk/WorkingTreeIterator.java6
1 files changed, 6 insertions, 0 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 b108b0a959..d8a61ec97a 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/WorkingTreeIterator.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/WorkingTreeIterator.java
@@ -1004,6 +1004,12 @@ public abstract class WorkingTreeIterator extends AbstractTreeIterator {
return wtMode;
}
final FileMode iMode = indexIter.getEntryFileMode();
+ if (iMode == FileMode.SYMLINK
+ && getOptions().getSymLinks() == SymLinks.FALSE
+ && (wtMode == FileMode.REGULAR_FILE
+ || wtMode == FileMode.EXECUTABLE_FILE)) {
+ return iMode;
+ }
if (getOptions().isFileMode() && iMode != FileMode.GITLINK && iMode != FileMode.TREE) {
return wtMode;
}