Commit Graph

129 Commits

Author SHA1 Message Date
Matthias Sohn b14a939718 Prepare 3.3.0-SNAPSHOT builds
Change-Id: I7c7e7c1beec0c5d15b96c14c73ce93e3f09855c8
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-12-05 22:42:47 +01:00
Matthias Sohn b41b5d723e Add uses directives to ensure OSGi wires jgit bundles correctly
See
http://spring.io/blog/2008/10/20/understanding-the-osgi-uses-directive/

Bug: 420903
Change-Id: I3706a2b8f695d4ce0ee2333722ed7b8d31032f1e
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-11-12 23:11:16 +01:00
Shawn Pearce b8eac43c0f Merge changes I85470d1d,I43711486,Ie6ade781,Ic9ab2b6e,Iebe50933,Id6fac253,Ia6becf30,I2af8b0ac
* changes:
  Use absolute paths for file:// URIs in tests
  Use getPath() in FileResolverTest
  Extract protocol constants to a common class
  Move repeat() to utility class for tests
  Remove hardcoded target/trash from test cases
  Remove dependency on StatusCommandTest
  Remove dependency on DiffFormatterReflowTest
  Remove unnecessary import of BaseConnection in MessageWriter
2013-11-05 12:41:12 -05:00
Shawn Pearce b0dbb78e7d Extract protocol constants to a common class
This avoids the server from referencing the client code directly.

Change-Id: Ie6ade781b5a689646ad8b0b2988ef2b544412195
2013-11-01 19:57:47 -07:00
Tomasz Zarna 52ce448662 Add missing resources from source.. in build.properties
Change-Id: Ief9b84c07494bdb01ce16b4ae3353c5364cc6625
Signed-off-by: Tomasz Zarna <tomasz.zarna@tasktop.com>
2013-10-30 17:42:38 +01:00
Colby Ranger 5218f7b33a Propagate IOException where possible when getting refs.
Currently, Repository.getAllRefs() and Repository.getTags() silently
ignores an IOException and instead returns an empty map. Repository
is a public API and as such cannot be changed until the next major
revision change. Where possible, update the internal jgit APIs to
use the RefDatabase directly, since it propagates the error.

Change-Id: I4e4537d8bd0fa772f388262684c5c4ca1929dc4c
2013-10-07 11:32:54 -07:00
Matthias Sohn 7995d87713 Prepare 3.2.0-SNAPSHOT builds
Change-Id: Iac6cf7a5bb6146ee3fe38abe8020fc3fc4217584
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-10-03 18:21:31 +02:00
Matthias Sohn da6e87bc37 Prepare post 3.1.0 builds
Change-Id: I306a3d40c6ddb88a16d17f09a60e3d19b0716962
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-10-03 17:29:00 +02:00
Matthias Sohn 16ca725b35 JGit v3.1.0.201310021548-r
Change-Id: I2170b13047d5eab7565f47f9feb1680e03b1ba09
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-10-02 22:09:19 +02:00
Matthias Sohn 5a2a2222ef Prepare post 3.1.0 RC1 builds
Change-Id: I060f2082ccd0c91905b6b29a49cc633a0b51a1f2
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-09-27 15:54:40 +02:00
Matthias Sohn 6f0681eb9f JGit v3.1.0.201309270735-rc1
Change-Id: I48202dd461110da25f9bc159c938311fff0669e0
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-09-27 13:34:51 +02:00
Robin Stocker 01ebfa6c17 Disable warning about assigning to parameter
See change I08bed4275af9ec52aa4d7054067ac82f6a3c9781, where fixing such
warning lead to complaints.

If fixing is not wanted, disable it instead.

Change-Id: If31d4028fa1c6377a11e83ed5688b45701cec68b
2013-06-15 15:11:54 +02:00
Matthias Sohn 6b9c0d1232 Prepare 3.1.0-SNAPSHOT builds
Change-Id: I7490a7c9558423c03e3c167ad55b9a98be9d99d9
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-06-13 16:13:32 +02:00
Matthias Sohn 135a78cfcb Remove unused dependencies
Change-Id: I3cd161ac360a2e2635bffe309725a41c9527694e
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-04-09 16:57:54 +02:00
Matthias Sohn 011f7fd27d Fix plugin provider names to conform with release train requirement
According to release train requirements [1] the provider name for all
artifacts of Eclipse projects is "Eclipse <project name>".

