Commit Graph

6525 Commits

Author SHA1 Message Date
Matthias Sohn 12d840dfcb JGit v5.2.0.201811281532-m3
Change-Id: I79988b473d67e565d8f6bcac40ee9a14b26c9e60
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-11-28 21:35:26 +01:00
Matthias Sohn ae805bd717 Update Apache commons compress to 1.18.0
to consume fix for vulnerability [1] in Apache commons compress which is
fixed in version 1.18.

[1] https://nvd.nist.gov/vuln/detail/CVE-2018-1324

CQ: 18320
Change-Id: I39b1d815e5b8e0208600afafe7a72bb603d04fb8
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-11-28 20:18:04 +01:00
Matthias Sohn 2532fa74c2 Fix running tests from bazel
The new dependency to mockito for JDKHttpConnectionTest wasn't added for
bazel test run.

Change-Id: Ie967b7152340a0b3e05cced7eadfd40af78d9995
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-11-28 20:18:04 +01:00
Matthias Sohn 4b3c87f639 Update Orbit to I20181128011035
to consume fix for vulnerability [1] in Apache commons compress which is
fixed in version 1.18.

[1] CVE-2018-1324

CQ: 18320
Change-Id: I01e435fda834bbb22892a1cfba411d0196d7de17
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-11-28 16:43:44 +01:00
Matthias Sohn 065aab5131 Update bcprov-jdk15on used in tests to 1.59
CQ: 15889
Change-Id: I04c9099941dd1929cd9075ad6c89660a63e7de8f
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-11-28 09:54:06 -05:00
Christian Halstrick 158294f912 Merge "Fix IndexDiffs for git links" 2018-11-28 06:11:05 -05:00
David Pursehouse c5306b84ae Merge branch 'stable-5.1'
* stable-5.1:
  Fix DescribeCommand with multiple match options
  Fix git-describe tie-breakers

Change-Id: I64d9b0099fc0d8449ec08f0b5653572b5c2f840f
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-11-27 20:01:45 +09:00
David Pursehouse 9372cf496f Merge branch 'stable-5.0' into stable-5.1
* stable-5.0:
  Fix DescribeCommand with multiple match options
  Fix git-describe tie-breakers

Change-Id: I63e7a56bb617b5ce8774e1dc7f5efdde25e7cd97
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-11-27 20:01:11 +09:00
David Pursehouse 28f0ef8509 Merge branch 'stable-4.11' into stable-5.0
* stable-4.11:
  Fix DescribeCommand with multiple match options
  Fix git-describe tie-breakers

Change-Id: Ibb98f143ee0ce7635beb30ec404b4134a73788f6
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-11-27 19:51:01 +09:00
Matthias Sohn 7c798905ed Remove unused externalized text "submodulesNotSupported"
This text is unused since d72b9328.

Change-Id: I82e5652e205d7b238ff8adc21994029b828b09f4
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-11-27 03:48:09 -05:00
Thomas Wolf 4678f4b735 Fix IndexDiffs for git links
After cloning a repo with a submodule, non-recursively, JGit would
encounter in its TreeWalk in IndexDiff:

* first, a missing gitlink (in index & HEAD, not in working tree)
* second, the untracked folder (not in index and head, in working tree)

As a result, it would report the submodule as missing. Canonical git
reports a clean workspace.

The root cause of this is that the path of a gitlink "x" did
not compare equal to the path of a tree "x" in JGit.

Correct Paths.compare() to account for that. If two paths are otherwise
equal, then let gitlinks match both trees and files. Matching trees
solves the bug. Matching files is necessary to handle the case where
the gitlink directory was replaced by a file; see the new test case
IndexDiffSubmoduleTest.testSubmoduleReplacedByFile(). Comparisons of
unequal paths are left untouched, so the sort order is unchanged.

After the fix, another bug(?) in WorkingTreeIterator became apparent:
with core.dirNoGitLinks = true, it was no longer possible to overwrite
a gitlink in the index. This is now fixed in WorkingTreeIterator.

Add new test cases for the bug itself and for some related cases
(submodule directory deleted or replaced by a file) in
IndexDiffSubmoduleTest. Add a test for missing files in IndexDiffTest,
and adapt the PathsTest to test matching gitlinks.

Bug: 467631
Change-Id: I0549d10d46b1858e5eec3cc15095aa9f1d5f5280
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2018-11-26 20:53:42 +01:00
Matthias Sohn df6263644b Fix DescribeCommand with multiple match options
when multiple match options are given in git describe the result must
not depend on the order of the match options. JGit wrongly picked the
first match using the match options in the order they were defined. Fix
this by concatenating the streams of matching tags for all match options
and then choosing the first match on the concatenated stream sorted in
tie break order.

See https://git-scm.com/docs/git-describe#git-describe---matchltpatterngt

