Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.jgit/src/org/eclipse/jgit/diff/DiffEntry.java')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/diff/DiffEntry.java25
1 files changed, 25 insertions, 0 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/diff/DiffEntry.java b/org.eclipse.jgit/src/org/eclipse/jgit/diff/DiffEntry.java
index 0f5ea76519..5c8343f92c 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/diff/DiffEntry.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/diff/DiffEntry.java
@@ -48,9 +48,11 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
+import org.eclipse.jgit.attributes.Attribute;
import org.eclipse.jgit.internal.JGitText;
import org.eclipse.jgit.lib.AbbreviatedObjectId;
import org.eclipse.jgit.lib.AnyObjectId;
+import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.FileMode;
import org.eclipse.jgit.lib.MutableObjectId;
import org.eclipse.jgit.lib.ObjectId;
@@ -196,6 +198,11 @@ public class DiffEntry {
entry.newMode = walk.getFileMode(1);
entry.newPath = entry.oldPath = walk.getPathString();
+ if (walk.getAttributesNodeProvider() != null) {
+ entry.diffAttribute = walk.getAttributes()
+ .get(Constants.ATTR_DIFF);
+ }
+
if (treeFilterMarker != null)
entry.treeFilterMarks = treeFilterMarker.getMarks(walk);
@@ -282,6 +289,7 @@ public class DiffEntry {
del.newMode = FileMode.MISSING;
del.newPath = DiffEntry.DEV_NULL;
del.changeType = ChangeType.DELETE;
+ del.diffAttribute = entry.diffAttribute;
DiffEntry add = new DiffEntry();
add.oldId = A_ZERO;
@@ -292,6 +300,7 @@ public class DiffEntry {
add.newMode = entry.getNewMode();
add.newPath = entry.getNewPath();
add.changeType = ChangeType.ADD;
+ add.diffAttribute = entry.diffAttribute;
return Arrays.asList(del, add);
}
@@ -306,6 +315,7 @@ public class DiffEntry {
r.newId = dst.newId;
r.newMode = dst.newMode;
r.newPath = dst.newPath;
+ r.diffAttribute = dst.diffAttribute;
r.changeType = changeType;
r.score = score;
@@ -321,6 +331,13 @@ public class DiffEntry {
/** File name of the new (post-image). */
protected String newPath;
+ /**
+ * diff filter attribute
+ *
+ * @since 4.11
+ */
+ protected Attribute diffAttribute;
+
/** Old mode of the file, if described by the patch, else null. */
protected FileMode oldMode;
@@ -395,6 +412,14 @@ public class DiffEntry {
}
/**
+ * @return the {@link Attribute} determining filters to be applied.
+ * @since 4.11
+ */
+ public Attribute getDiffAttribute() {
+ return diffAttribute;
+ }
+
+ /**
* Get the old file mode
*
* @return the old file mode, if described in the patch

Back to the top