[1] http://wiki.eclipse.org/Development_Resources/HOWTO/Release_Reviews#Checklist

Change-Id: I8445070d1d96896d378bfc49ed062a5e7e0f201f
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-04-08 23:05:36 +02:00
Shawn Pearce f32b861243 JGit 3.0: move internal classes into an internal subpackage
This breaks all existing callers once. Applications are not supposed
to build against the internal storage API unless they can accept API
churn and make necessary updates as versions change.

Change-Id: I2ab1327c202ef2003565e1b0770a583970e432e9
2013-03-18 09:30:43 -07:00
Matthias Sohn ba6ae0c7ec Prepare 2.4.0-SNAPSHOT builds
Change-Id: I4ab2baeb5d598d40d5dadfccdfe75152a1b9b7bf
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-02-14 00:59:25 +01:00
Robin Rosenberg a57dd1c164 Declare essentially static methods as static
Change-Id: I83ca25fb569c0dbc36eb374d5437fcf2b65a6f68
2012-12-27 12:08:06 -05:00
Robin Rosenberg 04bc9b3ddc Add type argumente to some raw reclaration
Change-Id: Ief195fb5c55f75172f0428fdac8c8874292ae566
2012-12-27 11:57:34 -05:00
Matthias Sohn 706f8eb9fc Prepare 2.3.0 builds
Change-Id: I0ca539e8cfe444f96c64dc56d1f0ef33b66e0cff
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2012-12-21 00:48:45 +01:00
Shawn Pearce 20e3779e10 Disable response compression on /git-receive-pack URLs
Compressing the response with gzip causes the stream to delay
flushing until gzip has seen the entire response message, or buffers
fill up and the compressed data has to be sent. This hides the
resolving progress monitor from the client, as well as any other
progress messages the server might be trying to send.

Disable compression in receive, matching what /git-upload-pack has.

Change-Id: Ic8d8abe1f43c3f540d1ee7c43a8947a555307d94
2012-12-07 12:28:36 -08:00
Robin Rosenberg e365265ad7 Do not warn about non-translated strings in the http library
The strings here are for machine-to-machine communications.

Change-Id: Ia0d19fce3d9843d18d329d9bc5b10d62c4125db8
2012-11-25 17:20:17 +01:00
Robin Rosenberg 20c829838a Make an exception for the formatting rules (turn off) for some files
Our rule to enforce javodocs for public members gives us a problem
because there are some patterns where javadoc make little sense so we
make the comments as small as possible, which our formatting rules do
not like, so disable it for those source files.

Change-Id: I6e3edb1e650ed45428b89cf41e6151b6536bca8a
Signed-off-by: Chris Aniszczyk <zx@twitter.com>
2012-11-16 10:28:42 -08:00
Robin Rosenberg 57333a8e93 Harmonize the JDT settings within JGit
Note the the settings are slightly less restrictive for test bundles.
-Also cleanup a couple of malformed javadocs
-Update compiler warnings/errors to include default values from Juno
-We now flag diagnosed null dereference as error. We didn't do that
 earlier because of some false positives.

Change-Id: I58386d63164e65d3d8d1998da3390d99bdc7381a
Signed-off-by: Chris Aniszczyk <zx@twitter.com>
2012-11-16 10:25:45 -08:00
Robin Rosenberg 81fa566295 Suppress resource warnings with Java 7
For streams that should not be closed, i.e. don't own an underlying
stream, and in-memory streams that do not need to be closed we just
suppress the warning. This mostly apply to test cases. GC is enough.

For streams with external resources (i.e. files) we add the necessary
call to close().

Change-Id: I4d883ba2e7d07f199fe57ccb3459ece00441a570
2012-10-25 15:17:23 -07:00
Robin Rosenberg 22427b748b Remove unnecessary @SuppressWarnings
Change-Id: Ic7b8494713d59574ee8f064a5c1042b48aedf012
2012-09-23 23:00:36 +02:00
Shawn O. Pearce eb5b506acd Merge changes Ic2b78ba9,Ia13e63ed
* changes:
  Use '406 Not Acceptable' when info/refs is disabled
  Compress large /info/refs responses on HTTP
2012-09-22 19:53:52 -04:00
Robin Rosenberg c3f1fac03f Suppress boxing warnings where we know they are ok
Invoke the wrapper types' valueOf via static imports.
For booleans used in asserts, add a new assert in
the JUnit utility package since out current version of JUnit
does not have the assert(boolean, boolean) method.

