]> source.dussan.org Git - jgit.git/log
jgit.git
5 years agoUpgrade Spotbugs to 3.1.12.2 27/146427/5
David Pursehouse [Sun, 21 Jul 2019 23:39:45 +0000 (08:39 +0900)]
Upgrade Spotbugs to 3.1.12.2

Change-Id: I4d673e058317e90b3de63f68202e580c0573f925
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
5 years agoUpgrade maven-site-plugin to 3.8.2 39/146739/4
Marco Miller [Mon, 29 Jul 2019 16:32:07 +0000 (12:32 -0400)]
Upgrade maven-site-plugin to 3.8.2

Change-Id: I79a3032e2ff7af14a41e6eb2618d2b1e22d1fde2
Signed-off-by: Marco Miller <marco.miller@ericsson.com>
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
5 years agoMerge changes from topic 'sshd'
David Pursehouse [Thu, 8 Aug 2019 01:31:57 +0000 (21:31 -0400)]
Merge changes from topic 'sshd'

* changes:
  sshd: add missing javadoc in SshTestGitServer
  sshd: shared reference in JGitClientSession must be volatile
  sshd: correct the protocol version exchange

5 years agoMerge "Constants for objects and info/{http-,}alternates"
Jonathan Nieder [Fri, 2 Aug 2019 16:28:54 +0000 (12:28 -0400)]
Merge "Constants for objects and info/{http-,}alternates"

5 years agoConstants for objects and info/{http-,}alternates 75/146675/4
David Turner [Thu, 25 Jul 2019 19:44:34 +0000 (15:44 -0400)]
Constants for objects and info/{http-,}alternates

These are useful to avoid typos, and also for tab completion.

Change-Id: I0f2d267e46b36bc40297c9657c447f3fd8b9f831
Signed-off-by: David Turner <dturner@twosigma.com>
5 years agoUploadPack: move writing of "packfile" header 92/139992/10
Jonathan Tan [Wed, 3 Apr 2019 17:52:48 +0000 (10:52 -0700)]
UploadPack: move writing of "packfile" header

In a subsequent patch, in some cases, PackWriter#writePack will be
responsible for both the "packfile-uris" and "packfile" sections,
meaning that (in these cases) it must write the "packfile" section
header itself.

In preparation for that patch, move the writing of the "packfile"
section header closer to the invocation of PackWriter#writePack when the
entire fetch response is configured to use the sideband. This means that
"packfile" is written *after* objects are counted (and progress messages
sent to the client in sideband 2) when the "sideband-all" feature is
used (whether "packfile-uris" is used or not), and written *before*
objects are counted otherwise.

Having code to write "packfile" in two places is unfortunate but
necessary. When "sideband-all" is not used, object counting has to
happen after "packfile" is written, because "packfile" activates the
sideband that allows counting progress to be transmitted. When
"packfile-uris" is used, object counting has to happen before "packfile"
is written, because object counting determines whether to send
"packfile-uris" or "packfile". When "sideband-all" is used but
"packfile-uris" is not used, either way works; this commit uses
"packfile-uris" behavior in this case.

Also make the naming of the sideband-activating methods in PacketLineOut
more consistent.

Change-Id: Ifbfd26cc26af10c41b77758168833702d6983df1
Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
5 years agoMerge "JGit pgm tests must quote paths on the command line"
David Pursehouse [Thu, 25 Jul 2019 23:27:56 +0000 (19:27 -0400)]
Merge "JGit pgm tests must quote paths on the command line"

5 years agoJGit pgm tests must quote paths on the command line 73/146573/2
Thomas Wolf [Wed, 24 Jul 2019 18:36:51 +0000 (20:36 +0200)]
JGit pgm tests must quote paths on the command line

The JGit pgm tests parse the command line internally using Linux
semantics, treating '\' as an escape. File paths therefore must
be quoted, otherwise Windows paths are destroyed. See the
attachment[1] on bug 548598.

[1] https://bugs.eclipse.org/bugs/attachment.cgi?id=279387

Bug: 544326
Change-Id: If42e29c8e808b0983fba2843a34c3ea3dd0e9246
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
5 years agoPreUploadHookChain: Use list instead of array internally 56/145656/5
Ivan Frade [Mon, 8 Jul 2019 22:31:49 +0000 (15:31 -0700)]
PreUploadHookChain: Use list instead of array internally

The newly introduced ProtocolV2HookChain is implemented using lists
instead of arrays.

Update PostUploadHookChain to keep the hook chains implementation
consistent.

Change-Id: I5ae0c923f117ac48558a989464f5d5d868d81f76
Signed-off-by: Ivan Frade <ifrade@google.com>
5 years agoPostUploadHookChain: Use a list instead of array internally 55/145655/5
Ivan Frade [Mon, 8 Jul 2019 22:09:30 +0000 (15:09 -0700)]
PostUploadHookChain: Use a list instead of array internally

The newly introduced ProtocolV2HookChain is implemented using lists
instead of arrays.

Update PostUploadHookChain to keep hook chain implementations
consistent.

Change-Id: Ic5694feab943e8949896b93103dbf427716c9bd7
Signed-off-by: Ivan Frade <ifrade@google.com>
5 years agoMerge "UploadPack: add getProtocolV2Hook() method"
Jonathan Tan [Wed, 24 Jul 2019 17:37:45 +0000 (13:37 -0400)]
Merge "UploadPack: add getProtocolV2Hook() method"

5 years agoMerge "ProtocolV2HookChain: Allow to create a chain of protocol V2 hooks"
Jonathan Tan [Wed, 24 Jul 2019 17:37:07 +0000 (13:37 -0400)]
Merge "ProtocolV2HookChain: Allow to create a chain of protocol V2 hooks"

5 years agoJschConfigSessionFactory: [findbugs] Set synchronized 11/144011/5
Masaya Suzuki [Sun, 31 Mar 2019 17:37:25 +0000 (10:37 -0700)]
JschConfigSessionFactory: [findbugs] Set synchronized

Set synchronized to make the config access consistent.

> Inconsistent synchronization of
org.eclipse.jgit.transport.JschConfigSessionFactory.config; locked 80%
of time

In order to make JschConfigSessionFactory threadsafe, synchronize this
method as well.

Change-Id: I32d1bfc2e98363d254992144e795ce72fe1e8846
Signed-off-by: Masaya Suzuki <masayasuzuki@google.com>
5 years agoMerge "UploadPackTest: use Consumer to set up UploadPack"
Jonathan Tan [Fri, 19 Jul 2019 18:37:56 +0000 (14:37 -0400)]
Merge "UploadPackTest: use Consumer to set up UploadPack"

5 years agoUploadPack: add getProtocolV2Hook() method 95/145295/8
Ivan Frade [Mon, 8 Jul 2019 21:44:26 +0000 (14:44 -0700)]
UploadPack: add getProtocolV2Hook() method

A caller cannot install a second hook in the UploadPack without
overwriting whatever is already there.

Offer a method to get the current protocol v2 hook, so it can be chained
with new hooks.

Change-Id: Icb06f94ec52b8c8714f509b5b8622d6db42960fb
Signed-off-by: Ivan Frade <ifrade@google.com>
5 years agoProtocolV2HookChain: Allow to create a chain of protocol V2 hooks 94/145294/5
Ivan Frade [Tue, 2 Jul 2019 12:22:02 +0000 (14:22 +0200)]
ProtocolV2HookChain: Allow to create a chain of protocol V2 hooks

