Commit Graph

6525 Commits

Author SHA1 Message Date
Ivan Frade 8d4f8d55d3 UploadPack: Return correct peer user agent on v2 requests
UploadPack.getPeerUserAgent() doesn't produce the expected results for
protocol v2 requests. In v2, the agent reported in the request (in an
"agent=" line) is not in the clientCapabilities but in a field on its
own. This makes getPeerUserAgent default to the transport user agent.

Making "agent" a shared property between protocol v0/v1 and v2 fixes the
problem, simplifies the function and harmonizes the implementation
between protocol versions.

In a follow up commit the "agent" will be identified on parsing time,
instead of taking it from the client capabilities.

Change-Id: Idf9825ec4e0b81a1458c8e3701f3e28aafd8a32a
Signed-off-by: Ivan Frade <ifrade@google.com>
2018-10-19 16:55:56 -07:00
Matthias Sohn 92aca6195d JGit v4.11.5.201810191925-r
Change-Id: I9d11536062de74775ca545c26f341610d0ddaeb2
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-10-20 01:27:52 +02:00
Matthias Sohn 976a8e369d Merge branch 'stable-4.10' into stable-4.11
* stable-4.10:
  Prepare 4.9.8-SNAPSHOT builds
  JGit v4.9.7.201810191756-r
  Update API problem filter
  Prepare 4.7.7-SNAPSHOT builds
  JGit v4.7.6.201810191618-r
  Update API problem filter
  Fix file handle leak in ObjectDownloadListener.onWritePossible
  Replace Findbugs with Spotbugs in org.eclipse.jgit/pom.xml
  Replace FindBugs with SpotBugs
  Prepare 4.4.2-SNAPSHOT builds
  JGit v4.0.3.201509231615-r

Change-Id: I5698fde41417c4ce9e813c683c84978f303b76fe
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-10-20 01:23:27 +02:00
Matthias Sohn 019f1b2d4c Merge branch 'stable-4.9' into stable-4.10
* stable-4.9:
  Prepare 4.9.8-SNAPSHOT builds
  JGit v4.9.7.201810191756-r
  Update API problem filter
  Prepare 4.7.7-SNAPSHOT builds
  JGit v4.7.6.201810191618-r
  Update API problem filter
  Fix file handle leak in ObjectDownloadListener.onWritePossible
  Replace Findbugs with Spotbugs in org.eclipse.jgit/pom.xml
  Replace FindBugs with SpotBugs
  Prepare 4.4.2-SNAPSHOT builds
  JGit v4.0.3.201509231615-r

Change-Id: I6f07ea02491ba3a32f30ee2408e1153241cc8a07
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-10-20 00:16:21 +02:00
Matthias Sohn 7ae004509c Prepare 4.9.8-SNAPSHOT builds
Change-Id: Iab7b0f2a21a76f801a83fbeb54f09d1525878f4d
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-10-20 00:10:02 +02:00
Matthias Sohn 97534056fc JGit v4.9.7.201810191756-r
Change-Id: Ib980731eb9ec7f4c92deac9b4cf2f7a994d670c2
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-10-19 23:58:47 +02:00
Matthias Sohn 97b62cf9dd Update API problem filter
Change-Id: Iba8650900d3936edccbe30de9d3eafd4f9e0dba6
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-10-19 23:54:38 +02:00
Matthias Sohn cee3ef1a0e Merge branch 'stable-4.8' into stable-4.9
* stable-4.8:
  Prepare 4.7.7-SNAPSHOT builds
  JGit v4.7.6.201810191618-r
  Update API problem filter
  Fix file handle leak in ObjectDownloadListener.onWritePossible
  Replace Findbugs with Spotbugs in org.eclipse.jgit/pom.xml
  Replace FindBugs with SpotBugs
  Prepare 4.4.2-SNAPSHOT builds
  JGit v4.0.3.201509231615-r

Change-Id: Ic18af2ddcba8f7a53eb27a33ea9f637adb941993
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-10-19 23:30:20 +02:00
Ivan Frade 40f5b28545 Accept protocol v2 server options on fetch and ls-refs requests
In protocol v2, a command request can be followed by server options
(lines like "agent=<>" and "server-option=<>"), but current code
doesn't accept those lines.