Change-Id: Id01433d35fa16fb4c30526605bee041ac1d954b2
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-11-26 18:49:30 +01:00
Matthias Sohn 3f745e40a1 Add a method to get all values of HTTP header defined as list
According to RFC 2616 [1] header field names are case insensitive.
Header fields defined as a comma separated list can have multiple header
fields with the same field name. Add a method to HttpConnection which
retrieves all values with a given header field name with the field name
compared case insensitive.

[1] https://tools.ietf.org/html/rfc2616#section-4.2"

Change-Id: I7f601b21cda99e84f43f866c7c7cb4cb0e3cf5c3
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-11-26 03:07:58 -05:00
Thomas Wolf f974c9c790 Undo treating blobs with NULs as a single line
This partially reverts commit a551b646: revert the changes in
RawParseUtils.lineMap(). Forcing all blobs containing a NUL byte
as a single line causes blame to produce useless results as soon
as it hits any version containing a NUL byte.

Doing binary detection at this level also has the problem that the
user cannot control it. Not by setting the text attribute nor in any
other way.

This came up in bug 541036, where a Java source inadvertently
contained NUL bytes in strings. Even fixing this by using escapes
"\000" will not fix JGit's blame for this file because the past
versions will still contain the NUL byte.

Native git can blame that file from bug 541036 fine.

Added new tests verifying that blaming a text file containing a NUL
byte produces sensible results.

Bug: 541036
Change-Id: I8991bec88e9827cc096868c6026ea1890b6d0d32
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2018-11-26 00:30:21 +01:00
Matthias Sohn 6f68ed2ed3 Update Ant to 1.10.5
CQ: 18322
Change-Id: I88982116e02598b0ac658c4d740d7a7c1e37280a
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-11-22 01:15:31 +01:00
Matthias Sohn ae8533f1c4 Update Orbit to S20181120221132 for 2018-12
Change-Id: Ice169d000e4757732e847ba5e2ea5e59945a09e8
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-11-22 00:21:18 +01:00
Matthias Sohn bcce65eea9 Update mockito to 2.13.0
Update mockito and its dependencies to latest version available in
Orbit:
- mockito 2.13.0.v20180426-1843
- net.bytebuddy.byte-buddy 1.7.9.v20180420-1519
- net.bytebuddy.byte-buddy-agent 1.7.9.v20180420-1519
- org.objenesis 2.6.0.v20180420-1519

CQ: 18301
CQ: 18303
CQ: 18319
Change-Id: I3dd01e5b0b5a023fcb6530e8ec76729cfc41d735
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-11-22 00:01:55 +01:00
Jonathan Nieder 647cc8f604 Remove unnecessary modifiers from interfaces
This continues what commit d9ac7ddf10
(Remove unnecessary modifiers from interfaces, 2018-11-15) started.

Change-Id: I89720985a5a986722a0dcb9b5e9bbc25996bd5b3
2018-11-20 16:18:44 -08:00
Gunnar Wagenknecht e751c878b0 New GpgConfig for typed access to GPG settings
Change-Id: Ifece38132e0390931d33b5678bbbd4a43f9099da
Signed-off-by: Gunnar Wagenknecht <gunnar@wagenknecht.org>
2018-11-20 19:35:50 +01:00
Masaya Suzuki 49befd84d7 Revert C Git 1.7.5 bug workaround
This reverts the workaround introduced by
1c6c73c5a9, which is a patch for dealing
with a buggy C Git client v1.7.5 in 2012. We'll stop supporting very old
C Git clients.

Change-Id: I94999a39101c96f210b5eca3c2f620c15eb1ac1b
Signed-off-by: Masaya Suzuki <masayasuzuki@google.com>
2018-11-19 13:37:28 -08:00
Thomas Wolf c567b6ecde Apache MINA sshd client: don't leak HostConfigEntry
ProxyDataFactory had a parameter of type HostConfigEntry, but actually
it wasn't used anywhere. Remove it -- it was the last leaked type from
Apache MINA sshd.

Also use the logger provided by upstream SshClient instead of creating
a new Logger.

Bug: 520927
Change-Id: Iaa78bbb998a5e574fa091664b75c48a3b9cfb897
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2018-11-17 18:55:06 +01:00
Thomas Wolf 00b235f0b8 Apache MINA sshd client: test & fix password authentication
Add tests for password and keyboard-interactive authentication.
Implement password authentication; the default provided by sshd
is non-interactive, which is not useful for JGit.