Change-Id: I9099bd8efbc8c133479344d51ce7dabed8958a2b
2012-09-22 01:21:00 +02:00
Shawn O. Pearce b3e8f29fe9 Use '406 Not Acceptable' when info/refs is disabled
Instead of a confusing 403 Forbidden error indicating the dumb file
service is disabled on this server, use 406 Not Acceptable to mean
the client sent a request for content (the plain info/refs file)
that this server does not want to provide.

The stock C Git client will report HTTP 406 error if it predates
1.6.6 or something goes wrong with the smart request and it tried
falling back to the dumb request. This may help to debug cases where
a broken proxy server exists between the client and the server and
has mangled a prior smart info/refs response.

Change-Id: Ic2b78ba9502e4bbdff7cc3ba1fd284cf7616412b
2012-09-19 19:19:20 -07:00
Shawn O. Pearce f93a6a7229 Compress large /info/refs responses on HTTP
Enable streaming compression for any response that is bigger than
the 32 KiB buffer used by SmartOutputStream. This is useful on the
info/refs file which can have many branches and tags listed, and
is often bigger than 32 KiB, but also compresses by at least 50%.

Disable streaming compression on large git-upload-pack responses,
as these are usually highly compressed Git pack data. Trying to
compress these with gzip will only waste CPU time and additional
transfer space with the gzip wrapper. Small git-upload-pack data
is usually text based negotiation responses and can be squeezed
smaller with a little bit of CPU usage.

Change-Id: Ia13e63ed334f594d5e1ab53a97240eb2e8f550e2
2012-09-19 17:33:07 -07:00
Matthias Sohn 4b3c0f8aba Prepare 2.2.0 builds
Change-Id: I386ba70541d644e58661d26713b309371e0f9257
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2012-09-19 09:10:12 +02:00
Shawn O. Pearce 1c6c73c5a9 Work around smart HTTP bugs in C Git
I have unfortunately introduced a few bugs in the native Git client
over the years. 1.7.5 is unable to send chunked requests correctly,
resulting in corrupt data at the server. Ban this client whenever
it uses chunked encoding with an error message.

Prior to some more recent versions, git push over HTTP failed to
report status information and error messages due to a race within
the client and its helper process. Check for these bad versions and
send errors as messages before the status report, enabling users
to see the failures on their terminal.

Change-Id: Ic62d6591cbd851d21dbb3e9b023d655eaecb0624
2012-06-27 14:11:42 -07:00
Dave Borowitz 330c3cae72 Serve 403 from RepositoryFilter on ServiceMayNotContinueException
This has no effect on Git clients, but for browsers, 403 Forbidden may
be more appropriate. 500 Internal Server Error implies that there is
a problem with the server, whereas ServiceMayNotContinueException is
specifically intended to cover cases where the server is functioning
correctly but has determined that the request may not proceed.

Change-Id: I825abd2a029d372060103655eabf488a0547c1e8
2012-06-20 14:53:59 -07:00
Matthias Sohn 9000351909 Prepare 2.1.0 builds
Change-Id: I4aad3efdd435d8d5eb53c84a8d38132acce97c25
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2012-06-14 00:45:13 +02:00
Dave Borowitz b12f80e71c Add MetaFilter.serveRegex(Pattern)
This allows the use of precompiled patterns, such as those compiled with
flags.

Change-Id: I1c87fea98e246004aecbae3aabaf1d21fbf3176e
2012-06-08 12:16:31 -07:00
Dave Borowitz 61c4e39067 Expand RegexPipeline documentation
Include some behaviors that were not clear to me until I had used it a
few times.

Warn about broken behavior for capture groups that do not match. It
would be nice to support these, but even for the cases where it's
clear what the behavior should be, it would be infeasible to
implement.

For example, consider the second group of the regex "(/a)/b(/c)?"
matched against the path "/a/b". We might want getServletPath() to
return "/a/b" and getPathInfo() to return null, but this is hard to
implement: there's no easy way to say "the substring up to the point
where (/c) would have matched if it were in the string even though
it's not." And even if we could, it's not clear there is even a right
answer in the general case.

Moreover, ideally we could warn about such broken patterns at servlet
initialization time, rather than at runtime, but even answering the
question of whether there are capture groups that might not match
requires more customized regular expression parsing than we want to
embark on. Hence, the best we can do is document how it fails.