Advertise the "server-option" capability, parse the lines and add
them to the request objects.

Other code in JGit can see this options and act accordingly via the
protocol v2 hooks.

This should not require any change in the client side.

Change-Id: If3946390f9cc02d29644b6ca52534b6f757bda9f
Signed-off-by: Ivan Frade <ifrade@google.com>
2018-10-19 14:04:02 -07:00
Matthias Sohn 566a5dcc21 Merge branch 'stable-4.7' into stable-4.8
* stable-4.7:
  Prepare 4.7.7-SNAPSHOT builds
  JGit v4.7.6.201810191618-r
  Update API problem filter
  Fix file handle leak in ObjectDownloadListener.onWritePossible
  Replace Findbugs with Spotbugs in org.eclipse.jgit/pom.xml
  Replace FindBugs with SpotBugs
  Prepare 4.4.2-SNAPSHOT builds
  JGit v4.0.3.201509231615-r

Change-Id: I783a083c0092a400f28f7977fbc4e556af88c8de
2018-10-19 22:36:31 +02:00
Matthias Sohn d6c587faef Prepare 4.7.7-SNAPSHOT builds
Change-Id: I131e40cbbf32bc75d2ed24ca31ba3613a3bbca25
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-10-19 22:27:47 +02:00
Matthias Sohn b811e4fc51 JGit v4.7.6.201810191618-r
Change-Id: Iaee27d5e2de016240f1a0940653fef82c6044a1d
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-10-19 22:18:38 +02:00
Matthias Sohn 2674bec32b Update API problem filter
Change-Id: I66c0c490bb66adafac5d670d2d9571f1674a281e
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-10-19 22:15:39 +02:00
Ivan Frade 0691c4b94b UploadPack: Use request instead of field for client capabilities
Change-Id: Idc21e2b3fd145d2a4b15c1cea5ec1956541e3b40
Signed-off-by: Ivan Frade <ifrade@google.com>
2018-10-19 11:01:28 -07:00
David Pursehouse ffaada75e4 Merge branch 'stable-4.6' into stable-4.7
* stable-4.6:
  Prepare 4.4.2-SNAPSHOT builds
  JGit v4.0.3.201509231615-r

Change-Id: I3e1a870a225447e761368298ce9b65dbec2c2a82
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-10-19 18:43:49 +09:00
David Pursehouse 926a126f72 Merge branch 'stable-4.5' into stable-4.6
* stable-4.5:
  Prepare 4.4.2-SNAPSHOT builds
  JGit v4.0.3.201509231615-r

Change-Id: I9c925a65d42559443ade9ac8291ffe00f4a1dda1
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-10-19 18:43:09 +09:00
David Pursehouse c31108bcc5 Merge branch 'stable-4.4' into stable-4.5
* stable-4.4:
  Prepare 4.4.2-SNAPSHOT builds
  JGit v4.0.3.201509231615-r

Change-Id: Icd66a796b0cce93c75a52cc77fec8f9df3eeccb4
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-10-19 10:46:01 +09:00
David Pursehouse 0de9ca38f4 Merge branch 'stable-4.3' into stable-4.4
* stable-4.3:
  JGit v4.0.3.201509231615-r

Change-Id: I147d81a9cc9c0f9e66084897df9c88c369539db7
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-10-19 10:43:07 +09:00
David Pursehouse 2a21b330d6 Merge branch 'stable-4.2' into stable-4.3
* stable-4.2:
  JGit v4.0.3.201509231615-r

Change-Id: Ic90ef74497afee9da4b49dcb53302b4efa5b9f26
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-10-19 10:42:26 +09:00
David Pursehouse 27acb4ab25 Merge branch 'stable-4.1' into stable-4.2
* stable-4.1:
  JGit v4.0.3.201509231615-r

Change-Id: I6cc5bcefad2e8dee3394770d36608f981bfc9a9e
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-10-19 10:41:31 +09:00
David Pursehouse aebc8a41b8 Merge branch 'stable-4.0' into stable-4.1
* stable-4.0:
  JGit v4.0.3.201509231615-r

