diff options
author | Christian Halstrick <christian.halstrick@sap.com> | 2016-06-27 16:00:44 +0200 |
---|---|---|
committer | Matthias Sohn <matthias.sohn@sap.com> | 2016-09-20 10:58:05 +0200 |
commit | bcb5a431a51703c31ce9d9c1f933e7f00a463021 (patch) | |
tree | 1dc40eb06738359fc660a50e57de2220ad4471b4 /org.eclipse.jgit/src/org/eclipse/jgit/api/AddCommand.java | |
parent | 45ee55d0d9537c77f025d6c30e434149154d8ec4 (diff) | |
download | jgit-bcb5a431a51703c31ce9d9c1f933e7f00a463021.tar.gz jgit-bcb5a431a51703c31ce9d9c1f933e7f00a463021.zip |
Add built-in LFS smudge filter for local case
Adds a JGit built-in implementation of the "git lfs smudge" filter. This
filter should do the same as the one described in [1] besides that it
only supports the local case when the lfs objects are already present in
the media directory. Remote cases where download of LFS objects from an
LFS server is needed will be done in a later commit.
[1] https://github.com/github/git-lfs/blob/master/docs/man/git-lfs-smudge.1.ronn
Change-Id: I8ff661d4edd3667ef7f86f3b4fa33e568eb4c8f4
Diffstat (limited to 'org.eclipse.jgit/src/org/eclipse/jgit/api/AddCommand.java')
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/api/AddCommand.java | 5 |
1 files changed, 5 insertions, 0 deletions
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 1f37833a41..16ec1463c9 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/AddCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/AddCommand.java @@ -224,6 +224,11 @@ public class AddCommand extends GitCommand<DirCache> { entry.setLength(f.getEntryLength()); entry.setLastModified(f.getEntryLastModified()); long len = f.getEntryContentLength(); + // We read and filter the content multiple times. + // f.getEntryContentLength() reads and filters the input and + // inserter.insert(...) does it again. That's because an + // ObjectInserter needs to know the length before it starts + // inserting. TODO: Fix this by using Buffers. try (InputStream in = f.openEntryStream()) { ObjectId id = inserter.insert(OBJ_BLOB, len, in); entry.setObjectId(id); |