Make sure the CredentialsProvider gets reset on successive password
retrieval attempts. Otherwise it might always return the same non-
accepted password from a secure storage. (That one was discovered
by actually trying this via EGit; the JGit tests don't catch this.)

Change the default order of authentication mechanisms to prefer
password over keyboard-interactive. This is a mitigation for upstream
bug SSHD-866.[1]

Also include a fix for upstream bug SSHD-867.[2]

[1] https://issues.apache.org/jira/projects/SSHD/issues/SSHD-866
[2] https://issues.apache.org/jira/projects/SSHD/issues/SSHD-867

Bug: 520927
Change-Id: I423e548f06d3b51531016cf08938c8bd7acaa2a9
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2018-11-17 07:28:08 -08:00
Thomas Wolf 1316d43e51 Move SshTestGitServer to new bundle org.eclipse.jgit.junit.ssh
Create the bundle and move the SshTestGitServer there. Verified that
the Eclipse build still works and ran JSchSshTest and ApacheSshTest as
junit tests inside Eclipse.

Update maven build and features to account for that. Verified by
running full maven build including packaging.

Update bazel build files to account for that. Verified by a
clean-slate bazel build :all, followed by running the JSchSshTest
and the ApacheSshTest via bazel.

Change-Id: Ia084942f4425b454529de148e00417e7da786a90
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2018-11-17 07:28:08 -08:00
Thomas Wolf 6c14d273fa Apache MINA sshd client: proxy support
This is not about the ssh config ProxyCommand but about programmatic
support for HTTP and SOCKS5 proxies. Eclipse allows the user to
specify such proxies, and JSch at least contains code to connect
through proxies. So our Apache MINA sshd client also should be able
to do this.

Add interfaces and provide two implementations for HTTP and SOCKS5
proxies. Adapt the core code to be able to deal with proxy connections
at all. The built-in client-side support for this in sshd 2.0.0 is
woefully inadequate.

Tested manually by running proxies and then fetching various real-
world repositories via these proxies from different servers. Proxies
tested: ssh -D (SOCKS, anonymous), tinyproxy (HTTP, anonymous), and
3proxy (SOCKS & HTTP, username-password authentication). The GSS-API
authentication is untested since I have no Kerberos setup.

Bug: 520927
Change-Id: I1a5c34687d439b3ef8373c5d58e24004f93e63ae
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2018-11-17 07:28:06 -08:00
Thomas Wolf 7aaeb6489f Apache MINA sshd client: don't leak upstream classes and interfaces
We will get an API evolution problem if we expose as API classes and
interfaces that derive from upstream classes or interfaces. Upstream
interfaces also evolve quite erratically and evolution doesn't seem
to follow semantic versioning.

Introduce a new KeyPasswordProvider interface so that we don't have
to depend on the upstream FilePasswordProvider in our API. (We do
need _some_ abstraction for getting passwords for encrypted keys in
the API; EGit will need to provide its own implementation.)

Move some other upstream dependencies (HostConfigEntry, and various
previously protected methods in SshdSessionFactory) out of the API:
classes moved to internal space, and methods made private.

The only dependencies on upstream interfaces are thus in a few method
parameter types. Those cannot be avoided, but should also not pose
problems.

Bug: 520927
Change-Id: Idc9c6b0f237f29f46343c0fe15179242f2007bec
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2018-11-16 15:56:31 -08:00
Ivan Frade d9ac7ddf10 Remove unnecessary modifiers from interfaces
From Oracle's "Defining an interface":

"All abstract, default, and static methods in an interface are
implicitly public, so you can omit the public modifier."

(Without any modifier, the interface methods are also abstract, so we
omit also the "abstract")

"In addition, an interface can contain constant declarations. All
constant values defined in an interface are implicitly public, static,
and final. Once again, you can omit these modifiers."

This makes the code more consistent. Now all interfaces under
org.eclipse.jgit follow the guidelines.

Change-Id: I4fe6deb111899ec1b4318ab5a6050f3851fa1fd3
Signed-off-by: Ivan Frade <ifrade@google.com>
2018-11-15 22:36:43 -08:00
David Pursehouse c56afbf18c Merge "Call unlockPack in finally" 2018-11-14 22:11:26 -05:00
David Pursehouse 32a7c9622e Format org.eclipse.jgit.pgm/BUILD with buildifier
Change-Id: I08de1e262c56ffdd9f4bc9b58f7b43964cce969a
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-11-14 08:06:45 -08:00
Thomas Wolf a151190bef Add --ssh option to command-line commands
Enables using the new ssh client based on Apache MINA sshd instead
of the old JSch client. The default is still JSch, so unless the
command is invoked with --ssh apache, there's no change.

I prefer this over some fiddling with the GIT_SSH environment variable
since that variable is handled in the JGit core bundle, which should
remain free of any dependency to org.eclipse.jgit.ssh.apache to avoid
problems in Gerrit or other JGit users that may use a different Apache
MINA sshd version.

Bug: 520927
Change-Id: I8460759c7113ef7887520fb0d297aa312200c69f
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2018-11-14 04:47:33 -08:00
Thomas Wolf c56fa51709 Apache MINA sshd: use NumberOfPasswordPrompts for encrypted keys
sshd only asks exactly once for the password. C.f. upstream issue
SSHD-850.[1] So we have to work around this limitation for now.
Once we move to sshd > 2.1.0, this can be simplified somewhat.

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

Bug: 520927
Change-Id: Id65650228486c5ed30affa9c62eac982e01ae207
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2018-11-14 04:47:33 -08:00
David Pursehouse c949da0d5f Merge "Format BUILD files with buildifier" 2018-11-14 00:27:01 -05:00
David Pursehouse f4c0189f25 Format BUILD files with buildifier
Change-Id: I7eb83e0560b1826c4f8567e9bc5fbdb2ae3fe9d0
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-11-13 18:33:41 -08:00
Thomas Wolf ec1116627f Apache MINA sshd client: properly handle HostKeyAlgorithms config
By default sshd will use its default built-in list, which matches
the one of openssh (as far as the algorithms exist in sshd at all).
But it doesn't handle HostKeyAlgorithms from the ssh config at all.

Implement this as in openssh, including the '+' and '-' modifiers
and reordering the default if there are known host keys for a
server already.

Add tests for the reordering.

Also use a more robust reader for the known hosts file. The default
aborts on the first error.

Bug: 520927
Change-Id: Ib1684440bfe2e96140536aa1a93c4bd4a0d35916
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2018-11-13 10:49:26 -08:00
Thomas Wolf 63a87b398f 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>
2018-11-13 10:49:26 -08:00
Thomas Wolf 8001f4c1fe 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>
2018-11-13 10:49:26 -08:00
Thomas Wolf 06387d4bfd 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>
2018-11-13 10:49:26 -08:00
Thomas Wolf 9b31969f3c Add features for the Apache MINA sshd implementation
Bug: 520927
Change-Id: Ida3e218e0552848ef6285de1dc1e41866f7f873e
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2018-11-13 10:49:26 -08:00
Thomas Wolf 488d95571f 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>
2018-11-13 10:49:26 -08:00
Thomas Wolf 0173b25415 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>
2018-11-13 10:49:26 -08:00
Thomas Wolf 705691ee51 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>
2018-11-13 10:46:00 -08:00
David Pursehouse a630b45e50 Upgrade maven-shade-plugin to 3.2.1
Change-Id: I4f194008bb02ab58eba6d44d1be0424c47be4d81
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-11-12 08:34:20 -08:00
Masaya Suzuki ad379793c7 Call unlockPack in finally
The lock is obtained in receivePackAndCheckConnectivity. It seems to me
the structure that requres the caller to unlock the lock is wrong, but
at least by calling in finally ensures it is called even if an exception
is thrown.

Change-Id: I123841b017baf5acffe0064d1004ef11a0a5e6c2
Signed-off-by: Masaya Suzuki <masayasuzuki@google.com>
2018-11-11 17:28:20 -08:00
Michael Keppler ddde209655 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>
2018-11-11 11:35:44 +01:00
Håvard Wall f9de917547 Fix git-describe tie-breakers
Correct behaviour as git 1.7.1.1 is to resolve tie-breakers to choose
the most recent tag.

https://github.com/git/git/blob/master/Documentation/RelNotes/1.7.1.1.txt:
* "git describe" did not tie-break tags that point at the same commit
   correctly; newer ones are preferred by paying attention to the
   tagger date now.

Bug: 538610
Change-Id: Ib0b2a301997bb7f75935baf7005473f4de952a64
Signed-off-by: Håvard Wall <haavardw@gmail.com>
2018-11-09 08:54:44 +01:00
David Pursehouse 54dd1d112a Merge changes I97c062d0,Ib4e1f37c
* changes:
  Simplify RevWalk#iterator by factoring out common code
  Simplify exception handling in RevWalk#iterator
2018-11-08 22:51:48 -05:00
Jonathan Nieder a0cd400c37 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>
2018-11-08 18:19:01 -08:00
Jonathan Nieder aeba003200 Simplify exception handling in RevWalk#iterator
MissingObjectException and IncorrectObjectTypeException are subclasses
of IOException.

Change-Id: Ib4e1f37ce1b0b08e69ba3375bbdb6ee82ee4f036
Signed-off-by: Jonathan Nieder <jrn@google.com>
2018-11-08 17:55:19 -08:00
Jonathan Tan df21eec1ad 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>
2018-11-08 15:33:23 -08:00
David Pursehouse 1385f4b3da Bazel: Increase severity of ClassCanBeStatic to ERROR
Change-Id: I8250fd15cfff6bbba54a238be31b3cf772edab3f
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-11-08 11:09:54 +09:00
David Pursehouse 58bcbf89b0 SshTestBase: Make inner class TestCredentialsProvider static
Change-Id: Id5ba87b24e8a29157d49e9e5b151d65bdbcab37a
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-11-08 11:09:26 +09:00