Change-Id: I7bd5011f5bd387f9345a0e79b22a4d7ed918a190
2012-06-08 12:16:31 -07:00
Dave Borowitz 55bf06b43d Allow RepositoryResolver to throw ServiceMayNotContinueException
Implementations may want to send an error message to the user, which
doesn't really fit with any of the existing exception types.
ServiceMayNotContinueException, on the other hand, is documented as
always containing a user-visible error string, so use that.

Modify the git and HTTP transport mechanisms to properly relay this
message to the end user.

Change-Id: I362e67ea46102a145bf2c6284d38788537c9735f
2012-03-26 10:19:40 -07:00
Robin Rosenberg 708febedaf cleanup: Remove unnecessary @SuppressWarnings
Change-Id: Ie22ac47e315bff76f224214bc042fc483eb01550
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
2012-03-09 13:30:07 +01:00
Shawn O. Pearce c1ed9483ff Use readString() to trim trailing LF from first line
The fetch-pack/upload-pack stream usually has an LF at the
end of the first "want" line. Trim this when checking to
see if side-band or side-band-64k was used.

Perform the same trim for send-pack/receive-pack, as it is
harmless in this context to ignore an LF just before doing
an error report.

Change-Id: I6ef946bb6124fa72c52bd5320187eaac3ed906e7
2012-03-07 19:51:12 -08:00
Dave Borowitz 039c785d9f Try to send HTTP error messages over sideband
When a client POSTs to /git-{upload,receive}-pack, the first line
includes their client capabilities. As soon as the C git client sends
side-band(-64k), it goes into a state where it chokes on data not sent
in a valid sideband channel.

GitSmartHttpTools.sendError() is called early in the request, likely
before a {Upload,Receive}Pack handler is assigned or, even so, before it
has read the request. In some cases we must read the first line manually
within sendError() to tell whether sideband is needed.

Change-Id: I8277fd45a4ec3b71fa8f87404b4f5d1a09e0f384
2012-03-07 15:04:45 -08:00
Dave Borowitz 1f2022e3a7 Modify refs in UploadPack/ReceivePack using a hook interface
This is intended to replace the RefFilter interface (but does not yet,
for backwards compatibility). That interface required lots of extra
scanning and copying in filter cases such as only advertising a subtree
of the refs directory. Instead, provide a hook that can be executed
right before ref advertisement, using the public methods on
UploadPack/ReceivePack to explicitly set the map of advertised refs.

Change-Id: I0067019a191c8148af2cfb71a675f2258c5af0ca
2012-02-29 19:09:23 -08:00
Matthias Sohn 755dfdb409 Prepare 2.0.0-SNAPSHOT builds
Change-Id: I946e315af04227727ac937ebe9d70ae1ea4e8936
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2012-02-16 00:49:49 +01:00
Matthias Sohn 067ccbfda7 Merge branch 'stable-1.2'
* 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 <matthias.sohn@sap.com>
2011-12-26 23:52:32 +01:00
Matthias Sohn a069e90fa9 JGit v1.2.0.201112221803-r
Change-Id: Icc0b09324f205d93929af8cf522a99ad00cf7591
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2011-12-23 00:19:02 +01:00
Matthias Sohn f1019b9738 Merge branch 'stable-1.2'
* 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 <matthias.sohn@sap.com>
2011-12-16 08:50:49 +01:00
Robin Rosenberg 0ca105a502 Enforce the use of Java5 API:s only (with a few exceptions)
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:
http://eclipseandjazz.blogspot.com/2011/10/of-invalid-references-to-system.html

API checking is especially useful on OS X where Java5 is not readily
available.

Change-Id: I3c0ad460874a21c073f5ac047146cbf5d31992b4
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2011-12-16 01:01:36 +01:00
Matthias Sohn e178ba20d0 Add API checking using clirr
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
1.1.0.201109151100-r.

Bug: 336849
Change-Id: I21baaf3a6883c5b4db263f712705cc7b8ab6d888
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Signed-off-by: Kevin Sawicki <kevin@github.com>
2011-12-15 15:50:46 -08:00
Matthias Sohn 7fded4d14f Prepare 1.3.0 builds
Change-Id: I7a1ae73783c95041b59f047a7330e62e7f642149
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2011-12-10 01:07:16 +01:00
Shawn O. Pearce db00632db7 Discard request HTTP bodies for status code <400
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-01 16:01:13 -08:00
Shawn O. Pearce ac6cda955c Ensure all smart HTTP errors are sent to clients
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-01 16:01:11 -08:00