Change-Id: Ie74b0392ef145ffd27dc903c45f7fec2d4492a17
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-10-19 10:38:55 +09:00
David Pursehouse 95579e6af3 Merge branch 'stable-5.1'
* stable-5.1:
  ssh: Prefer algorithms of the known host keys

Change-Id: I4868359c9df75cb2c51331789cb9f34473801569
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-10-19 08:06:45 +09:00
Ivan Frade 7fde9ab8d2 UploadPack.FirstLine: Revert renaming of getOptions into getCapabilities
This is public facing, stable API.

Fortunately, this class is deprecated and will be removed in the next
major version bump.

Change-Id: I91193964732e9d1943e9dc613256196e9c9d1274
Signed-off-by: Ivan Frade <ifrade@google.com>
Signed-off-by: Jonathan Nieder <jrn@google.com>
2018-10-18 15:54:46 -07:00
Saša Živkov b6e2800560 ssh: Prefer algorithms of the known host keys
JSch prefers ssh-rsa key type. When the remote server supports ssh-rsa
key type then this key type will be used even if the known_hosts file
contains a host key for that host, but with different key type.
This caused an unexpected UnknownHostKey error.

To fix the issue first scan the known_hosts, the HostKeyRepository in
JSch API, for any already existing host keys for the target host and
modify the default session settings to prefer their algorithms. However,
do this only if there is no HostKeyAlgorithms setting active.

Change-Id: I236df2a860ddd9289a0a820ddf09c2dea3673d36
2018-10-18 11:59:16 +02:00
Michael Keppler 91021cb66f Configure classpath for separate test sources in Eclipse
Eclipse Photon supports separating sources and test sources.

There are no functional changes in the IDE, except for test source
folders having a different icon color.

Users of different IDEs than Eclipse are not affected, since the
attribute on the classpath entries will be ignored by their IDE.

Bug: 539933
Change-Id: Iac6dcdf0c0730ca775bae90df6a685303dc95380
Signed-off-by: Michael Keppler <Michael.Keppler@gmx.de>
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-10-17 11:08:24 +09:00
David Pursehouse 7ebd434e91 Disable Eclipse warning about unrecognized @SuppressWarnings value
The code base has several @SuppressWarnings annotations to suppress
warnings raised by Error Prone, but those are not recognized by
Eclipse and there is currently no way to tell it about them [1].

Suppress them for now.

[1] https://bugs.eclipse.org/bugs/show_bug.cgi?id=392045

Change-Id: I3de7cfa8ad4370ca5be71e1303879c73ab6829c1
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-10-17 10:40:36 +09:00
David Pursehouse abefc00ac5 UnionInputStreamTest: Suppress ErrorProne warning about missing synchronized
Error Prone reports that the unsynchronized method skip overrides the
synchronized method in ByteArrayInputStream [1].

This is a test class, so we can just suppress the warning as recommended
in [1].

Note that the suppression causes a warning in Eclipse, because it doesn't
recognize the "UnsynchronizedOverridesSynchronized" as a valid value for
the @SuppressWarnings annotation [2].

[1] https://errorprone.info/bugpattern/UnsynchronizedOverridesSynchronized
[2] https://bugs.eclipse.org/bugs/show_bug.cgi?id=392045

Change-Id: I3e798b448211f1363729091f72fb0ef6a873e599
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-10-17 10:29:33 +09:00
David Pursehouse 9bfd31fd44 Merge "Upgrade spotbugs to 3.1.7" 2018-10-16 19:34:04 -04:00
Ivan Frade 13b3881b3e UploadPack: Use request instead of field for clientShallowCommits
Yet another member to field transition.

Change-Id: Ic801f4ac3a270b287591ef3cf722c399126ccdd4
Signed-off-by: Ivan Frade <ifrade@google.com>
2018-10-16 16:13:04 -07:00
Ivan Frade 9694d89ea1 UploadPack: Use request instead of field for depth
One more step in removing state from UploadPack, using the request
object instead.

