diff options
author | Christian Halstrick <christian.halstrick@sap.com> | 2016-04-05 16:04:39 +0200 |
---|---|---|
committer | Matthias Sohn <matthias.sohn@sap.com> | 2016-04-06 00:06:53 +0200 |
commit | 47dd98e3620d8ae7a8cb4a10361d64fef1c2c085 (patch) | |
tree | 9dd630c249c14966f37ebfb41e0860f03878e69d /org.eclipse.jgit | |
parent | 46bef2bcb622e2a1282caee950dae9f3001c0bf8 (diff) | |
download | jgit-47dd98e3620d8ae7a8cb4a10361d64fef1c2c085.tar.gz jgit-47dd98e3620d8ae7a8cb4a10361d64fef1c2c085.zip |
Enable calling of smudge filters when checking out paths
When checking out commits/branches JGit was triggering correctly
configured smudge filters. But when checking out paths (either from
index or from commits) JGit was not triggering smudge filters. Fix
CheckoutCommand to properly call filters.
Bug: 486560
Also-by: Pascal Krause <pascal.krausek@sap.com>
Change-Id: I5ff893054defe57ab12e201d901fe74e1376efea
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/api/CheckoutCommand.java | 12 |
1 files changed, 8 insertions, 4 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 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)); } }); } |