Skip to main content
AgeCommit message (Collapse)AuthorFilesLines
2012-02-12JGit Sohn2-2/+2
Change-Id: I82c6c0c175ab6fb4e2113101f36c8d2ddf4a13c1 Signed-off-by: Matthias Sohn <>
2011-12-26Merge branch 'stable-1.2'Matthias Sohn2-0/+100
* stable-1.2: JGit v1.2.0.201112221803-r Expose unmerged paths when revert fails Enforce the use of Java5 API:s only (with a few exceptions) Change-Id: Ib18d41a65e68cc47fb63114fcce27a16820d0692 Signed-off-by: Matthias Sohn <>
2011-12-22JGit v1.2.0.201112221803-rv1.2.0.201112221803-rstable-1.2Matthias Sohn2-2/+2
Change-Id: Icc0b09324f205d93929af8cf522a99ad00cf7591 Signed-off-by: Matthias Sohn <>
2011-12-16Merge branch 'stable-1.2'Matthias Sohn1-0/+19
* stable-1.2: Add API checking using clirr Fix MergeCommandTest to pass if File.executable is not supported Fix ResolveMerger not to add paths with FileMode 0 Change-Id: I86e7194a40acd6dfa3d433f1d17c01bdf5bb0d9c Signed-off-by: Matthias Sohn <>
2011-12-16Enforce the use of Java5 API:s only (with a few exceptions)Robin Rosenberg2-0/+100
This only works with Eclipse 3.6 and newer and requires installation of new package. Documentation is not very good, but there is a blog about it here: API checking is especially useful on OS X where Java5 is not readily available. Change-Id: I3c0ad460874a21c073f5ac047146cbf5d31992b4 Signed-off-by: Matthias Sohn <>
2011-12-15Add API checking using clirrMatthias Sohn1-0/+19
In order to generate API reports run: mvn clirr:clirr The reports are generated to the folder target/site/clirr-report.html under the respective project. In order to check API compatibility and fail the build on incompatible changes run: mvn clirr:check For now we compare the API against the latest release Bug: 336849 Change-Id: I21baaf3a6883c5b4db263f712705cc7b8ab6d888 Signed-off-by: Matthias Sohn <> Signed-off-by: Kevin Sawicki <>
2011-12-10Prepare 1.3.0 buildsMatthias Sohn2-14/+14
Change-Id: I7a1ae73783c95041b59f047a7330e62e7f642149 Signed-off-by: Matthias Sohn <>
2011-12-02Discard request HTTP bodies for status code <400Shawn O. Pearce4-7/+59
The HTTP RFCs require a server to fully consume the request body before it can return a non-error status code, which is any code below 400. JGit returns most Git level errors inside of an HTTP 200 OK response, and sometimes this happens before the entire request was consumed from the servlet container. In such cases the body must be skipped or read until EOF is reached, ensuring the HTTP keep-alive semantics will work for the next request on the same TCP connection. HTTP status codes >= 400 may be returned without consuming the body, and a servlet container must set "Connection: close" in the response headers when this happens, since the state of the request body is not well defined with an early abort. With the introduction of sendError() in GitSmartHttpTools there are only a handful of locations that need to worry about the request body being consumed, so sprinkle the call in as necessary. Change-Id: I5381e110585f780c01a764df8e27c80aacf5146e
2011-12-02Ensure all smart HTTP errors are sent to clientsShawn O. Pearce2-15/+21
Error messages are typically short, below the 32 KiB in-memory buffer size of the SmartOutputStream. When an error is queued up for sending to a client and an exception is thrown up into the servlet handler we discarded the message and sent nothing to the client, as the messages were stuck inside of the SmartOutputStream buffer. Hoist the creation of the output stream above the invocation of try block of the service, and use close() in the few catch blocks that assume there are buffered messages ready for transmission. This will ensure errors from unpacking a stream in ReceivePack are sent off to a client correctly, as previously these were causing no status report to arrive at the client side as the data was stuck in the buffer. Change-Id: I5534b560697731121f48979ae077aa7c95b8e39c
2011-12-01Always close the GZIPOutputStream to release DeflaterShawn O. Pearce1-2/+5
The stream must be closed to ensure the native resources associated with its internal Deflater instance are cleaned up early, instead of waiting for GC to identify the dead object and finialize it. Change-Id: Ic31b5df563f19404ed4682556999f4332aa61562
2011-11-22Add utilities for smart HTTP error handlingShawn O. Pearce8-96/+355
The GitSmartHttpTools class started as utility functions to help report useful error messages to users of the service. Now that the GitServlet and GitFilter classes support filters before a git-upload-pack or git-receive-pack request, server implementors may these routines helpful to report custom messages to clients. Using the sendError() method to return an HTTP 200 OK with error text embedded in the payload prevents native Git clients from retrying the action with a dumb Git or WebDAV HTTP request. Refactor some of the existing code to use these new error functions and protocol constants. The new sendError() function is very close to being identical to the old error handling code in RepositoryFilter, however we now use the POST Content-Type rather than the Accept HTTP header to check if the client will accept the error data in the response body rather than using the HTTP status code. This is a more reliable way of checking for native Git clients, as the Accept header was not always populated with the correct string in older versions of Git smart HTTP. Change-Id: I828ac2deb085af12b6689c10f86662ddd39bd1a2
2011-11-22Strip leading slashes in RepositoryFilterShawn O. Pearce1-2/+2
If removing the leading slash results in an empty string, return with an HTTP 404 error before trying to use the RepositoryResolver. Moving this into a loop ahead of the length check ensures there is no empty string passed into the resolver. Change-Id: I80e5b7cf25ae9f2164b5c396a29773e5c7d7286e
2011-10-08Refactor HTTP server stack to use Filter as baseShawn O. Pearce8-291/+690
All Git URLs operate off a suffix approach, for example the default binding is for paths such as: */info/refs */git-upload-pack */git-receive-pack These names are not common on project hosting servers, especially one like Gerrit Code Review. In addition to offering Git-over-HTTP as a servlet, offer it as a filter that triggers when a matching suffix appears, but otherwise delegates the request through the chain. This filter would permit Gerrit Code Review to place projects at the root of the server, rather than within the "/p/" subdirectory, making the HTTP and SSH URL structure exactly match each other. To prevent breakage with existing users, the MetaServlet and GitServlet are kept as wrappers delegating to their filters, returning 404 Not Found when the filter has no match. Change-Id: I2465c15c086497e0faaae5941159d80c028fa8b1
2011-09-15Prepare 1.2.0 buildsMatthias Sohn2-14/+14
Change-Id: I9ec247135d93ef28d732e94f18d0ec1d0e2e6d44 Signed-off-by: Matthias Sohn <>
2011-09-15Prepare post v1.1.0.201109151100-r buildstable-1.1Matthias Sohn2-2/+2
Change-Id: Ib099ec93d8243b238641d79328216874532ab5eb Signed-off-by: Matthias Sohn <>
2011-09-15JGit v1.1.0.201109151100-rv1.1.0.201109151100-rMatthias Sohn2-2/+2
Change-Id: Iadcec7e5973600e005cbdeb837fa197d3ae2ea86 Signed-off-by: Matthias Sohn <>
2011-09-07Prepare post v1.1.0.201109071825-rc3 buildsMatthias Sohn2-2/+2
Change-Id: I1244f6639263d156a6f9e4530167e5eb1826a535 Signed-off-by: Matthias Sohn <>
2011-09-07JGit v1.1.0.201109071825-rc3v1.1.0.201109071825-rc3Matthias Sohn2-2/+2
Change-Id: I1b989d3101272632eacabe25a0b111ad0ff5bb3b Signed-off-by: Matthias Sohn <>
2011-09-05Use commit message best practices for Mylyn Commit templateMatthias Sohn2-0/+7
We should use a template for Mylyn commit messages that matches with our guidelines for commit messages. Bug: 337401 Change-Id: I05812abf0eb0651d22c439142640f173fc2f2ba0 Signed-off-by: Matthias Sohn <>
2011-09-01Prepare post-v1.1.0.201109011030-rc2 buildsMatthias Sohn2-2/+2
Change-Id: I8dda83cdbe88beba4a480df9846848bf3aceb9e2 Signed-off-by: Matthias Sohn <>
2011-09-01JGit v1.1.0.201109011030-rc2v1.1.0.201109011030-rc2Matthias Sohn2-2/+2
Change-Id: Ie6d65fe45ad92c813ce3a227729aa43681922249 Signed-off-by: Matthias Sohn <>
2011-06-10Push errors back over sideband when possibleShawn O. Pearce2-4/+24
If an internal exception occurs while packing and the request needs to abort, the HTTP response might already be committed due to progress message having already been delivered to the client. This prevents UploadPackServlet from resetting the response and sending back an HTTP 500 response. Try to catch all exceptions and report internal errors over the sideband stream or as an ERR command during the initial ACK/NAK negotiation phase. This allows JGit to transmit an error message that the user will receive on their console without needing to worry about resetting the (already gone) HTTP response. Change-Id: Ie393fb8bb55d2b79ab1276adf71c781c1807f9fe Signed-off-by: Shawn O. Pearce <>
2011-06-09Merge branch 'stable-1.0'Matthias Sohn3-1/+62
* stable-1.0: Prepare post JGit v1.0.0.201106090707-r builds JGit v1.0.0.201106090707-r Include about.html files in maven build Prepare post v1.0.0.201106081625-r builds JGit v1.0.0.201106081625-r Add missing about.html files to all shipped bundles Prepare post v1.0.0.201106071701-r builds JGit v1.0.0.201106071701-r
2011-06-09Prepare post JGit v1.0.0.201106090707-r buildsstable-1.0Matthias Sohn2-2/+2
Change-Id: I35292f9f6fb5ebc591308fdd2d069203413e189d Signed-off-by: Matthias Sohn <>
2011-06-09JGit v1.0.0.201106090707-rv1.0.0.201106090707-rMatthias Sohn2-2/+2
Change-Id: Iba44e71b6441a0e39122ca8666b51989e605f25f Signed-off-by: Matthias Sohn <>
2011-06-09Include about.html files in maven buildMatthias Sohn1-0/+1
Change-Id: Ifa96090eb0fc336ee8080385f48212b5158dd9f7 Signed-off-by: Matthias Sohn <>
2011-06-09Prepare post v1.0.0.201106081625-r buildsMatthias Sohn2-2/+2
Change-Id: I5e6994844405f7839ad3b3439f98bcadb59d329b Signed-off-by: Matthias Sohn <>
2011-06-08JGit v1.0.0.201106081625-rv1.0.0.201106081625-rMatthias Sohn2-2/+2
Change-Id: I629990189083bab4737938ad712080fba7917582 Signed-off-by: Matthias Sohn <>
2011-06-08Add missing about.html files to all shipped bundlesMatthias Sohn2-1/+61
Change-Id: I5a4ad9493da3816f21d9fdd0b5b977388d074500 Signed-off-by: Matthias Sohn <>
2011-06-08Prepare post v1.0.0.201106071701-r buildsMatthias Sohn2-2/+2
Change-Id: I67ee2912ef54462cf860dc4ec0a6334e9c619384 Signed-off-by: Matthias Sohn <>
2011-06-07JGit v1.0.0.201106071701-rv1.0.0.201106071701-rMatthias Sohn2-2/+2
Change-Id: Ic8f49336ba96c8dcf4bab2f74c0f1efc1ab55131 Signed-off-by: Matthias Sohn <>
2011-06-05Prepare 1.1.0 buildsMatthias Sohn2-14/+14
Change-Id: I4cf017cd567543846839612ab3ace6d26233e01d Signed-off-by: Matthias Sohn <>
2011-06-05Prepare post v1.0.0.201106051725-r buildsMatthias Sohn2-2/+2
Change-Id: I4839877e1a6fa7782f37423213af8d579727a494 Signed-off-by: Matthias Sohn <>
2011-06-05JGit v1.0.0.201106051725-rv1.0.0.201106051725-rMatthias Sohn2-2/+2
Change-Id: I39f4a23cf284505395d511dfedf02b7f5608df95 Signed-off-by: Matthias Sohn <>
2011-06-01Prepare post v1.0.0.201106011211-rc3 buildsMatthias Sohn2-2/+2
Change-Id: I4dec8eba7e35858aef65fcc10f91fad3fe5b52b9 Signed-off-by: Matthias Sohn <>
2011-06-01JGit v1.0.0.201106011211-rc3v1.0.0.201106011211-rc3Matthias Sohn2-2/+2
Change-Id: I574a05200471c431b3a02ac6ff208dc6aa90f539 Signed-off-by: Matthias Sohn <>
2011-05-31Remove incubation markerMatthias Sohn1-1/+1
Change-Id: I6018ce0cd3b7c8137e137848fe1f04551b257538 Signed-off-by: Matthias Sohn <>
2011-05-04Fix error handling in RepositoryFilterShawn O. Pearce1-3/+6
The filter did not correctly match smart HTTP client requests, so it always fell back on HTTP status codes for errors. This usually causes a smart client to retry a dumb request, which is not what the server wants. Change-Id: I42592378dc42fbe308ef30a2923786c690f668a9 Signed-off-by: Shawn O. Pearce <>
2011-05-02Qualify post-0.12 buildsMatthias Sohn2-14/+14
Change-Id: I70fe2671321efb5c3d271121ce00299533d1b388 Signed-off-by: Matthias Sohn <>
2011-05-02JGit 0.12.1v0.12.1stable-0.12Matthias Sohn2-14/+14
Change-Id: Ia6e58b466fa3ef7ddd61b40f2ad44141fe8786c4 Signed-off-by: Matthias Sohn <>
2011-04-21Implement the no-done capabilityShawn O. Pearce1-0/+1
Smart HTTP clients may request both multi_ack_detailed and no-done in the same request to prevent the client from needing to send a "done" line to the server in response to a server's "ACK %s ready". For smart HTTP, this can save 1 full HTTP RPC in the fetch exchange, improving overall latency when incrementally updating a client that has not diverged very far from the remote repository. Unfortuantely this capability cannot be enabled for the traditional bi-directional connections. multi_ack_detailed has the client sending more "have" lines at the same time that the server is creating the "ACK %s ready" and writing out the PACK stream, resulting in some race conditions and/or deadlock, depending on how the pipe buffers are implemented. For very small updates, a server might actually be able to send "ACK %s ready", then the PACK, and disconnect before the client even finishes sending its first batch of "have" lines. This may cause the client to fail with a broken pipe exception. To avoid all of these potential problems, "no-done" is restricted only to the smart HTTP variant of the protocol. Change-Id: Ie0d0a39320202bc096fec2e97cb58e9efd061b2d Signed-off-by: Shawn O. Pearce <>
2011-04-18Make running static checks configurable in maven buildMatthias Sohn1-33/+0
In order to run the static checks run: mvn -P static-checks clean install Change-Id: I14077498a04be986ded123ddbfc97da8f9bc3130 Signed-off-by: Matthias Sohn <>
2011-04-01smart HTTP: Return errors inside payloadShawn O. Pearce5-7/+63
When the client is clearly making a smart HTTP request to our smart HTTP server, return any errors like RepositoryNotFoundException or ServiceNotEnabledException inside of the payload as a Git level ERR message, rather than an HTTP error code. This prevents the C Git command line client from retrying a failed "$URL/info/refs?service=git-upload-pack" request without the smart service URL, only to fail again with "403 Forbidden" when the dumb as-is service has been disabled by the server configuration, or is unavailable because the repository is not on the local filesystem. Change-Id: I57e8756d5026e885e0ca615979bfcd729703be6c Signed-off-by: Shawn O. Pearce <>
2011-04-01UploadPack: Add a PreUploadHook to monitor and control behaviorShawn O. Pearce2-1/+16
Embedding applications can use this hook to watch actions within UploadPack and possibly reject them. This could be useful to prevent clones of a large repository from this server, or to stop abusive negotiation rounds that offer thousands of objects in a single batch. Change-Id: Id96f1885ac4d61f22c80b6418fff54184b7348ba Signed-off-by: Shawn O. Pearce <>
2011-04-01Allow application filters on smart HTTP operationsShawn O. Pearce5-64/+228
Permit applications embedding GitServlet to wrap the info/refs?service=$name and /$name operations with a servlet Filter. To help applications inspect state of the operation, expose the UploadPack or ReceivePack object into a request attribute. This can be useful for logging, or to implement throttling of requests like Gerrit Code Review uses to prevent server overload. Change-Id: Ib8773c14e2b7a650769bd578aad745e6651210cb Signed-off-by: Shawn O. Pearce <>
2011-02-25Use generics in RepositoryFilter constructorRobin Rosenberg1-2/+2
Change-Id: I461786baffab15515365ead1d9c350a1880443ea
2011-02-16smart-http: Support progress in ReceivePackShawn O. Pearce1-1/+6
As PackParser supports a progress meter for the "Resolving deltas" phase of its work, we should export this to smart HTTP clients so they know the server is still working on their (large) upload. However this isn't as simple as just dropping in a binding for the SmartOutputStream to flush when its told to. We want to avoid spurious flushes triggered by the use of sideband, or the status report formatting in the send-pack/receive-pack protocol. Change-Id: Ibd88022a298c5fed0edb23dfaf2e90278807ba8b Signed-off-by: Shawn O. Pearce <>
2011-02-16smart-http: Fix recognition of gzip encodingShawn O. Pearce1-2/+17
Some clients coming through proxies may advertise a different Accept-Encoding, for example "Accept-Encoding: gzip(proxy)". Matching by substring causes us to identify this as a false positive; that the client understands gzip encoding and will inflate the response before reading it. In this particular case however it doesn't. Its the reverse proxy server in front of JGit letting us know the proxy<->JGit link can be gzip compressed, while the client<->proxy part of the link is not: client <-- no gzip --> proxy <-- gzip --> JGit Use a more standard method of parsing by splitting the value into tokens, and only using gzip if one of the tokens is exactly the string "gzip". Add a unit test to make sure this isn't broken in the future. Change-Id: I30cda8a6d11ad235b56457adf54a2d27095d964e Signed-off-by: Shawn O. Pearce <>
2011-02-15daemon: Use HTTP's resolver and factory patternShawn O. Pearce18-546/+42
Using a resolver and factory pattern for the anonymous git:// Daemon class makes transport.Daemon more useful on non-file storage systems, or in embedded applications where the caller wants more precise control over the work tasks constructed within the daemon. Rather than defining new interfaces, move the existing HTTP ones into transport.resolver and make them generic on the connection handle type. For HTTP, continue to use HttpServletRequest, and for transport.Daemon use DaemonClient. To remain compatible with transport.Daemon, FileResolver needs to learn how to use multiple base directories, and how to export any Repository instance at a fixed name. Change-Id: I1efa6b2bd7c6567e983fbbf346947238ea2e847e Signed-off-by: Shawn O. Pearce <>
2011-02-12Qualify post 0.11 buildsMatthias Sohn2-13/+13
Change-Id: Ibcef4fc4c986c2cda01e943d16aa1c53eff99f25 Signed-off-by: Matthias Sohn <>

Back to the top