Unfortunately, hooks get from UploadPack information about the current
request. Changing the hooks to receive the request is a public API
change, so at the moment lets keep a reference to the current request.

This kills half the benefit of using a request object vs fields, but
at least we still get better modularity.

Change-Id: I86803d876a621b727c66ee73f2880c93190629e9
Signed-off-by: Ivan Frade <ifrade@google.com>
2018-10-16 16:13:04 -07:00
Ivan Frade 81a752bef7 UploadPack: Use request instead of field for shallowSince
Change-Id: I1b9fdb6c58c574f66dbd152c1049ddcd52cc1683
Signed-off-by: Ivan Frade <ifrade@google.com>
2018-10-16 16:13:04 -07:00
Ivan Frade 3c974d0251 UploadPack: Use request in computeShallowUnshallow
All data required in this function is available in the request object.
Use that object instead of class members. This reduces class state and
is more readable.

Make the function use a request object and remove the now unnecessary
field "deepenNotRefs".

Change-Id: If861e44c2860a78cf19f456d1b3feb7ddc314cce
Signed-off-by: Ivan Frade <ifrade@google.com>
2018-10-16 16:13:04 -07:00
Ivan Frade b41d7624b8 Move deepenSince and deepenNotRefs up to FetchRequest
These properties are protocol v2 specific, but they have clear default
no-op values and having them in the common superclass simplifies client
code.

Move properties deepenSince and deepenNotRefs up to FetchRequest. In
FetchV0Request, they are initialized with their no-op values (0 for
deepenSince and empty list for deepenNotRefs)

Change-Id: I9d46a6dfbe29ebd794b5a6482033cdc70d411a23
Signed-off-by: Ivan Frade <ifrade@google.com>
2018-10-16 16:12:59 -07:00
Ivan Frade 2bedc6e08b UploadPack: Use request instead of field for filterBlobLimt
filterBlobLimit is not part of the UploadPack state, and as field
of the class is difficult to see where it is set or accessed.

Use the request object instead of a field. This reduces
UploadPack state and makes clearer how the value is used.

Change-Id: I96a04a5a8b31bf2243de701e1fd7ebb4080b49e2
Signed-off-by: Ivan Frade <ifrade@google.com>
2018-10-16 11:17:42 -07:00
Ivan Frade ec838fee0c Mark fetch requests fields as final and @NonNull when possible
Mark reference fields as final, annotate constructor parameters and
getters as @NonNull when appropiate and assert the incoming references
are non-null.

Change-Id: I0ef9a513a99313bf461fe9629ce6cc8b409bdedb
Signed-off-by: Ivan Frade <ifrade@google.com>
2018-10-16 11:11:26 -07:00
David Pursehouse f894066f6c Upgrade spotbugs to 3.1.7
Change-Id: I2bfeccafe01cf249ac536ded16be734e28cf4ff0
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-10-16 18:38:34 +09:00
Ivan Frade 1a0b48fecd Create FetchRequest superclass with common elements
Some code apply to both, v1 and v2 requests, so it should receive
just a request instance.

Move all common fields to an abstract superclass that can be passed
to "version neutral" functions.

Change-Id: I47c22fb12065bc93767f78175e2b36cc43ccb5c5
Signed-off-by: Ivan Frade <ifrade@google.com>
2018-10-15 16:37:22 -07:00
Ivan Frade 8460ab8e87 Rename Fetch V2 request wantsIds and options
In FetchV0Request, the fields "wantsIds" and "options" are called
"wantIds" and "clientCapabilities". Those names describe them better.

Rename FetchV2Request fields to follow fetch v0. This will make easier
to extract a superclass later.

Take also the chance to polish the javadoc.

Change-Id: Ia17dbbab8084f39cc529fef9ca5c65e189073767
Signed-off-by: Ivan Frade <ifrade@google.com>
2018-10-15 16:27:58 -07:00
Ivan Frade 7d7b8dec56 Move protocol v0/v1 parsing to its own class and request objects
Protocol v0/v1 parsing code doesn't have any real dependency on UploadPack.

Move it to its class and use a request object to read the data in
UploadPack.