UploadPack only supports one protocol-v2 hook. There are already cases
where more than one is needed.

Offer a Chain class to compose ProtocolV2Hooks, as other hooks do. It
looks like a single hook but it calls all its members.

Change-Id: Idd173ca7df6672079ac0de03c67f77abac376538
Signed-off-by: Ivan Frade <ifrade@google.com>
5 years agoUpgrade maven-javadoc-plugin to 3.1.1 58/145658/3
David Pursehouse [Tue, 9 Jul 2019 02:00:51 +0000 (11:00 +0900)]
Upgrade maven-javadoc-plugin to 3.1.1

Change-Id: If1681581798d1f8b314b506680a75ec7becc1241
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
5 years agoUpgrade ecj to 3.18.0 87/144587/6
David Pursehouse [Fri, 21 Jun 2019 00:57:40 +0000 (09:57 +0900)]
Upgrade ecj to 3.18.0

Change-Id: I785fb9b32b7720c0552da6a6e8f2b7b810f4d3e2
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
5 years agoUpgrade wagon-ssh to 3.3.3 03/144303/8
David Pursehouse [Tue, 18 Jun 2019 00:07:13 +0000 (09:07 +0900)]
Upgrade wagon-ssh to 3.3.3

Change-Id: I6f97dc478f4f62b2bf4a0667fb2dd8f8bdcf2707
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
5 years agoUploadPackTest: use Consumer to set up UploadPack 91/139991/5
Jonathan Tan [Wed, 3 Apr 2019 00:00:12 +0000 (17:00 -0700)]
UploadPackTest: use Consumer to set up UploadPack

Use a Consumer instead of several nullable variables to further
configure UploadPack. This is in preparation for a test in a subsequent
patch needing further customization of the UploadPack object before
invoking it.

Change-Id: I074dff92c711a5ba74558bb4b06c42c115fb9b7f
Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
5 years agoSupport "sideband-all" in protocol v2 fetch 79/135579/6
Jonathan Tan [Tue, 22 Jan 2019 21:17:12 +0000 (13:17 -0800)]
Support "sideband-all" in protocol v2 fetch

Allow the client to specify "sideband-all" in a fetch v2 request,
indicating that the whole response is to be multiplexed (with a sideband
indicator on every non-flush and non-delim pkt) instead of only the
packfile being multiplexed. This allows, for example, progress messages
to be sent at any point in the response.

This implements the "sideband-all" feature documented in
Documentation/technical/protocol-v2.txt in Git.

Change-Id: I3e7f21c88ff0982b1b7ebb09c9ad6c742c4483c8
Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
5 years agoUploadPack: remove pckOut instance field 78/135578/5
Jonathan Tan [Tue, 22 Jan 2019 21:17:12 +0000 (13:17 -0800)]
UploadPack: remove pckOut instance field

It is difficult to track what's happening with the pckOut instance
field, so replace it with a local variable in #upload instead.

Change-Id: Ibd9225b28334b7133eccdc6d82b26fc96cbde299
Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
5 years agoUploadPackTest: refactor capability config test 77/135577/5
Jonathan Tan [Tue, 22 Jan 2019 21:17:12 +0000 (13:17 -0800)]
UploadPackTest: refactor capability config test

UploadPackTest.java contains tests that check behavior when
"allowfilter" and "allowrefinwant" are not set, are set, and are not set
but the client insists on using them anyway. Because another capability
is to be included in a subsequent patch, refactor the common code in
these tests.

Remove setBoolean calls with "false", as they are no-ops.

Also take the opportunity to eliminate the overspecification of the
"fetch=" line returned by the capability advertisement.

Change-Id: I289bbd11c902a513cd8d53bc34767e61ebbd5f17
Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
5 years agosshd: add missing javadoc in SshTestGitServer 81/146081/1
Thomas Wolf [Mon, 15 Jul 2019 11:25:33 +0000 (13:25 +0200)]
sshd: add missing javadoc in SshTestGitServer

Change-Id: Ie2e207eb05e0f6da8018153f8a5dd636e8f35f4c
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
5 years agosshd: shared reference in JGitClientSession must be volatile 48/146048/3
Thomas Wolf [Sat, 13 Jul 2019 13:14:17 +0000 (15:14 +0200)]
sshd: shared reference in JGitClientSession must be volatile

The proxy handler may be re-set from an unspecified I/O thread.
Declare the shared variable as volatile.

Change-Id: I4e7ce393ae2cdc7f1cd4edf40c137da6d6c50ad5
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
5 years agosshd: correct the protocol version exchange 47/146047/3
Thomas Wolf [Sat, 13 Jul 2019 08:57:11 +0000 (10:57 +0200)]
sshd: correct the protocol version exchange

RFC 4253 section 4.2 allows an ssh server to send additional lines
before its server identification string. Apache MINA sshd enforces
for these lines the constraints specified for the server identification
line, too: no NUL characters and not longer than 255 characters. That
is too strict. RFC 4253 doesn't mandate this, and it also doesn't
make sense given the rationale for these lines in RFC 4253: a TCP
wrapper may not be aware of SSH restrictions, and may not adhere to
these constraints.

Be more lenient when parsing the server's protocol version. Allow
NULs and longer lines in the preamble, and also handle line endings
more leniently. Only enforce the restrictions for the actual server
identification line.

Bug: 545939
Change-Id: I75955e9d8a8daef7c04fc0f39539c2ee93514e1c
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
5 years agoTreeRevFilter: Refresh code to latest coding standards 26/146026/1
Ivan Frade [Fri, 12 Jul 2019 22:59:54 +0000 (15:59 -0700)]
TreeRevFilter: Refresh code to latest coding standards

Use brackets in all "if" statements and remove the "final" from local
variables and method arguments.

https://wiki.eclipse.org/EGit/Contributor_Guide#Coding_standards

Change-Id: I185f3112848fc1218cd7adb9828488f03fa4ddfc
Signed-off-by: Ivan Frade <ifrade@google.com>
5 years agoFix typos in Javadoc 36/145636/1
Michael Keppler [Sun, 25 Nov 2018 19:15:53 +0000 (20:15 +0100)]
Fix typos in Javadoc

Change-Id: I225e04aefd02e56a62e16f3db53fdda77d5e7253
Signed-off-by: Michael Keppler <Michael.Keppler@gmx.de>
5 years agoCorrect @since in RevWalk for the --first-parent methods 64/145564/2
Thomas Wolf [Sat, 6 Jul 2019 15:34:35 +0000 (17:34 +0200)]
Correct @since in RevWalk for the --first-parent methods

Fixes PDE API checks complaining: the methods were added
in JGit 5.5.0.

Change-Id: I9ff860c3408c6bb3891fa0da7547394d0fe9d0b6
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
5 years agoMove ServiceMayNotContinueException handling code from sendPack 20/139820/11
Masaya Suzuki [Tue, 5 Mar 2019 03:35:52 +0000 (19:35 -0800)]
Move ServiceMayNotContinueException handling code from sendPack

All other exceptions are handled in a wrapped sendPack method.
Consolidate the error handling code.

Change-Id: Ieac0ce64960534d009d1e6b025130b021b744794
Signed-off-by: Masaya Suzuki <masayasuzuki@google.com>
5 years agoMove exception handling code to the caller 19/139819/10
Masaya Suzuki [Tue, 5 Mar 2019 03:27:27 +0000 (19:27 -0800)]
Move exception handling code to the caller

