aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/Lfs.java
diff options
context:
space:
mode:
authorMarkus Duft <markus.duft@ssi-schaefer.com>2016-10-07 12:39:45 +0200
committerChristian Halstrick <christian.halstrick@sap.com>2018-02-16 18:27:25 +0100
commit94bcde663c75735049aae0acbd9f6d8519ed1f05 (patch)
tree0472611b708aa3758882e6e3b7cf4eb0aab83f52 /org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/Lfs.java
parent9bebb1eae78401e1d3289dc3d84006c10d10c0ef (diff)
downloadjgit-94bcde663c75735049aae0acbd9f6d8519ed1f05.tar.gz
jgit-94bcde663c75735049aae0acbd9f6d8519ed1f05.zip
LFS: Add remote download to SmudgeFilter
Transfer data in chunks of 8k Transferring data byte per byte is slow, running checkout with CleanFilter on a 2.9MB file takes 20 seconds. Using a buffer of 8k shrinks this time to 70ms. Also register the filter commands in a way that the native GIT LFS can be used alongside with JGit. Implements auto-discovery of LFS server URL when cloning from a Gerrit LFS server. Change-Id: I452a5aa177dcb346d92af08b27c2e35200f246fd Also-by: Christian Halstrick <christian.halstrick@sap.com> Signed-off-by: Markus Duft <markus.duft@ssi-schaefer.com>
Diffstat (limited to 'org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/Lfs.java')
-rw-r--r--org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/Lfs.java18
1 files changed, 17 insertions, 1 deletions
diff --git a/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/Lfs.java b/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/Lfs.java
index 138996d82f..40d83420ec 100644
--- a/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/Lfs.java
+++ b/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/Lfs.java
@@ -47,6 +47,8 @@ import java.nio.file.Files;
import java.nio.file.Path;
import org.eclipse.jgit.lfs.lib.AnyLongObjectId;
+import org.eclipse.jgit.lfs.lib.Constants;
+import org.eclipse.jgit.lib.Repository;
/**
* Class which represents the lfs folder hierarchy inside a {@code .git} folder
@@ -66,12 +68,26 @@ public class Lfs {
* @param root
* the path to the LFS media directory. Will be
* {@code "<repo>/.git/lfs"}
+ * @deprecated use {@link #Lfs(Repository)} instead.
*/
+ @Deprecated
public Lfs(Path root) {
this.root = root;
}
/**
+ * Constructor for Lfs.
+ *
+ * @param db
+ * the associated repo
+ *
+ * @since 4.11
+ */
+ public Lfs(Repository db) {
+ this.root = db.getDirectory().toPath().resolve(Constants.LFS);
+ }
+
+ /**
* Get the LFS root directory
*
* @return the path to the LFS directory
@@ -118,7 +134,7 @@ public class Lfs {
public Path getMediaFile(AnyLongObjectId id) {
String idStr = id.name();
return getLfsObjDir().resolve(idStr.substring(0, 2))
- .resolve(idStr.substring(2));
+ .resolve(idStr.substring(2, 4)).resolve(idStr);
}
/**