]> source.dussan.org Git - jgit.git/log
jgit.git
5 years agoUpgrade spotbugs-maven-plugin to 3.1.9 44/133344/2
Michael Keppler [Sun, 2 Dec 2018 07:25:09 +0000 (08:25 +0100)]
Upgrade spotbugs-maven-plugin to 3.1.9

Change-Id: Idc447dfbcd165ef0362142bd17434d304c6c7f01
Signed-off-by: Michael Keppler <Michael.Keppler@gmx.de>
5 years agoUpdate Apache commons compress to 1.18.0 04/133204/1
Matthias Sohn [Wed, 28 Nov 2018 18:26:55 +0000 (19:26 +0100)]
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>
5 years agoFix running tests from bazel 03/133203/1
Matthias Sohn [Wed, 28 Nov 2018 19:16:23 +0000 (20:16 +0100)]
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>
5 years agoUpdate Orbit to I20181128011035 88/133188/1
Matthias Sohn [Wed, 28 Nov 2018 15:43:44 +0000 (16:43 +0100)]
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>
5 years agoUpdate bcprov-jdk15on used in tests to 1.59 55/133155/2
Matthias Sohn [Wed, 28 Nov 2018 00:51:44 +0000 (01:51 +0100)]
Update bcprov-jdk15on used in tests to 1.59

CQ: 15889
Change-Id: I04c9099941dd1929cd9075ad6c89660a63e7de8f
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoMerge "Fix IndexDiffs for git links"
Christian Halstrick [Wed, 28 Nov 2018 11:11:05 +0000 (06:11 -0500)]
Merge "Fix IndexDiffs for git links"

5 years agoMerge branch 'stable-5.1' 16/133116/1
David Pursehouse [Tue, 27 Nov 2018 11:01:40 +0000 (20:01 +0900)]
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>
5 years agoMerge branch 'stable-5.0' into stable-5.1 15/133115/1
David Pursehouse [Tue, 27 Nov 2018 11:01:06 +0000 (20:01 +0900)]
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>
5 years agoMerge branch 'stable-4.11' into stable-5.0 14/133114/1
David Pursehouse [Tue, 27 Nov 2018 10:50:54 +0000 (19:50 +0900)]
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>
5 years agoRemove unused externalized text "submodulesNotSupported" 38/133038/2
Matthias Sohn [Sun, 25 Nov 2018 21:33:22 +0000 (22:33 +0100)]
Remove unused externalized text "submodulesNotSupported"

This text is unused since d72b9328.

Change-Id: I82e5652e205d7b238ff8adc21994029b828b09f4
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoFix IndexDiffs for git links 57/128057/3
Thomas Wolf [Fri, 24 Aug 2018 23:58:09 +0000 (01:58 +0200)]
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>
5 years agoFix DescribeCommand with multiple match options 39/133039/2
Matthias Sohn [Sun, 25 Nov 2018 22:15:11 +0000 (23:15 +0100)]
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>
5 years agoAdd a method to get all values of HTTP header defined as list 22/132722/9
Matthias Sohn [Tue, 20 Nov 2018 00:00:30 +0000 (16:00 -0800)]
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>
5 years agoUndo treating blobs with NULs as a single line 45/132745/4
Thomas Wolf [Tue, 20 Nov 2018 11:24:38 +0000 (12:24 +0100)]
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>
5 years agoUpdate Ant to 1.10.5 70/132870/1
Matthias Sohn [Thu, 22 Nov 2018 00:15:31 +0000 (01:15 +0100)]
Update Ant to 1.10.5

CQ: 18322
Change-Id: I88982116e02598b0ac658c4d740d7a7c1e37280a
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoUpdate Orbit to S20181120221132 for 2018-12 68/132868/1
Matthias Sohn [Wed, 21 Nov 2018 23:21:18 +0000 (00:21 +0100)]
Update Orbit to S20181120221132 for 2018-12

Change-Id: Ice169d000e4757732e847ba5e2ea5e59945a09e8
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoUpdate mockito to 2.13.0 34/132834/2
Matthias Sohn [Wed, 21 Nov 2018 14:14:35 +0000 (15:14 +0100)]
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>
5 years agoRemove unnecessary modifiers from interfaces 05/132805/1
Jonathan Nieder [Wed, 21 Nov 2018 00:18:44 +0000 (16:18 -0800)]
Remove unnecessary modifiers from interfaces

