Commit Graph

14 Commits

Author SHA1 Message Date
Thomas Wolf b12ec8f377 LFS: clean up messages
Remove an unused message, and remove unnecessary quotes.

Change-Id: I9da3eeb3db33324fa07bebd434bca3c0a4da27ab
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2022-03-21 04:58:50 -04:00
Matthias Sohn 877c79dc69 Fix typos of some keys in LfsText
Change-Id: I86dee0b68e627e26cbd29976162bc7b953ebf276
2022-03-03 10:47:46 +01:00
Matthias Sohn 5ac27a55b0 Sort LfsText entries alphabetically
Change-Id: I3021cb246b51d861d51258808c75d5c6843ec82d
2022-03-03 10:47:46 +01:00
Matthias Fromme a229072fcd Support for "lfs.url" from ".lfsconfig"
- New class LfsConfig to enrich repository configuration by settings
from ".lfsconfig" file respecting configuration file precedence.
- Adapted LfsConnectionFactory to use LfsConfig instead of directly
using configuration from repository to calculate url of the lfs
repository

Bug: 578020
Change-Id: I156f4ec137c2e428136a2ca9b8a4011ecee2d915
2022-03-03 10:47:45 +01:00
Markus Duft c0103bc59d LFS: Enable LFS support for the CLI, better error handling
Enable LFS support for the CLI by registering the according filters.

Errors during filter creation must be propagated up the call stack, as a
failure to create a filter should be treated as fatal if the filter is
required.

Change-Id: I3833757839bdda97cd01b6c21c1613d199e2692d
Signed-off-by: Markus Duft <markus.duft@ssi-schaefer.com>
2018-03-03 11:44:01 +01:00
Markus Duft c0bb992845 LFS: pre-push upload support
If JGit built in LFS support is enabled for the current repository (or
user/system), any existing pre-push hook will cause an exception for the
time beeing, as only a single pre-push hook is supported.

Thus either native pre-push hooks OR JGit built-in LFS support may be
enabled currently, but not both.

Change-Id: Ie7d2b90e26e948d9cca3d05a7a19489488c75895
Signed-off-by: Markus Duft <markus.duft@ssi-schaefer.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-02-27 18:32:45 +01:00
Markus Duft 94bcde663c 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>
2018-02-16 18:27:25 +01:00
David Pursehouse 590141163f LfsProtocolServlet: Improve error on getLargeFileRepository failure
Externalize the error message and make it more specific. Also emit
an error log.

Change-Id: Ie7b1c90c54673bfb8e133fb0aa19a117d4ca6587
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2017-01-14 00:05:56 +01:00
David Pursehouse 7245aa0316 Add support for refusing LFS request due to invalid authorization
Add a new exception type that server implementations can throw when a
client attempts to make an unauthorized LFS operation, which will result
in HTTP 401 Unauthorized being returned to the client.

An example of this is a Gerrit server that rejects a request to perform
an LFS operation on a ref that is not visible to the caller.

As defined in the LFS spec [1] the request may include authentication,
and per RFC 2616 [2], "401 response indicates that authorization has been
refused for those credentials".

[1] https://github.com/git-lfs/git-lfs/blob/master/docs/api/batch.md
[2] https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html

Change-Id: I2aa22e2144df5fb7972df0e3285b77b08ecc63f2
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2017-01-13 10:46:15 +09:00
Christian Halstrick e4e39a6d05 Move AtomicObjectOutputStream to lfs/internal
The class AtomicObjectOutputStream should be available to all lfs
related classes, not only to the server side. Move the class from
org.eclipse.jgit.lfs.server.fs to org.eclipse.jgit.lfs.internal to
achieve that.

Change-Id: I028e1c9ec7c21f316340b21d558b9a6b77e2060d
2016-09-20 10:58:20 +02:00
Christian Halstrick 45ee55d0d9 Add built-in LFS clean filter
Adds a JGit built-in implementation of the "git lfs clean" filter. This
filter should do the same as the one described in [1]. But since this
filter is written in Java and can be called by JGit without forking new
processes it should be much faster

[1]
https://github.com/github/git-lfs/blob/master/docs/man/git-lfs-clean.1.ronn

Change-Id: If60e387e97870245b4bd765eda6717eb84cffb1d
2016-09-20 10:11:27 +02:00
David Pursehouse d52bf2eee0 Add specific exception for LFS unavailable
Instead of returning null, LfsProtocolServlet#getLargeFileRepository
should throw LfsUnavailable.

If null is returned, throw a generic LfsException.

Handle LfsException as an internal server error and return HTTP 500.

Change-Id: I33e2a19fcc0fde8aaf0f703860c8fa8ce2de2db5
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2016-08-30 20:51:02 +02:00
David Pursehouse 0a86b03eb4 LfsRepository{NotFound,ReadOnly}: Externalize message strings
Instead of hard-coding the message strings, define them in a properties
file. This will allow them to be translated.

Change-Id: I77556881579e66b2c13d187759c7efdddfee87ae
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2016-08-20 11:24:45 +09:00
Matthias Sohn 536db18cc6 Implement SHA-256 abstraction
The Large File Storage extension specified by GitHub [1] uses SHA-256 to
compute the ID of large files stored by the extension. Hence implement a
SHA-256 abstraction similar to the SHA-1 abstraction used by JGit.

[1] https://git-lfs.github.com/

Bug: 470333
Change-Id: I3a95954543c8570d73929e55f4a884b55dbf1b7a
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2016-02-04 17:49:42 +01:00