This makes the code easier to test, keeps similar structure than protocol v2,
reduces the line count of UploadPack and paves the way to remove the
members as implicit parameters in it.

Change-Id: I8188da8bd77e90230a7e37c02d800ea18463694f
Signed-off-by: Ivan Frade <ifrade@google.com>
2018-10-15 16:27:55 -07:00
Han-Wen Nienhuys 8a5b044a99 InternalPushConnection: don't swallow RuntimeException
Uncaught exceptions are handled by java.lang.Thread's handler, which
prints it to stderr.

This is useful because InternalPushConnection is used in tests, and
during development, the server side may have programming errors that
manifest as RuntimeExceptions.

Before this change, all types of failures would lead to a uniform
failure message "test://test/conn0: push not permitted" on the client.

Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Change-Id: I0983cbeb86d36fa7a9313373f5fce54971f804ec
2018-10-15 16:45:19 +02:00
Matthias Sohn 89388d67f8 Fix file handle leak in ObjectDownloadListener.onWritePossible
5c134f4d removed closing the input stream when we reached end of the
stream. This caused file handle leaks.

Bug: 540049
Change-Id: I48082b537077c7471fc160f59aa04deb99687d9b
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-10-13 19:46:38 -04:00
David Pursehouse 33744a2dfe Merge branch 'stable-4.6' into stable-4.7
* stable-4.6:
  Replace Findbugs with Spotbugs in org.eclipse.jgit/pom.xml
  Replace FindBugs with SpotBugs

Change-Id: I24417e4ebbba31f7ff6896d585ef807327411392
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-10-13 09:18:03 +09:00
David Pursehouse 27f7a590d1 Merge branch 'stable-4.5' into stable-4.6
* stable-4.5:
  Replace Findbugs with Spotbugs in org.eclipse.jgit/pom.xml
  Replace FindBugs with SpotBugs

Change-Id: I1c077e8f3530ac717b1603d3307fd15d4335b8fe
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-10-13 09:16:55 +09:00
David Pursehouse 2db49bc679 Replace Findbugs with Spotbugs in org.eclipse.jgit/pom.xml
Change-Id: If9cb0de7a0e7bd95eac7daeee140a18385192a48
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-10-13 09:14:57 +09:00
David Pursehouse 07bff0ef3e Merge "Upgrade maven-surefire plugins to 2.22.1" 2018-10-12 20:08:58 -04:00
Ivan Frade e82cb5a6d3 FirstWant: tighten first-want line validation
First-want line parsing accepts lines with an optional whitespace, when
the spec is strict requiring a white space.

Validate the line enforcing that there is a white space between oid and
capabilities list.

Change-Id: I45ada67030e0720f9b402c298be18c7518c799b1
Signed-off-by: Ivan Frade <ifrade@google.com>
2018-10-12 15:41:00 -07:00
Jonathan Nieder 208a3fc8e1 Merge "Move first line parsing for v0/v1 pack negotiation out of UploadPack" 2018-10-12 17:23:32 -04:00
Ivan Frade 6aca8899a5 Move first line parsing for v0/v1 pack negotiation out of UploadPack
In protocol v0/v1 pack negotiation, the first want line contains the
options the client wants in effect. This parsing is done in UploadPack
but it doesn't have any interaction with that class.

Move the code to its own class and package, mark the current one
as deprecated (it is public API) and add unit tests.

Take the chance to move the parsing code from the constructor to a
factory method, making the class a simple container of results.

Change-Id: I1757f535dda78a4111a1c12c3a3b455a4b6f0c51
Signed-off-by: Ivan Frade <ifrade@google.com>
2018-10-12 13:59:06 -07:00
David Pursehouse f5961cc5d9 Upgrade maven-surefire plugins to 2.22.1
Change-Id: Ic53997223de82b8e0c4df96624889ffb9715822a
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-10-12 18:55:38 +09:00
David Pursehouse 4da3b9368b Upgrade error_prone_core to 2.3.2
Change-Id: Icd9b08ad0c922e3e0a436f2a0a7fd60019ee22ae
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-10-11 19:38:29 +09:00