By doing this, exceptions thrown by sendPack are also covered by the
same code.

Change-Id: I3509f2d832af1410f307e931577e4d07e32b014e
Signed-off-by: Masaya Suzuki <masayasuzuki@google.com>
5 years agoDo not ignore secondary failure 18/139818/10
Masaya Suzuki [Tue, 5 Mar 2019 03:01:39 +0000 (19:01 -0800)]
Do not ignore secondary failure

When another exception is thrown while handling another exception, that
exception can be attached to the original exception since Java 7
(Throwable#getSuppressed). Attach the secondary exception to the
original exception instead of throwing it away.

Change-Id: Ia093b8207714f2638e0343bc45a83d4342947505
Signed-off-by: Masaya Suzuki <masayasuzuki@google.com>
5 years agoAdd assertThrows 09/144009/6
Masaya Suzuki [Fri, 14 Jun 2019 02:11:40 +0000 (19:11 -0700)]
Add assertThrows

This is a new assertion that will be introduced in JUnit 4.13. Unlike
ExpectedException rule, this makes it easy to test other aspects of the
thrown exception, such like ServiceMayNotContinueException's status
code. Introduce this as before making changes to UploadPackTest more.

Change-Id: Ied7b3071ffcd0e93eece35b01e0abc5ff65645f2
Signed-off-by: Masaya Suzuki <masayasuzuki@google.com>
5 years agoRevWalk: Add a setFirstParent that mimics C git's --first-parent 06/52806/4
Dave Borowitz [Mon, 3 Jun 2019 21:03:49 +0000 (14:03 -0700)]
RevWalk: Add a setFirstParent that mimics C git's --first-parent

RevWalk does not currently provide a --first-parent equivalent and the
feature has been requested.

Add a field to the RevWalk class to specify whether walks should
traverse first parents only. Modify Generator implementations to support
the feature.

Change-Id: I4a9a0d5767f82141dcf6d08659d7cb77c585fae4
Signed-off-by: Dave Borowitz <dborowitz@google.com>
Signed-off-by: Alex Spradlin <alexaspradlin@google.com>
5 years agoUploadPack: support lazy fetches if no bitmap 68/142768/5
Jonathan Tan [Thu, 23 May 2019 20:28:53 +0000 (13:28 -0700)]
UploadPack: support lazy fetches if no bitmap

If a client clones with "--filter=blob:none", the checkout that "git
clone" automatically does causes the client to fetch all blobs at HEAD.
When fetching from a non-bitmapped repository, this will fail if an
object walk is ever needed, because JGit currently rejects such requests
- see the commit message of d3021788d2 ("Use bitmaps for non-commit
reachability checks", 2017-11-10) for more information.

Rejecting such requests in the absence of bitmaps is probably
overzealous: it is true that the server would prefer to have bitmaps in
this case, but there might be a small proportion of repos (for example,
very small repos or newly created ones) that do not have bitmaps, yet
the server would still like to have partial clones for them.

So, allow such requests, performing the object walk reachability check
if necessary. Limit this to servers with "uploadpack.allowFilter"
configured, so that servers wanting to support partial clone have this
functionality, and servers that do not support partial clone do not have
to pay the object walk reachability check cost.

Change-Id: I51964bafec68696a799625d627615b4f45ddbbbf
Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
5 years agoFix bundle localization of Apache SSH bundle 13/144613/2
Michael Keppler [Fri, 21 Jun 2019 15:39:20 +0000 (17:39 +0200)]
Fix bundle localization of Apache SSH bundle

The placeholders in manifest and plugin.properties did not match. To
avoid similar issues, all placeholders have been changed to
Bundle-Vendor and Bundle-Name now.

Bug:548503
Change-Id: Ibd4b9bc237b323e614506b97e5fbc99416365040
Signed-off-by: Michael Keppler <Michael.Keppler@gmx.de>
5 years agoFix "reset -hard" bug that folders could not be deleted 69/127969/9
René Scheibe [Sat, 4 Aug 2018 11:19:17 +0000 (13:19 +0200)]
Fix "reset -hard" bug that folders could not be deleted

The deleted code is not required as removed files are deleted correctly in
doCheckout() anyway.

The deleted code failed in case a non-empty directory had to be deleted.
file.delete() returned false, triggering an exception.

Bug: 479266
Change-Id: I011bb3882ff0c35b238aa3eccad7889041210277
Signed-off-by: René Scheibe <rene.scheibe@gmail.com>
5 years agoFix "reset -hard" bug that folders could not be created 68/127968/11
René Scheibe [Sat, 4 Aug 2018 17:26:11 +0000 (19:26 +0200)]
Fix "reset -hard" bug that folders could not be created

Creating a folder failed in case a file with the same name already
existed.

Bug: 479266
Change-Id: Ia987660ec0968ad4081dbd5a60e80660539497e3
Signed-off-by: René Scheibe <rene.scheibe@gmail.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoBazel: Fix lint warning flagged by buildifier 11/144311/2
David Ostrovsky [Tue, 18 Jun 2019 07:37:51 +0000 (09:37 +0200)]
Bazel: Fix lint warning flagged by buildifier

This change is fixing confusing name warning: [1].

  ./org.eclipse.jgit.test/tests.bzl:12: confusing-name:
  Never use 'l', 'I', or 'O' as names (they're too easily confused
  with 'I', 'l', or '0').

And is also fixing: "All calls to rules or macros should pass arguments
by keyword position argument" warning: [2].

  ./org.eclipse.jgit.test/BUILD:42: positional-args: All calls to rules
  or macros should pass arguments by keyword (arg_name=value) syntax.

[1] https://github.com/bazelbuild/buildtools/blob/master/WARNINGS.md#confusing-name
[2] https://github.com/bazelbuild/buildtools/blob/master/WARNINGS.md#positional-args

Change-Id: If5c28ec8a1ddc1d1b1035bd07b838a2a564aea4f
Signed-off-by: David Ostrovsky <david@ostrovsky.org>
5 years agoUpdate bazlets to latest version 08/144308/1
David Ostrovsky [Tue, 18 Jun 2019 07:17:16 +0000 (09:17 +0200)]
Update bazlets to latest version

This is needed to make build tool chain compatible with the latest
Bazel releases.

Change-Id: I9822b5fe5f934457e6069217d687b3cf4764b7b7
Signed-off-by: David Ostrovsky <david@ostrovsky.org>
5 years ago[Java 11] Update mockito to 2.23.0 05/144305/1
Matthias Sohn [Tue, 18 Jun 2019 00:20:13 +0000 (02:20 +0200)]
[Java 11] Update mockito to 2.23.0

This update is required for Java 11.

Update
- org.mockito to 2.23.0.v20190527-1420
- net.bytebuddy.byte-buddy to 1.9.0.v20181107-1410
- net.bytebuddy.byte-buddy-agent to 1.9.0.v20181106-1534

CQ: 20214
CQ: 20215
CQ: 20216
See: https://github.com/mockito/mockito/issues/1482
Change-Id: I3ac744f7247c71f01d50f7f409fee5825f3d5295
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years ago[Java 9] Fix GitDateFormatterTest 04/144304/1
Matthias Sohn [Mon, 17 Jun 2019 23:48:10 +0000 (01:48 +0200)]
[Java 9] Fix GitDateFormatterTest

In JDK 9 and later, the default locale data uses data derived from the
Unicode Consortium's Common Locale Data Repository (CLDR). So there are
changes with respect to some locales.

For example the short date-time format is ‹{1}, {0}› in the CLDR locale,
as opposed to {1} {0} in the JRE locale data.

See: https://bugs.openjdk.java.net/browse/JDK-8206961
See: https://www.unicode.org/cldr/charts/29/by_type/date_&_time.gregorian.html#1141bf54834c4261
Change-Id: I7535821e8ecd8702a95db8732cbbf3a4a7385eca
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years ago[Java 11] Remove dependency on javax.xml.bind package 99/144299/4
David Ostrovsky [Mon, 17 Jun 2019 21:28:52 +0000 (23:28 +0200)]
[Java 11] Remove dependency on javax.xml.bind package

Replace javax.xml.bind.DatatypeConverter, that is not available any
more in Java 11 and later with Hex utility from non optional Bouncy
Castle library.

Bug: 540790
Change-Id: I9903c00ecc1a434e9795b8ba9267f02628fdc0e9
Signed-off-by: David Ostrovsky <david@ostrovsky.org>
5 years agoMerge "RebaseTodoFileTest: Fix "the the" typo"
David Pursehouse [Sun, 16 Jun 2019 04:27:04 +0000 (00:27 -0400)]
Merge "RebaseTodoFileTest: Fix "the the" typo"

5 years agoIgnore warning that tests don't export all packages 30/144130/1
Matthias Sohn [Sun, 16 Jun 2019 00:34:48 +0000 (02:34 +0200)]
Ignore warning that tests don't export all packages

Change-Id: I95de23fbdce125305be08079bcd179413f8f7f5c
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoEnsure all packages are exported 29/144129/1
Matthias Sohn [Sun, 16 Jun 2019 00:30:10 +0000 (02:30 +0200)]
Ensure all packages are exported

This wasn't the case for the bundles
- org.eclipse.jgit.ant
- org.eclipse.jgit.archive

Change-Id: Ibefcc82174fe23a9c1afb765099957414ac3556b
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoDelete unused API problem filters 28/144128/1
Matthias Sohn [Sun, 16 Jun 2019 00:25:33 +0000 (02:25 +0200)]
Delete unused API problem filters

Change-Id: Id8dcc337aab4ec6a11a2bb60b85d0db42986b80b
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoWalk tag chains for --include-tag options 08/119408/5
Pavel Flaška [Fri, 24 Nov 2017 13:55:28 +0000 (14:55 +0100)]
Walk tag chains for --include-tag options

When cloning repository with --single-branch option, tag chains are not
packed and pack file is broken in some cases.

Typical test-case:
git tag -a test_tag <commit-id>
git tag -a test_prev_tag test_tag
git tag -d test_tag

git clone --single-branch <repository>
fatal: did not receive expected object <test_tag_id>

The reason for that is missing object for original test_tag reference,
which was deleted.

Problem description:
When pack-objects is given --include-tag, it peels each tag reference
down to a commit. If the commit is prepared to be packed, we we have to
include such tag too. The problem is when the tag points to through some
chain of other tag to commit. Then, the inner tags are not added leading
to broken pack.

Fix:
When going to commit, we have to check and add any of the tags on the
way (if they were not selected, which may happen with --single-branch
option).

Change-Id: I1682d4a2c52d674f90a1b021e0f6c3524c5ce5bc
Signed-off-by: Pavel Flaška <Pavel.Flaska@gmail.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoUpdate API comparison baseline to 5.4.0.201906121030-r 15/143915/1
Matthias Sohn [Thu, 13 Jun 2019 01:02:31 +0000 (03:02 +0200)]
Update API comparison baseline to 5.4.0.201906121030-r

Change-Id: I1d3f2e56203173e4683c3b635d9affccdd510abf
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoPrepare 5.5.0-SNAPSHOT builds 14/143914/1
Matthias Sohn [Thu, 13 Jun 2019 01:01:15 +0000 (03:01 +0200)]
Prepare 5.5.0-SNAPSHOT builds

Change-Id: I177d637e552a79014816dc5d2ef5ccda506adb39
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoMerge branch 'stable-5.4' 09/143909/1
Matthias Sohn [Thu, 13 Jun 2019 00:44:31 +0000 (02:44 +0200)]
Merge branch 'stable-5.4'

* stable-5.4:
  Prepare 5.4.1-SNAPSHOT builds
  JGit v5.4.0.201906121030-r
  JGit v5.4.0.201906120450-r
  Increase severity of OperatorPrecedence to ERROR, and fix instances
  PackWriter: Make internal class static
  Prepare 5.3.3-SNAPSHOT builds
  JGit v5.3.2.201906051522-r
  Prepare 5.1.9-SNAPSHOT builds
  JGit v5.1.8.201906050907-r
  Test detecting modified packfiles
  Enhance fsTick() to use filesystem timer resolution
  Add debug trace to measure time needed to open pack index
  Extend FileSnapshot for packfiles to also use checksum to detect changes
  Wait opening new packfile until it can't be racy anymore
  Avoid null PackConfig in GC
  Add FileSnapshot test testing recognition of file size changes
  Capture reason for result of FileSnapshot#isModified
  Skip FileSnapshotTest#testSimulatePackfileReplacement on Windows
  Tune max heap size for tests
  Fix FileSnapshotTest.testNewFileNoWait() to match its javadoc
  ObjectDirectory: fix closing of obsolete packs
  Update API filters for methods added to fix bugs
  Bazel: Increase severity of most error-prone checks to ERROR
  Enable error-prone checks by default
  Add bazel options to align with gerrit's
  Include filekey file attribute when comparing FileSnapshots
  Measure file timestamp resolution used in FileSnapshot
  Fix FileSnapshot's consideration of file size
  Fix API problem filters
  Fix API problem filters

Change-Id: I4abbaaf79da1944244511aad97d2df09d47c0c3c

5 years agoPrepare 5.4.1-SNAPSHOT builds 59/143859/1
Matthias Sohn [Wed, 12 Jun 2019 15:35:11 +0000 (17:35 +0200)]
Prepare 5.4.1-SNAPSHOT builds

Change-Id: I8620d03c1cd5c1d0ad04e7607553e9aa18def9bb
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoJGit v5.4.0.201906121030-r 40/143840/1 v5.4.0.201906121030-r
Matthias Sohn [Wed, 12 Jun 2019 14:29:11 +0000 (16:29 +0200)]
JGit v5.4.0.201906121030-r

Change-Id: Ie68828af68d07cf8e3fe778d39436f539f1c73d0
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoJGit v5.4.0.201906120450-r 09/143809/1
Matthias Sohn [Wed, 12 Jun 2019 08:50:14 +0000 (10:50 +0200)]
JGit v5.4.0.201906120450-r

Change-Id: Iea17cba848d4e53d69d34e952a2476c375721aa4
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoRebaseTodoFileTest: Fix "the the" typo 01/143801/1
Ivan Frade [Wed, 12 Jun 2019 07:35:21 +0000 (09:35 +0200)]
RebaseTodoFileTest: Fix "the the" typo

Reported by downstream analyzers.

Change-Id: I719bb2dd5b59390973dc2eb0d6854096e3768afb
Signed-off-by: Ivan Frade <ifrade@google.com>
5 years agoIncrease severity of OperatorPrecedence to ERROR, and fix instances 79/143779/1
David Pursehouse [Wed, 12 Jun 2019 00:06:46 +0000 (09:06 +0900)]
Increase severity of OperatorPrecedence to ERROR, and fix instances

Fix all remaining instances of the OperatorPrededence warning, by adding
parentheses to make the precedence explicit.

Change-Id: Ib296dfed09f9be042d0ff0f7fad8214e4dd766b4
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
5 years agoMerge branch 'master' into stable-5.4 70/143770/2
Matthias Sohn [Tue, 11 Jun 2019 21:09:19 +0000 (23:09 +0200)]
Merge branch 'master' into stable-5.4

* master:
  Handle missing "ours" stage in WorkingTreeIterator.hasCrLfInIndex()
  Config: Add helper method to check for empty value
  ErrorProne: Increase severity of FutureReturnValueIgnored to ERROR
  FS_Win32: Add missing parentheses on if-blocks
  Upgrade spotbugs to 3.1.12
  Abbreviated{Long}ObjectId: Make operator precedence explicit
  GC: Update TODO comments
  FS_POSIX: Fix reference comparison of Boolean.FALSE
  Increase bazel timeout for long running tests
  Use bazelisk to switch between used bazel version
  Bump minimum Bazel version to 0.26.1
  Bazel: Bump skylib library version to 0.8.0
  Retry loading config when locked by another process
  Make pull --rebase on an unborn branch do a checkout
  Warn if configured cookie file is missing
  Handle escaped CR-LF in git config files
  DescribeCommand: use glob match instead of path match
  Fix off-by-one error in RebaseTodoFile when reading a todo file
  Consistently use "!isEmpty()" to detect non-empty list
  TransportHttp: Check for non-empty list with "!isEmpty()" rather than
    "size() > 0"
  TransportHttp: Fix comparison of size with ">= 0"
  NetscapeCookieFileTest: Split HttpCookiesMatcher to own class
  Bazel: Add missing dependency on mockito for TransportHttpTest
  Determine hard-linking and nlink support per FileStore
  Support reading and writing cookies.
  Repository: Add getIdentifier() method to avoid instanceof operator
  Update to Orbit R20190602212107
  PacketLineIn: Deprecate the END constant
  PacketLineIn: Add an iterator over strings in the input stream
  Replace most usages of PacketLineIn.END with PacketLineIn.end()
  PacketLineIn: Deprecate DELIM constant
  Replace trivial reference comparison of PacketLineIn.{DELIM,END}
  PacketLineIn: Rename isDelim to isDelimiter
  ProtocolV2ParserTest: Fix typo in comment
  Upgrade Bouncy Castle to 1.61
  Update to Orbit R20190531194818 and rollback update to Ant 1.10.6
  cli: Add the --always option to describe
  DescribeCommand: Support the "always" option
  cli: Add the --tags option to describe
  DescribeCommand: Consistenly omit the default value
  Remove excess blank line in FileUtilsTest
  PacketLineIn: Add helper methods to check for END and DELIM
  UploadPackTest: Rename variable to avoid hiding class member
  UploadPackTest: Add missing <> operator on instantiation of ArrayList
  BitmapCalculator: javadoc fixes
  RevWalkUtils: add progress callback to findBranchesReachableFrom
  Upgrade maven-source-plugin to 3.1.0
  Upgrade maven-jar-plugin to 3.1.2
  Upgrade jacoco-maven-plugin to 0.8.4
  BitmapCalculator and its test: add missing license header
  RevWalk: new method createReachabilityChecker()

Change-Id: I4d76c7c0dbe6411c842f3468b709f7df51789c08
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoHandle missing "ours" stage in WorkingTreeIterator.hasCrLfInIndex() 16/143716/1
Thomas Wolf [Tue, 11 Jun 2019 11:16:18 +0000 (13:16 +0200)]
Handle missing "ours" stage in WorkingTreeIterator.hasCrLfInIndex()

In a delete-modify conflict with the deletion as "ours" there may be
no stage 2 in the index. Add appropriate null checks. Add a new test
for this case, and verify that the file gets added with a single LF
after conflict resolution with core.autocrlf=true. This matches the
behavior of canonical git for this case.

Bug: 547724
Change-Id: I1bafdb83d9b78bf85294c78325e818e72fae53bc
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
5 years agoConfig: Add helper method to check for empty value 75/143575/4
David Pursehouse [Sat, 8 Jun 2019 06:01:44 +0000 (15:01 +0900)]
Config: Add helper method to check for empty value

Rename MAGIC_EMPTY_VALUE to MISSING_ENTRY, make it private, and add
a helper method to check if a given string is that value.

This avoids that callers trigger the "reference equality" warning
from Error Prone.

Change-Id: Idc76f78c0cf1828aa48d02ee33911a4b5df50355
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
5 years agoErrorProne: Increase severity of FutureReturnValueIgnored to ERROR 77/143577/4
David Pursehouse [Sat, 8 Jun 2019 06:47:42 +0000 (15:47 +0900)]
ErrorProne: Increase severity of FutureReturnValueIgnored to ERROR

The only remaining code where the return value is ignored is in tests.
Update them to store the value and perform a basic assertion.

Change-Id: I29ef5bd5dd0648aac3490f9e47ecc74544109652
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
5 years agoFS_Win32: Add missing parentheses on if-blocks 76/143576/4
David Pursehouse [Sat, 8 Jun 2019 06:06:22 +0000 (15:06 +0900)]
FS_Win32: Add missing parentheses on if-blocks

Change-Id: I70504484f20aee103e51c852d71cd41b54093793
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
5 years agoUpgrade spotbugs to 3.1.12 52/143652/2
David Pursehouse [Tue, 11 Jun 2019 00:24:26 +0000 (09:24 +0900)]
Upgrade spotbugs to 3.1.12

Change-Id: I8093ce8342ab98f12ffabaf2862e6f1b161c4c87
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
5 years agoAbbreviated{Long}ObjectId: Make operator precedence explicit 79/143579/4
David Pursehouse [Sat, 8 Jun 2019 07:25:32 +0000 (16:25 +0900)]
Abbreviated{Long}ObjectId: Make operator precedence explicit

Change-Id: Iafd616d3fdc81ac3072f776061548be195270d85
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
5 years agoGC: Update TODO comments 78/143578/4
David Pursehouse [Sat, 8 Jun 2019 06:48:57 +0000 (15:48 +0900)]
GC: Update TODO comments

The TODO comments say "in 5.0", but 5.0 was already released without
resolving them. Remove "in 5.0" on the assumption that the mentioned
improvements still need to be done at some point.

Change-Id: I3eb429803e2266de3fc490e1f3912991c08aa1ad
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
5 years agoFS_POSIX: Fix reference comparison of Boolean.FALSE 74/143574/3
David Pursehouse [Sat, 8 Jun 2019 05:54:19 +0000 (14:54 +0900)]
FS_POSIX: Fix reference comparison of Boolean.FALSE

Change-Id: Ic205d017b365ea85983d0b0d9d033fcf7e6bf6ab
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
5 years agoIncrease bazel timeout for long running tests 48/143648/2
Matthias Sohn [Mon, 10 Jun 2019 21:35:20 +0000 (23:35 +0200)]
Increase bazel timeout for long running tests

EolRepositoryTest and GcCommitSelectionTest timed out frequently when
running unit tests using bazel with the default timeout "moderate"
(300s). Increase timeout of these tests to "long" (900s).

Change-Id: I43588cf950f55b50f868d9fe9c66d22bd428a54c
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoUse bazelisk to switch between used bazel version 84/143584/2
David Ostrovsky [Sat, 8 Jun 2019 15:33:28 +0000 (17:33 +0200)]
Use bazelisk to switch between used bazel version

Bazelisk is utility to switch to the right Bazel version, that we
used to have with Buck build tool: [1].

Bazelisk will download the right Bazel version only once and will use
it in subsequent calls:

  $ bazelisk build :release
  2019/06/06 16:22:15 Downloading \
  https://releases.bazel.build/0.26.1/release/bazel-0.26.1-linux-x86_64...

Bazelisk is storing the binaries in user's cache directory: [2], e.g.
on Linux OS:

  $ ls -1 ~/.cache/bazelisk/bin
  bazel-0.26.1-linux-x86_64

* [1] https://github.com/bazelbuild/bazelisk
* [2] https://golang.org/pkg/os/#UserCacheDir

Change-Id: Ia9180fb75f8cc17a0a0232622cf33a13bfad6b60
Signed-off-by: David Ostrovsky <david@ostrovsky.org>
5 years agoBump minimum Bazel version to 0.26.1 83/143583/2
David Ostrovsky [Sat, 8 Jun 2019 15:32:35 +0000 (17:32 +0200)]
Bump minimum Bazel version to 0.26.1

Change-Id: I8d6f9eac5af54e5b270e7db4e52d1b4063c1aa56
Signed-off-by: David Ostrovsky <david@ostrovsky.org>
5 years agoBazel: Bump skylib library version to 0.8.0 82/143582/2
David Ostrovsky [Sat, 8 Jun 2019 15:31:33 +0000 (17:31 +0200)]
Bazel: Bump skylib library version to 0.8.0

Change-Id: I2089899c9f197b2c93b93390fdd55f6fe11e5ce4
Signed-off-by: David Ostrovsky <david@ostrovsky.org>
5 years agoRetry loading config when locked by another process 30/126730/3
Michael Keppler [Sun, 29 Jul 2018 05:53:11 +0000 (07:53 +0200)]
Retry loading config when locked by another process

When loading the config, a FileNotFoundException may occur if the file
exists but cannot be read (see [1]). This is the case on Windows with a
virus scanner checking the file. Therefore if the file exists and that
exception is thrown, retry multiple times, similar to how this was
already implemented for IOException.

[1] https://docs.oracle.com/javase/8/docs/api/java/io/FileNotFoundException.html

Bug: 529522
Change-Id: Ic5dc3b7b24bb0005d6256ed00513bc7c0b91e613
Signed-off-by: Michael Keppler <Michael.Keppler@gmx.de>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoMake pull --rebase on an unborn branch do a checkout 67/137967/2
Thomas Wolf [Sun, 3 Mar 2019 23:07:40 +0000 (00:07 +0100)]
Make pull --rebase on an unborn branch do a checkout

A merging pull on an unborn branch was already supported. But a
rebasing pull failed. If the user has pull.rebase = true in his
user config, the pull would try to rebase. Rebasing needs a parent
commit, though. Native git handles this case:

  git init
  git remote add origin <URI>
  git pull --rebase origin master

Check up front in PullCommand for the unborn head and just do a
checkout in this case. MergeCommand already has similar code.

Bug: 544965
Change-Id: I1277e1ac0b0364b4623fd791f3d6b07bd5f58fca
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
5 years agoWarn if configured cookie file is missing 94/143594/2
Matthias Sohn [Sun, 9 Jun 2019 07:49:07 +0000 (09:49 +0200)]
Warn if configured cookie file is missing

We logged a stack trace if the configured http.cookieFile was missing.
Instead only log a warning.

Bug: 548081
Change-Id: I42e39f5ad8ffce7b43162e5068f60af073b8a126
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoHandle escaped CR-LF in git config files 38/140138/4
Thomas Wolf [Fri, 5 Apr 2019 19:33:14 +0000 (21:33 +0200)]
Handle escaped CR-LF in git config files

Canonical git treats CR-LF in config files as LF.[1][2] JGit does so,
too, except when escaped as a line continuation. Correct this and
treat the sequence \-CR-LF as a line continuation.

[1] https://github.com/git/git/commit/db2c075d9
[2] https://github.com/git/git/blob/v2.21.0/config.c#L485

Bug: 545850
Change-Id: I51e7378a22c21b3baa3701163c423d04c900af5a
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoDescribeCommand: use glob match instead of path match 30/141730/2
Thomas Wolf [Tue, 30 Apr 2019 17:11:16 +0000 (19:11 +0200)]
DescribeCommand: use glob match instead of path match

Otherwise tags may fail to match if their name contains slashes.
Canonical git also uses its wildcard matcher in glob mode.[1]

[1] https://github.com/git/git/blob/v2.21.0/builtin/describe.c#L182

Bug: 546703
Change-Id: I122c7959974fa1fc6a53dfc65837e4314a8badd4
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
5 years agoFix off-by-one error in RebaseTodoFile when reading a todo file 25/140925/2
Thomas Wolf [Sun, 21 Apr 2019 19:23:30 +0000 (21:23 +0200)]
Fix off-by-one error in RebaseTodoFile when reading a todo file

Commit messages of length 1 were not read. 'lineEnd' is the offset
of the last character in the line before the terminating LF or CR-LF,
and 'nextSpace' is actually the offset of the character _after_ the
next space. With a one-character commit message, nextSpace == lineEnd.

The code also assumes the commit message to be optional, but actually
failed in that case because it read beyond the line ending. Fix that,
too.

Add a test case for reading a todo file.

Bug: 546245
Change-Id: I368d63615930ea2398a6230e756442fd88870654
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
5 years agoConsistently use "!isEmpty()" to detect non-empty list 83/143483/1
David Pursehouse [Fri, 7 Jun 2019 03:12:44 +0000 (12:12 +0900)]
Consistently use "!isEmpty()" to detect non-empty list

Replace "size() > 0" with "!isEmpty()" where appropriate.

In the Status implementation we can drop the check; the subsequent
loop will only execute when the list is non-empty anyway.

Change-Id: I355aff551a603373e702a9d44304f087b476263c
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
5 years agoTransportHttp: Check for non-empty list with "!isEmpty()" rather than "size() > 0" 81/143481/1
David Pursehouse [Fri, 7 Jun 2019 01:59:46 +0000 (10:59 +0900)]
TransportHttp: Check for non-empty list with "!isEmpty()" rather than "size() > 0"

Change-Id: Iabb627c8f584346eb8ace3c24afb63b4d1ad3d47
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
5 years agoTransportHttp: Fix comparison of size with ">= 0" 80/143480/1
David Pursehouse [Fri, 7 Jun 2019 01:57:15 +0000 (10:57 +0900)]
TransportHttp: Fix comparison of size with ">= 0"

Error Prone reports:

  [SizeGreaterThanOrEqualsZero] Comparison of a size >= 0 is always true,
  did you intend to check for non-emptiness?

  see https://errorprone.info/bugpattern/SizeGreaterThanOrEqualsZero

Change-Id: Ie964771cacca4b15569eb45f6e273ad2a7e2e49c
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
5 years agoNetscapeCookieFileTest: Split HttpCookiesMatcher to own class 79/143479/1
David Pursehouse [Fri, 7 Jun 2019 01:51:21 +0000 (10:51 +0900)]
NetscapeCookieFileTest: Split HttpCookiesMatcher to own class

The bazel build fails due to NetscapeCookieFileTest's internal class not
being visible to TransportHttpTest.

Split the file out to its own class in the util package, so it's visible
to both.

Change-Id: I69236026eecb9d08a9a66e51752a80ea522b0c6a
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
5 years agoBazel: Add missing dependency on mockito for TransportHttpTest 78/143478/1
David Pursehouse [Fri, 7 Jun 2019 01:22:13 +0000 (10:22 +0900)]
Bazel: Add missing dependency on mockito for TransportHttpTest

Change-Id: I54eff21c7aa8ee4b3b4a2fea60c5bca359256808
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
5 years agoDetermine hard-linking and nlink support per FileStore 85/142385/2
Thomas Wolf [Sat, 18 May 2019 21:48:54 +0000 (23:48 +0200)]
Determine hard-linking and nlink support per FileStore

It's quite possible that JGit can use the hard-linking mechanism
for atomic file creation on some volumes but not on others.
Ultimately it depends on the file systems on the mounted volumes.

Cache the information per FileStore instead of using a single
global flag. Also catch FileSystemException, it may be thrown
if the operating system reports a failure. The previously caught
AccessDeniedException is a sub-class of FileSystemException.

Bug: 547332
Change-Id: I1ef672b3468b0be79e71674344f16f28f9d11ba1
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
5 years agoSupport reading and writing cookies. 04/132704/25
Konrad Windszus [Mon, 19 Nov 2018 17:10:07 +0000 (18:10 +0100)]
Support reading and writing cookies.

The git config entries "http.cookieFile" and
"http.saveCookies" are correctly evaluated.

Bug: 488572
Change-Id: Icfeeea95e1a5bac3fa4438849d4ac2306d7d5562
Signed-off-by: Konrad Windszus <konrad_w@gmx.de>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoPackWriter: Make internal class static 78/143178/4
David Pursehouse [Sun, 2 Jun 2019 08:45:32 +0000 (17:45 +0900)]
PackWriter: Make internal class static

When Error Prone checks are enabled, the "ClassCanBeStatic" warning is
triggered:

  Inner class is non-static but does not reference enclosing class
  see https://errorprone.info/bugpattern/ClassCanBeStatic

Change-Id: I5a0e3bf0cf8c28176d9c98914c1c0dfab9c5736f
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
5 years agoMerge branch 'stable-5.3' into stable-5.4 53/143453/2
Matthias Sohn [Thu, 6 Jun 2019 09:34:56 +0000 (11:34 +0200)]
Merge branch 'stable-5.3' into stable-5.4

* stable-5.3:
  Prepare 5.3.3-SNAPSHOT builds
  JGit v5.3.2.201906051522-r
  Prepare 5.1.9-SNAPSHOT builds
  JGit v5.1.8.201906050907-r
  Test detecting modified packfiles
  Enhance fsTick() to use filesystem timer resolution
  Add debug trace to measure time needed to open pack index
  Extend FileSnapshot for packfiles to also use checksum to detect changes
  Wait opening new packfile until it can't be racy anymore
  Avoid null PackConfig in GC
  Add FileSnapshot test testing recognition of file size changes
  Capture reason for result of FileSnapshot#isModified
  Skip FileSnapshotTest#testSimulatePackfileReplacement on Windows
  Tune max heap size for tests
  Fix FileSnapshotTest.testNewFileNoWait() to match its javadoc
  ObjectDirectory: fix closing of obsolete packs
  Update API filters for methods added to fix bugs
  Bazel: Increase severity of most error-prone checks to ERROR
  Enable error-prone checks by default
  Add bazel options to align with gerrit's
  Include filekey file attribute when comparing FileSnapshots
  Measure file timestamp resolution used in FileSnapshot
  Fix FileSnapshot's consideration of file size
  Fix API problem filters
  Fix API problem filters

Change-Id: Ie1c7e4752661aec9e1754660934921224e2408eb
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoPrepare 5.3.3-SNAPSHOT builds 52/143452/1
Matthias Sohn [Wed, 5 Jun 2019 21:35:14 +0000 (23:35 +0200)]
Prepare 5.3.3-SNAPSHOT builds

Change-Id: Idebf272835cb22c21257c88b414ada802629b665
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoRepository: Add getIdentifier() method to avoid instanceof operator 61/142261/12
David Ostrovsky [Thu, 16 May 2019 15:06:57 +0000 (17:06 +0200)]
Repository: Add getIdentifier() method to avoid instanceof operator

This change is needed to implement permission aware ref database in
Gerrit: [1], that is a pre-requisite to re-enable Git v2 protocol in
Gerrit: [2].

Background: Last year Git v2 protocol was enabled in Gerrit. The fact,
that JGit layer was not calling ref advertise filter for Git v2
protocol, introduced security vulnerability.

The lesson learned from this security incident: Gerrit should not rely
on ref advertise filter being called by JGit to implement crictical
security checks. Instead, the idea is to use the same approach as
currently used by Google's internal code on googlesource.com that
didn't suffer from this vulnerability: provide a custom repository to
JGit. The repository provides a RefDatabase that is permission-aware
and will only ever return refs that the user has access to.

However, due to hard coded instanceof operator usages in JGit code
base, some tests in Gerrit are failing with: [1] in place. This change
addresses this problem.

[1] https://gerrit-review.googlesource.com/c/gerrit/+/212874
[2] https://gerrit-review.googlesource.com/c/gerrit/+/226754

Change-Id: I67c0f53ca33b149442e7ee3e51910d19e3f348d5
Signed-off-by: David Ostrovsky <david@ostrovsky.org>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoJGit v5.3.2.201906051522-r 00/143400/1 v5.3.2.201906051522-r
Matthias Sohn [Wed, 5 Jun 2019 19:23:13 +0000 (21:23 +0200)]
JGit v5.3.2.201906051522-r

Change-Id: I41b4926f4bfa896ef2a13c35e93e08071ae949a3
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoMerge branch 'stable-5.2' into stable-5.3 99/143399/1
Matthias Sohn [Wed, 5 Jun 2019 19:18:21 +0000 (21:18 +0200)]
Merge branch 'stable-5.2' into stable-5.3

* stable-5.2:
  Prepare 5.1.9-SNAPSHOT builds
  JGit v5.1.8.201906050907-r
  Test detecting modified packfiles
  Enhance fsTick() to use filesystem timer resolution
  Add debug trace to measure time needed to open pack index
  Extend FileSnapshot for packfiles to also use checksum to detect changes
  Wait opening new packfile until it can't be racy anymore
  Avoid null PackConfig in GC
  Add FileSnapshot test testing recognition of file size changes
  Capture reason for result of FileSnapshot#isModified
  Skip FileSnapshotTest#testSimulatePackfileReplacement on Windows
  Tune max heap size for tests
  Fix FileSnapshotTest.testNewFileNoWait() to match its javadoc
  ObjectDirectory: fix closing of obsolete packs
  Include filekey file attribute when comparing FileSnapshots
  Measure file timestamp resolution used in FileSnapshot
  Fix FileSnapshot's consideration of file size
  Fix API problem filters
  Fix API problem filters

Change-Id: Id79a3a19f9a31dff94d10a406c2b6e08a506931a

5 years agoMerge branch 'stable-5.1' into stable-5.2 95/143395/2
Matthias Sohn [Wed, 5 Jun 2019 13:43:29 +0000 (15:43 +0200)]
Merge branch 'stable-5.1' into stable-5.2

* stable-5.1:
  Prepare 5.1.9-SNAPSHOT builds
  JGit v5.1.8.201906050907-r
  Test detecting modified packfiles
  Enhance fsTick() to use filesystem timer resolution
  Add debug trace to measure time needed to open pack index
  Extend FileSnapshot for packfiles to also use checksum to detect changes
  Wait opening new packfile until it can't be racy anymore
  Avoid null PackConfig in GC
  Add FileSnapshot test testing recognition of file size changes
  Capture reason for result of FileSnapshot#isModified
  Skip FileSnapshotTest#testSimulatePackfileReplacement on Windows
  Tune max heap size for tests
  Fix FileSnapshotTest.testNewFileNoWait() to match its javadoc
  ObjectDirectory: fix closing of obsolete packs
  Include filekey file attribute when comparing FileSnapshots
  Measure file timestamp resolution used in FileSnapshot
  Fix FileSnapshot's consideration of file size
  Fix API problem filters

Change-Id: I3ac77bfa03f7436de12ab86e1bba29afee5ccd01
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoPrepare 5.1.9-SNAPSHOT builds 62/143362/1
Matthias Sohn [Wed, 5 Jun 2019 13:23:56 +0000 (15:23 +0200)]
Prepare 5.1.9-SNAPSHOT builds

Change-Id: I60571e4e0bea04bb2c25ef3d0332a9ab6895db06
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoJGit v5.1.8.201906050907-r 61/143361/1 v5.1.8.201906050907-r
Matthias Sohn [Wed, 5 Jun 2019 13:06:56 +0000 (15:06 +0200)]
JGit v5.1.8.201906050907-r

Change-Id: Iae0ffe161df2ca8a800d21688d6b7d7419dfb640
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoTest detecting modified packfiles 24/143124/6
Christian Halstrick [Fri, 31 May 2019 13:02:02 +0000 (15:02 +0200)]
Test detecting modified packfiles

Test that JGit detects that packfiles have changed even if they are
repacked multiple times in one tick of the filesystem timer.

Test that this detection works also when repacking doesn't change the
length or the filekey of the packfile. In this case where a modified
file can't be detected by looking at file metadata JGit should still
detect too fast modification by racy git checks and trigger rescanning
the pack list and consequently rereading of packfile content.

Change-Id: I67682cfb807c58afc6de9375224ff7489d6618fb
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoEnhance fsTick() to use filesystem timer resolution 85/143285/2
Christian Halstrick [Tue, 4 Jun 2019 16:03:26 +0000 (18:03 +0200)]
Enhance fsTick() to use filesystem timer resolution

RepositoryTestCase.fsTick() was was waiting 64, 128, 256, ... milliseconds
until it detected that the filesystem timer has ticked. Make use of
the filesystemtimer resolution information in FS to sleep a fraction
of the filesystem timer resolution. That raises probability to wake up
shortly after the filesystem timer has ticked.

Change-Id: Ibcc38576e42ece13b2fd4423a29c459eed167a69

5 years agoAdd debug trace to measure time needed to open pack index 75/143275/4
Matthias Sohn [Tue, 4 Jun 2019 13:46:44 +0000 (15:46 +0200)]
Add debug trace to measure time needed to open pack index

Change-Id: Ia698cc06aa3fe6cb7903a687db8885f1b83c3bf2
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoExtend FileSnapshot for packfiles to also use checksum to detect changes 34/142834/18
Matthias Sohn [Sun, 26 May 2019 20:40:47 +0000 (22:40 +0200)]
Extend FileSnapshot for packfiles to also use checksum to detect changes

If the attributes of FileSnapshot don't detect modification of a
packfile read the packfile's checksum and compare it against the
checksum cached in the loaded packfile.

Since reading the checksum needs less IO than reloading the complete
packfile this may help to reduce the overhead to detect modficiation
when a gc completes while ObjectDirectory scans for packfiles in another
thread.

Bug: 546891
Change-Id: I9811b497eb11b8a85ae689081dc5d949ca8c4be5
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoWait opening new packfile until it can't be racy anymore 43/141843/20
Matthias Sohn [Wed, 8 May 2019 23:23:15 +0000 (01:23 +0200)]
Wait opening new packfile until it can't be racy anymore

If
- pack.waitPreventRacyPack = true (default is false)
- packfile size > pack.minSizePreventRacyPack (default is 100 MB)
wait after a new packfile was written and before it is opened until it
cannot be racy anymore.

If a new packfile is accessed while it's still racy at least the pack's
index will be reread by ObjectDirectory.scanPacksImpl(). Hence it may
save resources to wait one tick of the file system timer to avoid this
reloading. On filesystems with a coarse timestamp resolution it may be
beneficial to skip this wait for small packfiles.

Bug: 546891
Change-Id: I0e8bf3d7677a025edd2e397dd2c9134ba59b1a18
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoUpdate to Orbit R20190602212107 93/143193/2
Matthias Sohn [Mon, 3 Jun 2019 07:55:20 +0000 (09:55 +0200)]
Update to Orbit R20190602212107

This version fixed wrong
Require-Capability: osgi.ee; filter:="(&(osgi.ee=JavaSE)(version=9))"
in bouncycastle 1.61.

Bug: 547570
Change-Id: I715bcc4b39c3d4ad036dcc5bbdf48d321759f55f
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoPacketLineIn: Deprecate the END constant 76/143176/3
David Pursehouse [Sun, 2 Jun 2019 08:27:17 +0000 (17:27 +0900)]
PacketLineIn: Deprecate the END constant

Deprecate the constant with the intention of making it private in
a future release.

All existing usage of the constant within JGit code has already been
replaced with the recommended alternatives in preceding commits.

Change-Id: I10eb95f3f92cb74f93a26bf1a6edd24615b75c6f
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
5 years agoPacketLineIn: Add an iterator over strings in the input stream 75/143175/3
David Pursehouse [Sun, 2 Jun 2019 08:02:51 +0000 (17:02 +0900)]
PacketLineIn: Add an iterator over strings in the input stream

Allows callers to read all lines in the input stream until the
END marker is reached, without having to explicitly check for
the END marker.

Replace all remaining usage of the END marker with the new method.

Change-Id: I51f419c7f569ab7ed01e1aaaf6b40ed8cdc2116b
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
5 years agoReplace most usages of PacketLineIn.END with PacketLineIn.end() 73/143173/3
David Pursehouse [Sun, 2 Jun 2019 03:50:34 +0000 (12:50 +0900)]
Replace most usages of PacketLineIn.END with PacketLineIn.end()

PacketLineIn.END is only referenced in tests. Replace most of those
with a new package visible end() method.

Remaining usages of PacketLineIn.END are in the form:

  while ((line = pckIn.readString()) != PacketLineIn.END) {

and are not trivial replacements, hence are not touched in this change.

Change-Id: Id77c5321ddcad127130b246bde8f08736e60e1ea
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>