summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.lfs.server
Commit message (Collapse)AuthorAgeFilesLines
* Remove Buck buildDavid Pursehouse2017-03-221-23/+0
| | | | | | Buck will be replaced with Bazel Change-Id: I3cf07d7aaaa2a58bac34e16c50af5416693254ac Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* bazel: Add explicit targets for library dependenciesJonathan Nieder2017-03-191-4/+4
| | | | | | | | | | | | | | | | | | | | This provides a place to declare visibility restrictions and transitive dependencies for each library. Other targets should only declare dependencies on what they directly use, making dependencies easier to maintain. Trim the dependencies of org.eclipse.jgit:jgit to follow that rule. It declares dependencies on Apache httpcomponents and the servlet API but doesn't use them. Tested: * 'bazel build //...' succeeds * applying the change https://gerrit-review.googlesource.com/90843 to a copy of Gerrit, following the instructions there, and running 'bazel test //...' in that copy of Gerrit still succeeds Change-Id: I3ab958ce8b3227019cdbe4cc81e0f042e1541034
* Silence API error reported in LfsProtocolServletMatthias Sohn2017-03-091-0/+11
| | | | | | | Breaking API for API implementors (not clients) in a minor release is ok following OSGi semantic versioning rules. Change-Id: I14bb4a3084b237b4cd893a130e148148cd1e5df9 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* LfsProtocolServlet: Pass HTTP Authorization header to getLargeFileRepositoryDavid Pursehouse2017-03-081-2/+49
| | | | | | | | This allows implementations to reject operations that do not include proper authentication. Change-Id: If301476d8fb56a0899e424be3789c7576097d185 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* Enable and fix warnings about redundant specification of type argumentsDavid Pursehouse2017-02-203-9/+9
| | | | | | | | | | Since the introduction of generic type parameter inference in Java 7, it's not necessary to explicitly specify the type of generic parameters. Enable the warning in Eclipse, and fix all occurrences. Change-Id: I9158caf1beca5e4980b6240ac401f3868520aad0 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* Enable and fix 'Should be tagged with @Override' warningDavid Pursehouse2017-02-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | Set missingOverrideAnnotation=warning in Eclipse compiler preferences which enables the warning: The method <method> of type <type> should be tagged with @Override since it actually overrides a superclass method Justification for this warning is described in: http://stackoverflow.com/a/94411/381622 Enabling this causes in excess of 1000 warnings across the entire code-base. They are very easy to fix automatically with Eclipse's "Quick Fix" tool. Fix all of them except 2 which cause compilation failure when the project is built with mvn; add TODO comments on those for further investigation. Change-Id: I5772061041fd361fe93137fd8b0ad356e748a29c Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* Don't rely on default locale when using toUpperCase() and toLowerCase()Matthias Sohn2017-01-281-2/+4
| | | | | | | | | | | | | | | | Otherwise these methods may produce unexpected results if used for strings that are intended to be interpreted locale independently. Examples are programming language identifiers, protocol keys, and HTML tags. For instance, "TITLE".toLowerCase() in a Turkish locale returns "t\u0131tle", where '\u0131' is the LATIN SMALL LETTER DOTLESS I character. See https://docs.oracle.com/javase/8/docs/api/java/lang/String.html#toLowerCase-- http://blog.thetaphi.de/2012/07/default-locales-default-charsets-and.html Bug: 511238 Change-Id: Id8d8f37d84d62239c918b81f8d883ed798d87656 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Implement Bazel build for http-apache, lfs, lfs-serverDavid Pursehouse2017-01-221-0/+17
| | | | | | | | | | | | | | | | | | | | Test plan: $ bazel build all $ unzip -t bazel-genfiles/all.zip Archive: bazel-genfiles/all.zip testing: libhttp-apache.jar OK testing: libjgit-archive.jar OK testing: libjgit-lfs-server.jar OK testing: libjgit-lfs.jar OK testing: libjgit-servlet.jar OK testing: libjgit.jar OK testing: libjunit.jar OK No errors detected in compressed data of bazel-genfiles/all.zip. Change-Id: I9e6c60898ccc6d2a4557ec7544c297442a9702b4 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* Make ObjectDownloadListener publicDavid Pursehouse2017-01-191-2/+4
| | | | | | | The same was already done for ObjectUploadListener in I5b0fb1220. Change-Id: Ie8a79f715fe69bed9331962fb478f7e35acf8680 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* Add missing slf4j dependency in BUCK file for jgit-lfs-serverZhen Chen2017-01-141-1/+2
| | | | | | Change-Id: I0c7fcae123f94ebd8e5eb2700e3d601a1b199be9 Signed-off-by: Zhen Chen <czhen@google.com> Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* LfsProtocolServlet#LfsRequest: Add operation type helper methodsDavid Pursehouse2017-01-141-0/+27
| | | | | | | | Server implementations may need to check what type of operation is being performed. Add helper methods to make it a bit simpler. Change-Id: Ia33ed6699ebcb9000ef514ce79bcddbebf94e1c5 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* Expose LFS operation strings as public constantsDavid Pursehouse2017-01-131-7/+6
| | | | | | | | So that they can be used either by third party LFS server implementations or from within other parts of JGit's internal LFS implementation. Change-Id: I58da6230247204588e017c010ce5b14e4615448d Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* LfsProtocolServlet: Improve error on getLargeFileRepository failureDavid Pursehouse2017-01-142-2/+12
| | | | | | | | 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>
* Add support for refusing LFS request due to invalid authorizationDavid Pursehouse2017-01-131-0/+4
| | | | | | | | | | | | | | | | | | | 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>
* Remove unused API warning filtersMatthias Sohn2016-12-291-17/+0
| | | | Change-Id: If6d343a55245219a652e35c9cfde69349dc09889 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Prepare 4.7.0-SNAPSHOT buildsMatthias Sohn2016-12-272-16/+16
| | | | | Change-Id: I20754d13007e6591d36aae5766f3a9a82b24e120 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Prepare 4.6.1-SNAPSHOT buildsMatthias Sohn2016-12-242-16/+16
| | | | | Change-Id: I6b05a6f6c3f92365c272e1bdaf76093ca01f2d58 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* JGit v4.6.0.201612231935-rv4.6.0.201612231935-rMatthias Sohn2016-12-242-2/+2
| | | | | Change-Id: Iaa88fe1b195dfe6be99a7b4cb064684e75563715 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Expose getObjectToTransfer method of FileLfsServletJacek Centkowski2016-12-061-1/+14
| | | | | | | | | Providing own implementation to doGet/doPut methods is troublesome when this method is private. Change-Id: I098cdc5cb90410eaaebc56c88c2d9e168584dd6d Signed-off-by: Jacek Centkowski <geminica.programs@gmail.com> Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* Merge branch 'stable-4.5'David Pursehouse2016-12-061-2/+3
|\ | | | | | | | | | | | | | | * stable-4.5: Use the same variable to check and extract LFS object id Change-Id: I314bd4373f40843c68853b3999f60d85e08628d9 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
| * Use the same variable to check and extract LFS object idJacek Centkowski2016-11-241-2/+3
| | | | | | | | | | | | | | | | It is easier to maintain when the same variable is used for both check and extraction of LFS object id. Change-Id: I5406f9bc4a085aa164c4565a9667ad2925105190 Signed-off-by: Jacek Centkowski <geminica.programs@gmail.com>
| * Prepare 4.5.1-SNAPSHOT buildsMatthias Sohn2016-09-212-15/+15
| | | | | | | | | | Change-Id: I3305e8a09a3fb06f25a316cff2bdbb551d3ade68 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| * JGit v4.5.0.201609210915-rv4.5.0.201609210915-rMatthias Sohn2016-09-212-2/+2
| | | | | | | | | | Change-Id: Idc02a1a1d74f84605d764c239803f0cfbad94eb7 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | Add missing @since tags for new APIMatthias Sohn2016-11-141-0/+1
| | | | | | | | Change-Id: Iaf83f66637d6a13e4a6d096ba8529553af7e30ed Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | Organize importsDavid Pursehouse2016-11-141-1/+1
| | | | | | | | | | Change-Id: I7c545d06b1bced678c020fab9af1382bc4416b6e Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* | FileLfsServlet: Make sendError protectedDavid Pursehouse2016-11-131-1/+13
| | | | | | | | | | Change-Id: Id89b3cd0da86a535946feb15254737bbf8d855d4 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* | Make ObjectUploadListener publicDavid Pursehouse2016-11-131-3/+8
| | | | | | | | | | Change-Id: I5b0fb1220bc0e5c660f1b5373abc5868d985c60b Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* | Change JGit minimum execution environment to JavaSE-1.8Matthias Sohn2016-09-203-5/+5
| | | | | | | | | | Bug: 500059 Change-Id: I47f3f6749a67da52029f84e002d9b155ed56d2b7 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | Move AtomicObjectOutputStream to lfs/internalChristian Halstrick2016-09-206-123/+3
| | | | | | | | | | | | | | | | | | 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
* | Prepare 4.6.0-SNAPSHOT buildsMatthias Sohn2016-09-192-15/+15
|/ | | | | Change-Id: Id2eafc331ee32c332c2a9b867b05c260beb0d10f Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Improve JavaDoc for LfsProtocolServlet.getLargeFileRepositoryMatthias Sohn2016-09-011-0/+23
| | | | | | Guide implementors which exception to throw in case of errors. Change-Id: I74fb76cdf6b7cdef513f3fe8c144572e869cc533 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Add specific exception for LFS unavailableDavid Pursehouse2016-08-301-10/+11
| | | | | | | | | | | | 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>
* LfsProtocolServlet: Add support for insufficient storage errorDavid Pursehouse2016-08-241-0/+4
| | | | | | | | | | | | | Since [1], the git-lfs specification allows the server to return HTTP 507 if there is insufficient storage for the uploaded object(s). Add a new exception class, which implementations may throw from the getRepository() method, causing HTTP 507 to be returned to the client. [1] https://github.com/github/git-lfs/pull/1473 Change-Id: If5bc0a35fcf870d4216af6ca2f7c8924689ef9c5 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* LfsProtocolServlet: Add support for rate limit and bandwidth limit errorsDavid Pursehouse2016-08-201-0/+10
| | | | | | | | | | | | | | | | | | | | | | The git-lfs specification [1] describes the following optional status codes that may be returned: 429 - The user has hit a rate limit with the server. Though the API does not specify any rate limits, implementors are encouraged to set some for availability reasons. 509 - Returned if the bandwidth limit for the user or repository has been exceeded. The API does not specify any bandwidth limit, but implementors may track usage. Add two new exception classes to represent these cases. Implementations may throw these from #getLargeFileRepository(), causing the corresponding HTTP status codes to be returned to the client. [1] https://github.com/github/git-lfs/blob/master/docs/api/v1/http-v1-batch.md Change-Id: I7b93f3cf90f7344c90b1587e07927fdeb167097e Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* LfsProtocolServlet: Always include message in error responseDavid Pursehouse2016-08-201-1/+2
| | | | | | | | | If the message is not sent, the client shows: Unable to parse HTTP response for POST http://admin@localhost:8080/test-project/info/lfs/objects/batch Change-Id: I8b72d1aded2bcd41b7389676e2373034625a1379 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* LfsProtocolServlet: Always set the Content-Type header on responseDavid Pursehouse2016-08-161-2/+3
| | | | | | | | | | | If the Content-Type is not set on error responses, the git-lfs client does not read the body which contains the error message, and instead just displays a generic error message. Also set the charset on the Content-Type header. Change-Id: I88e6f07f20b622a670e7c5063145dffb8b630aee Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* LfsProtocolServlet: Don't set pretty printing on GsonDavid Pursehouse2016-08-161-5/+4
| | | | | | | | Pretty printing is only used for outputting json content, which is interpreted by the client and does not need to be pretty printed. Change-Id: I48e0280241b6b0f5706300ae0f4c9bc461a89110 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* LfsProtocolServlet: Reuse existing Writer when sending error responseDavid Pursehouse2016-08-091-27/+19
| | | | | | | | Trying to open a new writer on the response causes an illegal state exception and the response is not sent. Change-Id: Ic718d23cfb3e74f5691cc2aea7283003af7df207 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* Silence API errors in LfsProtocolServletMatthias Sohn2016-08-091-0/+17
| | | | | | | | bb9988c2 changed the signature of getLargeFileRepository() which is only breaking implementors which is ok according to OSGi semantic versioning rules. Change-Id: I68bda7900b72e217571f74aee53705167f8100a2 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Add missing @since tags for new APIMatthias Sohn2016-08-092-1/+7
| | | | Change-Id: I8db29a0313fbc476152cef47f2eaa76954f1e280 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* LfsProtocolServlet: Allow access to objects in requestDavid Pursehouse2016-08-052-1/+28
| | | | | | | | | | | Classes implementing the LFS servlet should be able to inspect the objects given in the request. Add a getObjects method. Make the LfsObject class public, and add accessor methods. Change-Id: I27961679f620eb3a89dc8521aadd4ea2f936c60e Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* LfsProtocolServlet: Allow getLargeFileRepository to raise exceptionsDavid Pursehouse2016-08-051-6/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | According to the specification [1] the server may return the following HTTP error responses: - 403: The user has read, but not write access. - 404: The repository does not exist for the user. - 422: Validation error with one or more of the objects in the request. In the current implementation, however, getLargeFileRepository can only return null to indicate an error. This results in the error code: - 503: Service Unavailable being returned to the client regardless of what the actual reason was. Add exception classes to cover these cases, derived from a common base exception, and change the specification of getLargeFileRepository to throw the base exception. In LfsProtocolServlet#post, handle the new exceptions and send back the appropriate HTTP responses as mentioned above. The specification also mentions several other optional response codes (406, 429, 501, and 509) but these are not implemented in this commit. It should be trivial to implement them in follow-up commits. [1] https://github.com/github/git-lfs/blob/master/docs/api/v1/http-v1-batch.md#response-errors Change-Id: I91be6165bcaf856d0cefc533882330962e2fc9b2 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* Fix typo in email address in copyright headersDavid Pursehouse2016-07-282-2/+2
| | | | | Change-Id: Ib7b73d7d37574682bb58f969822c842e4e579233 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* LfsProtocolServlet: Pass request and path to getLargeFileRepositoryDavid Pursehouse2016-07-271-12/+29
| | | | | | | | | | | | Passing the request and path to the method will allow implementations to have more control over determination of the backend, for example: - return different backends for different requests - accept or refuse requests based on request characteristics - etc Change-Id: I1ec6ec54c91a5f0601b620ed18846eb4a3f46783 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* FileLfsServlet: Include error message in response bodyDavid Pursehouse2016-07-271-3/+29
| | | | | | | | | | According to the specification [1], the error response body must include the error message in json format. [1] https://github.com/github/git-lfs/blob/master/docs/api/v1/http-v1-batch.md#response-errors Change-Id: I79e7a841d230fdedefa53b9c6d2d477e81e1f9e6 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* FileLfsServlet: Return HTTP 422 instead of 400David Pursehouse2016-07-271-2/+2
| | | | | | | | | | | According to the specification [1], the error response status code should be 422 when there is a validation error with one or more of the objects in the request [1] https://github.com/github/git-lfs/blob/master/docs/api/v1/http-v1-batch.md#response-errors Change-Id: Id03fe00a2109b896d9a154228a14a33bce5accc3 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* Ignore 'The value of exception parameter is not used' warningDavid Pursehouse2016-07-261-0/+1
| | | | | Change-Id: I50407e4a33e35b718ca40503fdd436f1f9f70fba Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* Update links to LFS API documentationDavid Pursehouse2016-07-262-2/+2
| | | | | | | | The location of the API v1 documentation has changed. Update the links accordingly. Change-Id: If0148a0b573c474bbe157fcb7e6674c0055fe8b4 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* Remove duplicated single quotes in text not handled by MessageFormatMarkus Keller2016-07-011-5/+5
| | | | | Change-Id: I4b803b34d30a86105d111be417d4a4e6bfb1057b Signed-off-by: Markus Keller <markus_keller@ch.ibm.com>
* Prepare 4.5.0-SNAPSHOT buildsMatthias Sohn2016-06-012-15/+15
| | | | | Change-Id: I572fe9fea0e5ca0bec4648c916ae95a5b1ccf125 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>