This continues what commit d9ac7ddf1026123fee6c4477d172d614522dfc08
(Remove unnecessary modifiers from interfaces, 2018-11-15) started.

Change-Id: I89720985a5a986722a0dcb9b5e9bbc25996bd5b3

5 years agoNew GpgConfig for typed access to GPG settings 42/131642/5
Gunnar Wagenknecht [Tue, 30 Oct 2018 12:44:24 +0000 (13:44 +0100)]
New GpgConfig for typed access to GPG settings

Change-Id: Ifece38132e0390931d33b5678bbbd4a43f9099da
Signed-off-by: Gunnar Wagenknecht <gunnar@wagenknecht.org>
5 years agoRevert C Git 1.7.5 bug workaround 56/132256/9
Masaya Suzuki [Sun, 11 Nov 2018 20:31:22 +0000 (12:31 -0800)]
Revert C Git 1.7.5 bug workaround

This reverts the workaround introduced by
1c6c73c5a9b8dd700be45d658f165a464265dba7, 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>
5 years agoApache MINA sshd client: don't leak HostConfigEntry 15/132615/2
Thomas Wolf [Sat, 17 Nov 2018 17:44:27 +0000 (18:44 +0100)]
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>
5 years agoApache MINA sshd client: test & fix password authentication 81/132581/3
Thomas Wolf [Fri, 16 Nov 2018 16:00:25 +0000 (17:00 +0100)]
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>
5 years agoMove SshTestGitServer to new bundle org.eclipse.jgit.junit.ssh 81/132181/11
Thomas Wolf [Thu, 8 Nov 2018 15:58:52 +0000 (16:58 +0100)]
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>
5 years agoApache MINA sshd client: proxy support 92/131892/17
Thomas Wolf [Sun, 21 Oct 2018 17:44:34 +0000 (19:44 +0200)]
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>
5 years agoApache MINA sshd client: don't leak upstream classes and interfaces 00/132500/3
Thomas Wolf [Thu, 15 Nov 2018 15:33:04 +0000 (16:33 +0100)]
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>
5 years agoRemove unnecessary modifiers from interfaces 33/132533/1
Ivan Frade [Fri, 16 Nov 2018 05:27:20 +0000 (21:27 -0800)]
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>
5 years agoMerge "Call unlockPack in finally"
David Pursehouse [Thu, 15 Nov 2018 03:11:26 +0000 (22:11 -0500)]
Merge "Call unlockPack in finally"

5 years agoFormat org.eclipse.jgit.pgm/BUILD with buildifier 37/132437/1
David Pursehouse [Wed, 14 Nov 2018 16:06:45 +0000 (08:06 -0800)]
Format org.eclipse.jgit.pgm/BUILD with buildifier

Change-Id: I08de1e262c56ffdd9f4bc9b58f7b43964cce969a
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
5 years agoAdd --ssh option to command-line commands 91/131891/10
Thomas Wolf [Thu, 18 Oct 2018 21:34:04 +0000 (23:34 +0200)]
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>
5 years agoApache MINA sshd: use NumberOfPasswordPrompts for encrypted keys 90/131890/10
Thomas Wolf [Wed, 17 Oct 2018 18:22:26 +0000 (20:22 +0200)]
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>
5 years agoMerge "Format BUILD files with buildifier"
David Pursehouse [Wed, 14 Nov 2018 05:27:01 +0000 (00:27 -0500)]
Merge "Format BUILD files with buildifier"

5 years agoFormat BUILD files with buildifier 83/132383/2
David Pursehouse [Wed, 14 Nov 2018 02:01:21 +0000 (18:01 -0800)]
Format BUILD files with buildifier

Change-Id: I7eb83e0560b1826c4f8567e9bc5fbdb2ae3fe9d0
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
5 years agoApache MINA sshd client: properly handle HostKeyAlgorithms config 89/131889/9
Thomas Wolf [Fri, 5 Oct 2018 19:35:16 +0000 (21:35 +0200)]
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>
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 agoCall unlockPack in finally 55/132255/2
Masaya Suzuki [Sun, 11 Nov 2018 20:27:47 +0000 (12:27 -0800)]
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>
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 agoFix git-describe tie-breakers 43/131843/7
HÃ¥vard Wall [Wed, 17 Oct 2018 13:34:51 +0000 (15:34 +0200)]
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>
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>