aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit
diff options
context:
space:
mode:
authorDavid Pursehouse <david.pursehouse@gmail.com>2017-11-08 20:20:45 +0900
committerDavid Pursehouse <david.pursehouse@gmail.com>2017-11-15 10:37:56 +0900
commit6ec5d8ddb13df9ccc085434bb5598ae89395d90c (patch)
treea1a22334db8dcd3f505f7d5c4aeb6b742f85a47a /org.eclipse.jgit
parent2a15a63005a2116e271efc44c39741efbfe075d4 (diff)
downloadjgit-6ec5d8ddb13df9ccc085434bb5598ae89395d90c.tar.gz
jgit-6ec5d8ddb13df9ccc085434bb5598ae89395d90c.zip
TreeWalk: Make getEolStreamType(OperationType) public
and deprecate getEolStreamType(). This resolves a TODO that was apparently supposed to be done in version 4.4. Change-Id: I5c9861aedabdc3f99dcf47519b3959a979e6a591
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/CheckoutCommand.java8
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/StashApplyCommand.java5
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheCheckout.java5
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/treewalk/TreeWalk.java10
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/treewalk/WorkingTreeIterator.java6
5 files changed, 21 insertions, 13 deletions
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 6b20da3ede..db59a9bff4 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/CheckoutCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/CheckoutCommand.java
@@ -43,6 +43,8 @@
*/
package org.eclipse.jgit.api;
+import static org.eclipse.jgit.treewalk.TreeWalk.OperationType.CHECKOUT_OP;
+
import java.io.IOException;
import java.text.MessageFormat;
import java.util.ArrayList;
@@ -468,7 +470,8 @@ public class CheckoutCommand extends GitCommand<Ref> {
if (path.equals(previousPath))
continue;
- final EolStreamType eolStreamType = treeWalk.getEolStreamType();
+ final EolStreamType eolStreamType = treeWalk
+ .getEolStreamType(CHECKOUT_OP);
final String filterCommand = treeWalk
.getFilterCommand(Constants.ATTR_FILTER_TYPE_SMUDGE);
editor.add(new PathEdit(path) {
@@ -508,7 +511,8 @@ public class CheckoutCommand extends GitCommand<Ref> {
while (treeWalk.next()) {
final ObjectId blobId = treeWalk.getObjectId(0);
final FileMode mode = treeWalk.getFileMode(0);
- final EolStreamType eolStreamType = treeWalk.getEolStreamType();
+ final EolStreamType eolStreamType = treeWalk
+ .getEolStreamType(CHECKOUT_OP);
final String filterCommand = treeWalk
.getFilterCommand(Constants.ATTR_FILTER_TYPE_SMUDGE);
final String path = treeWalk.getPathString();
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/StashApplyCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/StashApplyCommand.java
index b56fb2519b..08fde70edd 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/StashApplyCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/StashApplyCommand.java
@@ -42,6 +42,8 @@
*/
package org.eclipse.jgit.api;
+import static org.eclipse.jgit.treewalk.TreeWalk.OperationType.CHECKOUT_OP;
+
import java.io.IOException;
import java.text.MessageFormat;
import java.util.HashSet;
@@ -355,7 +357,8 @@ public class StashApplyCommand extends GitCommand<ObjectId> {
// Not in commit, don't create untracked
continue;
- final EolStreamType eolStreamType = walk.getEolStreamType();
+ final EolStreamType eolStreamType = walk
+ .getEolStreamType(CHECKOUT_OP);
final DirCacheEntry entry = new DirCacheEntry(walk.getRawPath());
entry.setFileMode(cIter.getEntryFileMode());
entry.setObjectIdFromRaw(cIter.idBuffer(), cIter.idOffset());
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheCheckout.java b/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheCheckout.java
index f8c23ca64f..d30f6e45be 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheCheckout.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheCheckout.java
@@ -42,6 +42,8 @@
package org.eclipse.jgit.dircache;
+import static org.eclipse.jgit.treewalk.TreeWalk.OperationType.CHECKOUT_OP;
+
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
@@ -1148,7 +1150,8 @@ public class DirCacheCheckout {
private void update(String path, ObjectId mId, FileMode mode)
throws IOException {
if (!FileMode.TREE.equals(mode)) {
- updated.put(path, new CheckoutMetadata(walk.getEolStreamType(),
+ updated.put(path, new CheckoutMetadata(
+ walk.getEolStreamType(CHECKOUT_OP),
walk.getFilterCommand(Constants.ATTR_FILTER_TYPE_SMUDGE)));
DirCacheEntry entry = new DirCacheEntry(path, DirCacheEntry.STAGE_0);
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 e063749a2c..77cb67aa41 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/TreeWalk.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/TreeWalk.java
@@ -592,13 +592,14 @@ public class TreeWalk implements AutoCloseable, AttributesProvider {
* @return the EOL stream type of the current entry using the config and
* {@link #getAttributes()} Note that this method may return null if
* the {@link TreeWalk} is not based on a working tree
+ * @since 4.10
*/
- // TODO(msohn) make this method public in 4.4
@Nullable
- EolStreamType getEolStreamType(OperationType opType) {
+ public EolStreamType getEolStreamType(OperationType opType) {
if (attributesNodeProvider == null || config == null)
return null;
- return EolStreamTypeUtil.detectStreamType(opType,
+ return EolStreamTypeUtil.detectStreamType(
+ opType != null ? opType : operationType,
config.get(WorkingTreeOptions.KEY), getAttributes());
}
@@ -607,8 +608,9 @@ public class TreeWalk implements AutoCloseable, AttributesProvider {
* {@link #getAttributes()} Note that this method may return null if
* the {@link TreeWalk} is not based on a working tree
* @since 4.3
+ * @deprecated use {@link #getEolStreamType(OperationType)} instead.
*/
- // TODO(msohn) deprecate this method in 4.4
+ @Deprecated
public @Nullable EolStreamType getEolStreamType() {
return (getEolStreamType(operationType));
}
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 b1b146c854..b2628b49e0 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/WorkingTreeIterator.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/WorkingTreeIterator.java
@@ -1394,11 +1394,7 @@ public abstract class WorkingTreeIterator extends AbstractTreeIterator {
if (eolStreamTypeHolder == null) {
EolStreamType type=null;
if (state.walk != null) {
- if (opType != null) {
- type = state.walk.getEolStreamType(opType);
- } else {
- type=state.walk.getEolStreamType();
- }
+ type = state.walk.getEolStreamType(opType);
} else {
switch (getOptions().getAutoCRLF()) {
case FALSE: