]> source.dussan.org Git - jgit.git/log
jgit.git
5 years agoApache MINA sshd client: respect NumberOfPasswordPrompts 88/131888/9
Thomas Wolf [Wed, 3 Oct 2018 06:27:40 +0000 (08:27 +0200)]
Apache MINA sshd client: respect NumberOfPasswordPrompts

Set the internal property on the session as defined in the ssh config.

Note that NumberOfPasswordPrompts in openssh applies independently to
both user logins in keyboard-interactive authentication _and_ to
passphrases for identity files (encrypted keys). Apache MINA sshd uses
the setting only for keyboard-interactive authentication, but not for
identity file passphrase prompts. For identity files, it asks exactly
once. This has been reported as issue SSHD-850 upstream.[1]

[1] https://issues.apache.org/jira/browse/SSHD-850

Bug: 520927
Change-Id: I390ffe9e1c52b96d3e8e28fd8edbdc73dde9edb4
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
5 years agoApache MINA sshd client: add gssapi-with-mic authentication 87/131887/9
Thomas Wolf [Tue, 2 Oct 2018 20:39:40 +0000 (22:39 +0200)]
Apache MINA sshd client: add gssapi-with-mic authentication

sshd does support gssapi-with-mic on the server side, but has no
built-in client-side support for this authentication mechanism.

Add our own implementation for it, following RFC 4462.[1] To avoid
needlessly re-trying mechanisms that aren't even configured on the
client, we disable mechanisms that fail on the very first attempt
to use them.

Since we have no real Kerberos5 test setup, this cannot be fully
tested in CI. The disabling of the authentication mechanism and
that it is skipped when not successful _is_ tested.

[1] https://www.ietf.org/rfc/rfc4462.txt

Bug: 520927
Change-Id: I5d0cdb14103588a57c52f927df541b589ab88d88
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
5 years agoAdd ssh tests for PreferredAuthentications 86/131886/9
Thomas Wolf [Mon, 1 Oct 2018 21:27:10 +0000 (23:27 +0200)]
Add ssh tests for PreferredAuthentications

Tests that it works with unknown authentications in the list, and
fails if there are no common authentications between server and
client. The latter also tests that the ssh config setting is taken
into account at all.

And promptly the JGit sshd client didn't. Add a fix for this. It's
a tiny bit hacky: Apache MINA looks up a custom property set on a
hierarchy of "PropertyResolver"s starting with the session. On the
session itself this property can never be set since it's read
already in the session constructor before anyone had any chance
to set it. The next element in the resolver hierarchy is the sshd
SshClient, and so we set that property there. Since we use one
SshClient and one ClientSession per JGit SshdSession, this is OK.

Bug: 520927
Change-Id: I62446fc1fffde125a8965c030240f0918ae234b7
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
5 years agoAdd features for the Apache MINA sshd implementation 85/131885/9
Thomas Wolf [Thu, 1 Nov 2018 10:28:15 +0000 (11:28 +0100)]
Add features for the Apache MINA sshd implementation

Bug: 520927
Change-Id: Ida3e218e0552848ef6285de1dc1e41866f7f873e
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
5 years agoApache MINA sshd client 84/131884/9
Thomas Wolf [Sun, 23 Sep 2018 14:45:45 +0000 (16:45 +0200)]
Apache MINA sshd client

Add a new ssh client implementation based on Apach MINA sshd 2.0.0.

This implementation uses JGit's own config file parser and host entry
resolver. Code inspection of the Apache MINA implementation revealed
a few bugs or idiosyncrasies that immediately would re-introduce bugs
already fixed in the past in JGit.

Apache MINA sshd is not without quirks either, and I had to configure
and override more than I had expected. But at least it was all doable
in clean ways.

Apache MINA boasts support for Bouncy Castle, so in theory this should
open the way to using more ssh key algorithms, such as ed25519.

The implementation is in a separate bundle and is still not used in
the core org.eclipse.jgit bundle. The tests re-use the ssh tests from
the core test bundle.

Bug: 520927
Change-Id: Ib35e73c35799140fe050d1ff4fb18d0d3596580e
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
5 years agoAdd more ssh tests: pushing, known_host file handling, etc. 83/131883/8
Thomas Wolf [Sun, 23 Sep 2018 13:44:10 +0000 (15:44 +0200)]
Add more ssh tests: pushing, known_host file handling, etc.

Add support for git-receive-pack to the ssh git server and add two
new tests for pushing.

This actually uncovered an undocumented requirement in TransportSftp:
the FTP rename operation assumes POSIX semantics, i.e., that the
target is removed. This works as written only for servers that
support and advertise the "posix-rename@openssh.com" FTP extension.

Our little Apache MINA server does not advertise this extension.

Fix the FtpChannel implementation for Jsch to handle this case in a
meaningful way so that it can pass the new "push over sftp" test.

Add more tests to test the behavior of server host key checking.

Also refactor the tests generally to separate better the test
framework from the actual tests.

Bug: 520927
Change-Id: Ia4bb85e17ddacde7b36ee8c2d5d454bbfa66dfc3
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
5 years agoTransportSftp: eliminate dependency on Jsch 82/131882/8
Thomas Wolf [Mon, 17 Sep 2018 18:36:36 +0000 (20:36 +0200)]
TransportSftp: eliminate dependency on Jsch

Introduce an FtpChannel abstraction, which can be obtained from a
RemoteSession. In JSchSession, wrap a JSch ChannelSftp as such an
FtpChannel. The JSch-specific SftpException is also mapped to a
generic FtpException. Rewrite TransportSftp to use only the new
abstraction layer.

This makes it possible to provide alternate ssh/sftp implementations.

Bug: 520927
Change-Id: I379026f7d4122f34931df909a28e73c02cd8a1da
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
5 years agoUpgrade maven-shade-plugin to 3.2.1 92/132292/1
David Pursehouse [Mon, 12 Nov 2018 16:34:08 +0000 (08:34 -0800)]
Upgrade maven-shade-plugin to 3.2.1

Change-Id: I4f194008bb02ab58eba6d44d1be0424c47be4d81
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
5 years agoRemove line break from sslFailureInfo text 46/131546/3
Michael Keppler [Sun, 11 Nov 2018 10:35:44 +0000 (11:35 +0100)]
Remove line break from sslFailureInfo text

Do not add an artificial line break to the message, since it may become
much wider due to the embedded exception messages anyway.

The layout shall be controlled by the egit supplied message dialog using
layout constraints.

Bug: 540537
Change-Id: I4257b52e5e59689dfcbab47bd7c075b3fd031837
Signed-off-by: Michael Keppler <Michael.Keppler@gmx.de>
5 years agoMerge changes I97c062d0,Ib4e1f37c
David Pursehouse [Fri, 9 Nov 2018 03:51:48 +0000 (22:51 -0500)]
Merge changes I97c062d0,Ib4e1f37c

* changes:
  Simplify RevWalk#iterator by factoring out common code
  Simplify exception handling in RevWalk#iterator

5 years agoSimplify RevWalk#iterator by factoring out common code 61/132161/2
Jonathan Nieder [Fri, 9 Nov 2018 02:11:57 +0000 (18:11 -0800)]
Simplify RevWalk#iterator by factoring out common code

Factor out a helper that calls next() and tunnels IOException in a
RuntimeException, similar to TunnelException.tunnel(RevWalk::next) in
Guava terms[1].

This should make the code a little more readable.  No functional
change intended.

[1] https://github.com/google/guava/issues/2828#issuecomment-304187823

Change-Id: I97c062d03a17663d5c40895fd3d2c6a7306d4f39
Signed-off-by: Jonathan Nieder <jrn@google.com>
5 years agoSimplify exception handling in RevWalk#iterator 60/132160/1
Jonathan Nieder [Fri, 9 Nov 2018 01:55:19 +0000 (17:55 -0800)]
Simplify exception handling in RevWalk#iterator

MissingObjectException and IncorrectObjectTypeException are subclasses
of IOException.

Change-Id: Ib4e1f37ce1b0b08e69ba3375bbdb6ee82ee4f036
Signed-off-by: Jonathan Nieder <jrn@google.com>
5 years agoDepthGenerator: fix multi-child boundary handling 57/132157/1
Jonathan Tan [Thu, 8 Nov 2018 22:46:10 +0000 (14:46 -0800)]
DepthGenerator: fix multi-child boundary handling

Suppose that a repository has the following commit graph:

 B   C
  \ /
   A

and it was cloned with --shallow-exclude=A. DepthGenerator does not mark
C as shallow, causing an invalid repository to be produced on the
client, because A is not sent. (A similar issue occurs when
--shallow-since is used to exclude A but neither B nor C.)

This happens whenever an excluded commit has more than one child that is
to be sent to the client. Fix DepthGenerator to handle this case
correctly.

While we're editing DepthWalk.Commit, fix the documentation of
DepthWalk.Commit#isBoundary.

Change-Id: I7068abf0fe0c864d1b0e56e1616dad1aa8719411
Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
5 years agoBazel: Increase severity of ClassCanBeStatic to ERROR 98/132098/1
David Pursehouse [Thu, 8 Nov 2018 02:09:54 +0000 (11:09 +0900)]
Bazel: Increase severity of ClassCanBeStatic to ERROR

Change-Id: I8250fd15cfff6bbba54a238be31b3cf772edab3f
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
5 years agoSshTestBase: Make inner class TestCredentialsProvider static 97/132097/1
David Pursehouse [Thu, 8 Nov 2018 02:09:26 +0000 (11:09 +0900)]
SshTestBase: Make inner class TestCredentialsProvider static

Change-Id: Id5ba87b24e8a29157d49e9e5b151d65bdbcab37a
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
5 years agoorg.eclipse.jgit.test/BUILD: Format with buildifier 21/132021/1
David Pursehouse [Wed, 7 Nov 2018 06:56:05 +0000 (15:56 +0900)]
org.eclipse.jgit.test/BUILD: Format with buildifier

Change-Id: Ia70f2af8f8c7a85f891a1963ab146695262e7ce2
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
5 years agoBazel: Consume versions directly from lib:versions.bzl in skylib 20/132020/1
David Pursehouse [Wed, 7 Nov 2018 06:55:35 +0000 (15:55 +0900)]
Bazel: Consume versions directly from lib:versions.bzl in skylib

Avoid loading versions from @bazel_skylib//:lib.bzl, because it is now
deprecated and is going to be removed in future skylib versions:

https://github.com/bazelbuild/bazel-skylib/blob/master/lib.bzl#L17

Change-Id: Ie722351de5254f611cf3489c8689922c8346af7f
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
5 years agoFactor out a JSch-independent ssh config parser 80/131880/6
Thomas Wolf [Fri, 21 Sep 2018 20:43:34 +0000 (22:43 +0200)]
Factor out a JSch-independent ssh config parser

Move the bulk of the basic parsing and host entry handling into a
new class OpenSshConfigFile that has no dependencies on any concrete
ssh implementation. Make the existing OpenSshConfig use the new
parser.

Introduce a new class SshConstants collecting all the various ssh-
related string literals. Also use TreeMaps with a case-insensitive
key comparator instead of converting keys to uppercase. Add a test
to verify that keys are matched case-insensitively.

Most of the parsing code was simply moved, except that the new
parser supports looking up entries given host name, port, and user
name, and can thus handle more %-substitutions correctly. This
feature is not yet used and cannot be used with JSch since JSch
only has a ConfigRepository.getConfig(String) interface.

The split is still worth the trouble as it opens the way to using
another ssh client altogether. Apache MINA sshd, for instance,
resolves host entries giving host name, port, and user name.

(Apache MINA has a built-in ssh config handling, but that has
problems, too: its pattern matching is case-insensitive, and its
merging of host entries if several match is not the same as in
OpenSsh. But with this refactoring, it will be possible to plug in
OpenSshConfigFile into an Apache MINA sshd  client without dragging
along JSch.)

One test case that doesn't make sense anymore has been removed. It
tested that repeatedly querying for a host entry returned the same
object. That is no longer true since the caching has been moved to
a deeper level.

Bug: 520927
Change-Id: I6381d52b29099595e6eaf8b05c786aeeaefbf9cc
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
5 years agoSsh tests with an Apache MINA sshd test git server 79/131879/6
Thomas Wolf [Fri, 14 Sep 2018 20:40:08 +0000 (22:40 +0200)]
Ssh tests with an Apache MINA sshd test git server

Add a simple ssh git server based on Apache MINA sshd, and use it
in new tests that verify ssh operations and in particular a number
of bugs that had cropped up over time in JSch.

The git server supports fetching only, and sftp access.

The tests are all in an abstract base class; the concrete JschSshTest
class only provides ssh-specific test setup. So the same tests could
be run easily also with some other ssh client.

Bug: 520927
Change-Id: Ide6687b717fb497a29fc83f22b07390a26dfce1d
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
5 years agoBazel: Format tools/BUILD with buildifier 55/131955/1
David Pursehouse [Tue, 6 Nov 2018 04:50:04 +0000 (13:50 +0900)]
Bazel: Format tools/BUILD with buildifier

Change-Id: I292613a0e40d2022bc68c6acbd45d37a54c1e613
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
5 years agoMerge changes I91883560,I1b12a976
David Pursehouse [Mon, 5 Nov 2018 23:24:08 +0000 (18:24 -0500)]
Merge changes I91883560,I1b12a976

* changes:
  Fix package exports in org.eclipse.jgit MANIFEST.MF
  TransportSftp: remove final modifiers from parameters

5 years agoFix package exports in org.eclipse.jgit MANIFEST.MF 44/131944/1
Thomas Wolf [Mon, 5 Nov 2018 11:56:36 +0000 (12:56 +0100)]
Fix package exports in org.eclipse.jgit MANIFEST.MF

Do not export o.e.j.internal.transport.parser as public package;
restrict visibility to org.eclipse.jgit.test only.

Add two packages that were not listed at all (o.e.j.internal.revwalk
and o.e.j.internal.submodule) marked as x-internal:=true.

Change-Id: I9188356075515ad354b724102fbd6304b682de6a
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
5 years agoTransportSftp: remove final modifiers from parameters 81/131881/5
Thomas Wolf [Mon, 17 Sep 2018 18:25:01 +0000 (20:25 +0200)]
TransportSftp: remove final modifiers from parameters

Change-Id: I1b12a9765575a1368e0c6bd11d87084b2064a17e
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
5 years agoUpgrade Spotbugs to 3.1.8 25/131925/1
David Pursehouse [Mon, 5 Nov 2018 10:27:08 +0000 (19:27 +0900)]
Upgrade Spotbugs to 3.1.8

Change-Id: Ie283ab9d9925c4eae3fad2a3ad2d94bdcb80f75f
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
5 years agoBazel: Add missing test dependency on ObjectIdMatcher 10/131910/1
David Pursehouse [Mon, 5 Nov 2018 02:20:44 +0000 (11:20 +0900)]
Bazel: Add missing test dependency on ObjectIdMatcher

Test plan:

  bazel build //...

Change-Id: I28a8d3cfa54b46b95043ddd7bfdd1412c6b54865
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
5 years agoMerge changes from topic 'client-caps-v0-test'
Jonathan Nieder [Sat, 3 Nov 2018 03:44:14 +0000 (23:44 -0400)]
Merge changes from topic 'client-caps-v0-test'

* changes:
  Add test for protocol v0 parser
  ObjectIdMatcher: Custom matcher for sets of ObjectIds

5 years agoFix test setup for Eclipse Photon and greater 76/131876/1
Thomas Wolf [Thu, 1 Nov 2018 12:53:25 +0000 (13:53 +0100)]
Fix test setup for Eclipse Photon and greater

When a source folder is marked as a test folder, JDT requires that it
has an output folder different from the one used for regular sources.
Therefore give the test folders in org.eclipse.jgit.test a separate
output folder "bin-tst".

Moreover JDT reports errors if non-test classes have dependencies on
test classes. Therefore remove the "test" annotation from
org.eclipse.jgit.junit.

Change-Id: Ib527439ff5b7d7b570b8a60819ecaa70f59c63a3
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
5 years agoUpdate JGit target platforms to Orbit I20181102163257 75/131875/1
Thomas Wolf [Fri, 2 Nov 2018 17:38:23 +0000 (18:38 +0100)]
Update JGit target platforms to Orbit I20181102163257

Remove the S20181031145145 Orbit definition; that one was for our
purposes broken (mistakes in the org.apache.sshd-core and
net.i2p.crypto.eddsa receipes).

Change-Id: I8246d0837bc80165dd23780236b58fd9fe2fe0bc
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
5 years agoUpgrade to Bazel 0.19.0 87/131787/3
David Ostrovsky [Thu, 1 Nov 2018 07:37:29 +0000 (08:37 +0100)]
Upgrade to Bazel 0.19.0

Also replace native git_repository rule with Starlark rule. This is
needed because in recent Bazel versions native git_repository rule
is deprecated.

Change-Id: I2c19fd31693a930d7d35fdbb93bfa4abf21fa2aa
Signed-off-by: David Ostrovsky <david@ostrovsky.org>
5 years agoSilence API errors introduced by f648a3bd 14/131814/2
Matthias Sohn [Thu, 1 Nov 2018 19:27:37 +0000 (20:27 +0100)]
Silence API errors introduced by f648a3bd

The removed method and the new interface method only affect implementors
which is ok in a minor release following OSGi semantic versioning.

Change-Id: Ia5e55bd803965c7590c9278eecc6bdd36241383f
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoMerge "Update 2018-12 Orbit repository to S20181031145145"
David Pursehouse [Thu, 1 Nov 2018 01:45:33 +0000 (21:45 -0400)]
Merge "Update 2018-12 Orbit repository to S20181031145145"

5 years agoRepoCommand: Preserve executable bit in <copyfile> 14/131614/12
Ivan Frade [Sat, 27 Oct 2018 00:03:40 +0000 (17:03 -0700)]
RepoCommand: Preserve executable bit in <copyfile>

The copyfile entry in the manifest file copies the contents of the file
but doesn't keep the executable flag. This is inconsistent with repo
tool behaviour, plus is natural to expect that the copy of a executable
file is executable.

Transfer the executable bit when copying the file, aligning the
RepoCommand with repo tool and user expectations.

Change-Id: I01b24f482d5939e01d496f032388b3a5c02a912a
Signed-off-by: Ivan Frade <ifrade@google.com>
5 years agoRepoCommand.RemoteReader: Add method to read contents and mode of file 81/131681/10
Ivan Frade [Tue, 30 Oct 2018 18:51:49 +0000 (11:51 -0700)]
RepoCommand.RemoteReader: Add method to read contents and mode of file

The RepoCommand.RemoteReader interface doesn't offer access to the mode
of a file. Caller can only default to mark the copied objects as regular
files, losing e.g. the executable bit (if set).

Add a new method readFileWithMode that returns the contents and mode of
the remote file. It supersedes the readFile method, that is marked as
deprecated.

Now callers can set correctly the file mode of the copied file.

Change-Id: I8fce01e4bc5707434c0cbc4aebbae1b6b64756f0
Signed-off-by: Ivan Frade <ifrade@google.com>
5 years agoUpdate 2018-12 Orbit repository to S20181031145145 79/131779/1
Matthias Sohn [Wed, 31 Oct 2018 21:48:45 +0000 (22:48 +0100)]
Update 2018-12 Orbit repository to S20181031145145

Add the following new bundles needed for new ssh implementation:
- net.i2p.crypto.eddsa 0.3.0
- net.i2p.crypto.eddsa.source 0.3.0
- org.apache.sshd.core 2.0.0
- org.apache.sshd.core.source 2.0.0
- org.apache.sshd.sftp 2.0.0
- org.apache.sshd.sftp.source 2.0.0

Change-Id: I336166dd71522cc382df2e3efc00e7126d2c0874
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoRepoCommandTest: Extract method to assert file contents 80/131680/1
Ivan Frade [Tue, 30 Oct 2018 19:31:48 +0000 (12:31 -0700)]
RepoCommandTest: Extract method to assert file contents

Many tests verify the contents of files in a try-with-resources
incantation that clutters the code.

Extract that verification to an "assertContents" method, that is easier
to read.

Change-Id: If430eac6f5b9ae352e42b2d43867ceb6cd618fbb
Signed-off-by: Ivan Frade <ifrade@google.com>
5 years agoMerge changes Ice585525,I73474dea
David Pursehouse [Tue, 30 Oct 2018 03:21:07 +0000 (23:21 -0400)]
Merge changes Ice585525,I73474dea

* changes:
  Update staging target platform for eclipse platform 4.10
  New target platform for 4.9

5 years agoUpdate staging target platform for eclipse platform 4.10 22/131622/2
Matthias Sohn [Mon, 29 Oct 2018 23:23:09 +0000 (00:23 +0100)]
Update staging target platform for eclipse platform 4.10

Change-Id: Ice585525209e20e7d675f24cb751315e18eb375d
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoNew target platform for 4.9 21/131621/2
Matthias Sohn [Mon, 29 Oct 2018 23:19:11 +0000 (00:19 +0100)]
New target platform for 4.9

Change-Id: I73474deaecda4e594e5604213d3ae30c499a2ca7
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoCLIText: Fix typo: remotes's -> remote's 76/131576/1
David Pursehouse [Mon, 29 Oct 2018 08:02:41 +0000 (17:02 +0900)]
CLIText: Fix typo: remotes's -> remote's

Change-Id: I28494ffff6cd8042ef5f3de7da976d4a1569fe10
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
5 years agoCLIText: Fix typo: 'amd' -> 'and' 75/131575/1
David Pursehouse [Mon, 29 Oct 2018 07:55:38 +0000 (16:55 +0900)]
CLIText: Fix typo: 'amd' -> 'and'

Change-Id: Ifa48c35f413bd1a92946ea54c1c7adc0d53ebc78
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
5 years agoSilence API errors for new methods added to DepthWalk 73/131573/3
Matthias Sohn [Sun, 28 Oct 2018 23:40:00 +0000 (00:40 +0100)]
Silence API errors for new methods added to DepthWalk

237abe6a added method getDeepenNots() with a default implementation and
method getDeepenNotFlag() to the interface DepthWalk. This affects
implementers which is ok in minor release following OSGi semantic
versioning.

Change-Id: I1c872da261fc6825e1e310127761b8b8a6d397d4
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoRemove unused text "symlinkCannotBeWrittenAsTheLinkTarget" 58/131558/2
Matthias Sohn [Sun, 28 Oct 2018 13:35:54 +0000 (14:35 +0100)]
Remove unused text "symlinkCannotBeWrittenAsTheLinkTarget"

The only reference to this externalized text was deleted in c88d34b0.

Change-Id: Iecc7cc89192d69431dddb6550a02f66f0b09accc
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoFix typos 47/131547/2
Michael Keppler [Sat, 27 Oct 2018 19:55:39 +0000 (21:55 +0200)]
Fix typos

s/occured/occurred/
s/stablished/established/

Change-Id: Ib052bef60bd18043001a30ed43754ee1a5182016
Signed-off-by: Michael Keppler <Michael.Keppler@gmx.de>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoUpdate eclipse compiler org.eclipse.jdt:ecj to 3.15.0 52/131552/1
Matthias Sohn [Sat, 27 Oct 2018 23:50:46 +0000 (01:50 +0200)]
Update eclipse compiler org.eclipse.jdt:ecj to 3.15.0

Change-Id: Iabca86db71e166e6ce73db2f8ddc5058e58da11a
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agogitignore/gitattributes: fix matching of \r 40/117640/5
Marc Strapetz [Mon, 19 Feb 2018 10:26:09 +0000 (11:26 +0100)]
gitignore/gitattributes: fix matching of \r

Patterns should treat \r in file names as normal characters

Change-Id: Ica3e0fa4a58acf5326db46bb28571fe5f20f6cd2
Signed-off-by: Marc Strapetz <marc.strapetz@syntevo.com>
5 years agoUpgrade maven-pmd-plugin to 3.11.0 98/131498/1
David Pursehouse [Fri, 26 Oct 2018 09:47:26 +0000 (18:47 +0900)]
Upgrade maven-pmd-plugin to 3.11.0

Change-Id: I145272faa1f4cdead4706d71299ce6a0b27902cf
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
5 years agoMerge "InternalPushConnection: don't swallow RuntimeException"
Dave Borowitz [Thu, 25 Oct 2018 14:35:43 +0000 (10:35 -0400)]
Merge "InternalPushConnection: don't swallow RuntimeException"

5 years agoAdd test for protocol v0 parser 43/131343/3
Ivan Frade [Wed, 24 Oct 2018 21:53:21 +0000 (14:53 -0700)]
Add test for protocol v0 parser

ProtocolV2Parser has unit tests but protocol v0/v1 is not covered.

Change-Id: I96022e8f8eb60d4da748d1042474fd1efd67e882
Signed-off-by: Ivan Frade <ifrade@google.com>
5 years agoObjectIdMatcher: Custom matcher for sets of ObjectIds 06/129806/6
Ivan Frade [Fri, 21 Sep 2018 19:08:33 +0000 (12:08 -0700)]
ObjectIdMatcher: Custom matcher for sets of ObjectIds

Parsed requests represent object ids (SHA1) in ObjectId instances but tests
use strings for those ids because they are easier to define.

Create a custom matcher that hides the conversion from string to
ObjectId. Note that this reverses the existing code conversion (it was
transforming ObjectIds into string).

This produces more readable code, consistent with the other hamcrest
assertions.

Change-Id: I47ba1d25557d791fe74fb93c740ff7de9923cc00
Signed-off-by: Ivan Frade <ifrade@google.com>
5 years agoUploadPack: Implement deepen-not for protocol v2 61/130361/7
Jonathan Tan [Mon, 1 Oct 2018 22:50:47 +0000 (15:50 -0700)]
UploadPack: Implement deepen-not for protocol v2

This allows clients to use the --shallow-exclude parameter (producing a
"deepen-not <ref>" line when communicating with the server) in their fetch
commands when fetching against a JGit server using protocol v2.

Note that the implementation in this commit is somewhat inefficient, as
described in the TODO comment in DepthGenerator.

Change-Id: I9fad3ed9276b624d8f668356ffd99a067dc67ef7
Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
5 years agoThrow error when deepen-since excludes all commits 59/130359/4
Jonathan Tan [Tue, 2 Oct 2018 22:18:43 +0000 (15:18 -0700)]
Throw error when deepen-since excludes all commits

In C Git, when a client fetches with "git fetch --shallow-since=<date>
origin <ref>", and all commits reachable from <ref> are older than
<date>, the server dies with a message "no commits selected for shallow
requests". That is, (1) the --shallow-since filter applies to the commit
pointed to by the ref itself, and (2) there is a check that at least one
commit is not filtered out. (The pack-protocol.txt documentation does
not describe this, but the C implementation does this.)

The implementation in commit 1bb430dc21 ("UploadPack: support
deepen-since in protocol v2", 2018-09-27) does neither (1) nor (2), so
do both of these.

Change-Id: I9946327a71627626ecce34ca2d017d2add8867fc
Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
5 years agoMerge changes from topic 'moving-to-request-2'
Jonathan Nieder [Mon, 22 Oct 2018 17:49:38 +0000 (13:49 -0400)]
Merge changes from topic 'moving-to-request-2'

* changes:
  UploadPack v0: Extract "agent" client capability at parse time
  UploadPack: Return correct peer user agent on v2 requests

5 years agoUploadPack v0: Extract "agent" client capability at parse time 49/131149/12
Ivan Frade [Thu, 18 Oct 2018 17:54:14 +0000 (10:54 -0700)]
UploadPack v0: Extract "agent" client capability at parse time

The request receives a list of capabilities and takes out the "agent" to
offer it on its own setter (getAgent).

Do this at parse time: when reading the line if the capability is
"agent" set it directly in the builder.

This makes the treatment of "agent" consistent in v0/v1 and v2.

Change-Id: Ie4f9f2cad8639adeeaef4921df49a30a8ce5b42f
Signed-off-by: Ivan Frade <ifrade@google.com>
5 years agoMake PrePushHook properly terminate ref lines 90/130990/5
Markus Keller [Tue, 16 Oct 2018 14:25:56 +0000 (16:25 +0200)]
Make PrePushHook properly terminate ref lines

All of the input lines passed to pre-push hook scripts must be properly
terminated by '\n', so that normal shell scripts like the git-supplied
pre-push.sample work properly, even when pushing just a single branch.

With the old code, hook scripts that use the following pattern didn't
process the last line, because 'read' has a non-zero exit status when
EOF is encountered:
  while read local_ref local_sha remote_ref remote_sha; do ... done

Change-Id: Id899662ed3fedef6c314fc4b2ddf91a6dcb98cbb
Signed-off-by: Markus Keller <markus.kell.r@gmail.com>
5 years agoRemoteRefUpdate#toString: Fix indentation 84/131284/1
David Pursehouse [Sun, 21 Oct 2018 11:05:56 +0000 (20:05 +0900)]
RemoteRefUpdate#toString: Fix indentation

Change-Id: Ide2a7e914ab0ff50cf34ff5bc6df3219efe4ba96
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
5 years ago[releng] Fix boxing warning 54/131254/1
Michael Keppler [Sat, 20 Oct 2018 13:19:23 +0000 (15:19 +0200)]
[releng] Fix boxing warning

Use Integer.valueOf() to avoid the warning by implicit conversion due to
usage as argument object in String.format().

Change-Id: Ib314f629d54ae1ce9729c3837d66ce8982a1898a
Signed-off-by: Michael Keppler <Michael.Keppler@gmx.de>
5 years agoCheckoutCommand: force flag now allows overwrite 23/127823/9
Ned Twigg [Tue, 21 Aug 2018 21:44:28 +0000 (14:44 -0700)]
CheckoutCommand: force flag now allows overwrite

Before this commit, a force checkout would fail if there
were any conflicting files. After this commit, a force
checkout will overwrite the conflicting files, as expected.

Making this work required fixing a bug in DirCacheCheckout.
Before this commit, when DirCacheCheckout had
failOnConflict=false, it would delete all conflicting files
from the working copy and just leave them missing. After
this commit, DirCacheCheckout overwrites conflicting files
with the merge tree.

This change in DirCacheCheckout causes "reset --hard" and
"revert --abort" to behave as expected (previously they
would simply delete conflicting files, now they will be
overwritten from the merge tree).

Change-Id: If7e328ee792ef6511ab7d9c26d8d77c39210ec9f
Signed-off-by: Ned Twigg <ned.twigg@diffplug.com>
5 years agoMerge branch 'stable-5.1' 40/131240/4
David Pursehouse [Sat, 20 Oct 2018 09:04:41 +0000 (18:04 +0900)]
Merge branch 'stable-5.1'

* stable-5.1:
  Prepare 5.1.4-SNAPSHOT builds
  JGit v5.1.3.201810200350-r
  Prepare 4.11.6-SNAPSHOT builds
  JGit v4.11.5.201810191925-r
  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: Ic8b2189fdd8403294327a17cc0c1f6a6e2f78cb8
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
5 years agoPrepare 5.1.4-SNAPSHOT builds 44/131244/1
Matthias Sohn [Sat, 20 Oct 2018 08:39:16 +0000 (10:39 +0200)]
Prepare 5.1.4-SNAPSHOT builds

Change-Id: Iee86860f3b4eb9f4af818c60342fd29465c0474c
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoJGit v5.1.3.201810200350-r 43/131243/1 v5.1.3.201810200350-r
Matthias Sohn [Sat, 20 Oct 2018 07:50:16 +0000 (09:50 +0200)]
JGit v5.1.3.201810200350-r

Change-Id: Ib2c5a79d4fdf77680b7b65652fc3659527df27ad
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoMerge branch 'stable-5.0' into stable-5.1 35/131235/2
David Pursehouse [Sat, 20 Oct 2018 05:46:20 +0000 (14:46 +0900)]
Merge branch 'stable-5.0' into stable-5.1

* stable-5.0:

All commits from stable-5.0 are already in stable-5.1 due to an
accidental merge of stable-4.11 into stable-5.1 by I3ec3c9af4.

Change-Id: I8a89d103be2b2cb7657e82a124e7db41239a2447
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
5 years agoMerge "Merge branch 'stable-4.11' into stable-5.0" into stable-5.1
David Pursehouse [Sat, 20 Oct 2018 05:39:43 +0000 (01:39 -0400)]
Merge "Merge branch 'stable-4.11' into stable-5.0" into stable-5.1

5 years agoMerge branch 'stable-4.11' into stable-5.0 38/131238/1
David Pursehouse [Sat, 20 Oct 2018 05:29:12 +0000 (14:29 +0900)]
Merge branch 'stable-4.11' into stable-5.0

* stable-4.11:
  Prepare 4.11.6-SNAPSHOT builds
  JGit v4.11.5.201810191925-r
  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: Ib6493d2b6270fe4f237ea52d97848239c16c1d9d
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
5 years agoMerge branch 'stable-4.11' into stable-5.0 34/131234/1
Matthias Sohn [Sat, 20 Oct 2018 00:12:24 +0000 (02:12 +0200)]
Merge branch 'stable-4.11' into stable-5.0

* stable-4.11:
  Prepare 4.11.6-SNAPSHOT builds
  JGit v4.11.5.201810191925-r
  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: I3ec3c9af49b11979a551a9749d5a8ba5ef2ef726
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoPrepare 4.11.6-SNAPSHOT builds 31/131231/1
Matthias Sohn [Sat, 20 Oct 2018 00:08:35 +0000 (02:08 +0200)]
Prepare 4.11.6-SNAPSHOT builds

Change-Id: Ic823775aad59530f516602e7e848474d65763314
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoUploadPack: Return correct peer user agent on v2 requests 48/131148/10
Ivan Frade [Wed, 17 Oct 2018 23:52:30 +0000 (16:52 -0700)]
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>
5 years agoJGit v4.11.5.201810191925-r 30/131230/1 v4.11.5.201810191925-r
Matthias Sohn [Fri, 19 Oct 2018 23:27:52 +0000 (01:27 +0200)]
JGit v4.11.5.201810191925-r

Change-Id: I9d11536062de74775ca545c26f341610d0ddaeb2
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoMerge branch 'stable-4.10' into stable-4.11 29/131229/1
Matthias Sohn [Fri, 19 Oct 2018 23:23:17 +0000 (01:23 +0200)]
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>
5 years agoMerge branch 'stable-4.9' into stable-4.10 27/131227/1
Matthias Sohn [Fri, 19 Oct 2018 22:16:21 +0000 (00:16 +0200)]
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>
5 years agoPrepare 4.9.8-SNAPSHOT builds 26/131226/1
Matthias Sohn [Fri, 19 Oct 2018 22:10:02 +0000 (00:10 +0200)]
Prepare 4.9.8-SNAPSHOT builds

Change-Id: Iab7b0f2a21a76f801a83fbeb54f09d1525878f4d
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoJGit v4.9.7.201810191756-r 25/131225/1 v4.9.7.201810191756-r
Matthias Sohn [Fri, 19 Oct 2018 21:58:47 +0000 (23:58 +0200)]
JGit v4.9.7.201810191756-r

Change-Id: Ib980731eb9ec7f4c92deac9b4cf2f7a994d670c2
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoUpdate API problem filter 24/131224/1
Matthias Sohn [Fri, 19 Oct 2018 21:54:38 +0000 (23:54 +0200)]
Update API problem filter

Change-Id: Iba8650900d3936edccbe30de9d3eafd4f9e0dba6
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoMerge branch 'stable-4.8' into stable-4.9 23/131223/1
Matthias Sohn [Fri, 19 Oct 2018 21:30:02 +0000 (23:30 +0200)]
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>
5 years agoAccept protocol v2 server options on fetch and ls-refs requests 22/127722/18
Ivan Frade [Thu, 26 Jul 2018 22:49:09 +0000 (15:49 -0700)]
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>
5 years agoMerge branch 'stable-4.7' into stable-4.8 22/131222/1
Matthias Sohn [Fri, 19 Oct 2018 20:36:31 +0000 (22:36 +0200)]
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

5 years agoPrepare 4.7.7-SNAPSHOT builds 20/131220/1
Matthias Sohn [Fri, 19 Oct 2018 20:27:47 +0000 (22:27 +0200)]
Prepare 4.7.7-SNAPSHOT builds

Change-Id: I131e40cbbf32bc75d2ed24ca31ba3613a3bbca25
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoJGit v4.7.6.201810191618-r 19/131219/1 v4.7.6.201810191618-r
Matthias Sohn [Fri, 19 Oct 2018 20:18:38 +0000 (22:18 +0200)]
JGit v4.7.6.201810191618-r

Change-Id: Iaee27d5e2de016240f1a0940653fef82c6044a1d
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoUpdate API problem filter 18/131218/1
Matthias Sohn [Fri, 19 Oct 2018 20:15:39 +0000 (22:15 +0200)]
Update API problem filter

Change-Id: I66c0c490bb66adafac5d670d2d9571f1674a281e
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoUploadPack: Use request instead of field for client capabilities 55/129755/8
Ivan Frade [Tue, 16 Oct 2018 23:37:18 +0000 (16:37 -0700)]
UploadPack: Use request instead of field for client capabilities

Change-Id: Idc21e2b3fd145d2a4b15c1cea5ec1956541e3b40
Signed-off-by: Ivan Frade <ifrade@google.com>
5 years agoMerge branch 'stable-4.6' into stable-4.7 84/131184/1
David Pursehouse [Fri, 19 Oct 2018 09:43:43 +0000 (18:43 +0900)]
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>
5 years agoMerge branch 'stable-4.5' into stable-4.6 83/131183/1
David Pursehouse [Fri, 19 Oct 2018 09:43:03 +0000 (18:43 +0900)]
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>
6 years agoMerge branch 'stable-4.4' into stable-4.5 68/131168/2
David Pursehouse [Fri, 19 Oct 2018 01:45:49 +0000 (10:45 +0900)]
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>
6 years agoMerge branch 'stable-4.3' into stable-4.4 67/131167/1 stable-4.4
David Pursehouse [Fri, 19 Oct 2018 01:43:03 +0000 (10:43 +0900)]
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>
6 years agoMerge branch 'stable-4.2' into stable-4.3 66/131166/1 stable-4.3
David Pursehouse [Fri, 19 Oct 2018 01:42:21 +0000 (10:42 +0900)]
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>
6 years agoMerge branch 'stable-4.1' into stable-4.2 65/131165/1 stable-4.2
David Pursehouse [Fri, 19 Oct 2018 01:41:26 +0000 (10:41 +0900)]
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>
6 years agoMerge branch 'stable-4.0' into stable-4.1 64/131164/1 stable-4.1
David Pursehouse [Fri, 19 Oct 2018 01:38:48 +0000 (10:38 +0900)]
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>
6 years agoMerge branch 'stable-5.1' 63/131163/1
David Pursehouse [Thu, 18 Oct 2018 23:06:39 +0000 (08:06 +0900)]
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>
6 years agoUploadPack.FirstLine: Revert renaming of getOptions into getCapabilities 62/131162/3
Ivan Frade [Thu, 18 Oct 2018 22:16:37 +0000 (15:16 -0700)]
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>
6 years agossh: Prefer algorithms of the known host keys 02/130402/5
Saša Živkov [Thu, 4 Oct 2018 12:08:41 +0000 (14:08 +0200)]
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

6 years agoConfigure classpath for separate test sources in Eclipse 73/130673/2
Michael Keppler [Tue, 9 Oct 2018 07:15:35 +0000 (09:15 +0200)]
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>
6 years agoDisable Eclipse warning about unrecognized @SuppressWarnings value 29/131029/1
David Pursehouse [Wed, 17 Oct 2018 01:40:36 +0000 (10:40 +0900)]
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>
6 years agoUnionInputStreamTest: Suppress ErrorProne warning about missing synchronized 26/130826/3
David Pursehouse [Fri, 12 Oct 2018 02:07:48 +0000 (11:07 +0900)]
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>
6 years agoMerge "Upgrade spotbugs to 3.1.7"
David Pursehouse [Tue, 16 Oct 2018 23:34:04 +0000 (19:34 -0400)]
Merge "Upgrade spotbugs to 3.1.7"

6 years agoUploadPack: Use request instead of field for clientShallowCommits 54/129754/4
Ivan Frade [Tue, 18 Sep 2018 23:06:52 +0000 (16:06 -0700)]
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>
6 years agoUploadPack: Use request instead of field for depth 53/129753/4
Ivan Frade [Tue, 18 Sep 2018 22:52:48 +0000 (15:52 -0700)]
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>
6 years agoUploadPack: Use request instead of field for shallowSince 23/131023/3
Ivan Frade [Tue, 16 Oct 2018 21:16:35 +0000 (14:16 -0700)]
UploadPack: Use request instead of field for shallowSince

Change-Id: I1b9fdb6c58c574f66dbd152c1049ddcd52cc1683
Signed-off-by: Ivan Frade <ifrade@google.com>
6 years agoUploadPack: Use request in computeShallowUnshallow 52/129752/3
Ivan Frade [Tue, 16 Oct 2018 20:56:43 +0000 (13:56 -0700)]
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>
6 years agoMove deepenSince and deepenNotRefs up to FetchRequest 21/131021/2
Ivan Frade [Tue, 16 Oct 2018 19:51:00 +0000 (12:51 -0700)]
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>
6 years agoUploadPack: Use request instead of field for filterBlobLimt 51/129751/2
Ivan Frade [Tue, 18 Sep 2018 21:58:44 +0000 (14:58 -0700)]
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>
6 years agoMark fetch requests fields as final and @NonNull when possible 57/130957/3
Ivan Frade [Mon, 15 Oct 2018 23:49:13 +0000 (16:49 -0700)]
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>