]> source.dussan.org Git - jgit.git/log
jgit.git
3 years ago[spotbugs] Fix potential NPE in WorkingTreeIterator#isModified 67/173367/4
Matthias Sohn [Thu, 3 Dec 2020 01:04:36 +0000 (02:04 +0100)]
[spotbugs] Fix potential NPE in WorkingTreeIterator#isModified

File#list can return null. Fix the potential NPE by using Files#list
which is also faster since it retrieves directory entries lazily while
File#list retrieves them eagerly.

Change-Id: Idf4bda398861c647587e357326b8bc8b587a2584
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years ago[spotbugs] Fix potential NPE in FileBasedConfigTest 66/173366/4
Matthias Sohn [Thu, 3 Dec 2020 00:54:25 +0000 (01:54 +0100)]
[spotbugs] Fix potential NPE in FileBasedConfigTest

Path#getParent can return null. Fix the warning by implementing a helper
method which asserts the parent is not null.

Change-Id: Ib4f8dff0674b74bc891f15f08bd9755c5ea728dc
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years ago[spotbugs] Fix potential NPE in GcPruneNonReferencedTest 65/173365/4
Matthias Sohn [Thu, 3 Dec 2020 00:49:18 +0000 (01:49 +0100)]
[spotbugs] Fix potential NPE in GcPruneNonReferencedTest

File#listFiles can return null, assert it is not null to fix the
warning.

Change-Id: I28fc668fee760d39965e6e039003ac9f85fd461b
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years ago[spotbugs] Fix potential NPE in FileRepository#convertToReftable 64/173364/3
Matthias Sohn [Thu, 3 Dec 2020 00:44:58 +0000 (01:44 +0100)]
[spotbugs] Fix potential NPE in FileRepository#convertToReftable

File#listFiles can return null. Use Files#list which does not return
null and should be faster since it's returning directory entries lazily
while File#listFiles fetches them eagerly.

Change-Id: I3bfe2a52278244fc469143692c06b05d9af0d0d4
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years ago[spotbugs] silence warnings for intended use of == to compare strings 87/172987/4
Matthias Sohn [Sun, 29 Nov 2020 21:03:42 +0000 (22:03 +0100)]
[spotbugs] silence warnings for intended use of == to compare strings

Change-Id: Ib6967ad4deb5cf233d1f1d714cd094da5fad48e3
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years ago[spotbugs] silence short-circuit warning in PackOutputStream#write 86/172986/4
Matthias Sohn [Sun, 29 Nov 2020 20:46:09 +0000 (21:46 +0100)]
[spotbugs] silence short-circuit warning in PackOutputStream#write

Change-Id: I47b7a7991afae0dd1e678bd5e1f8e81599791e5f
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years ago[spotbugs] parse time using thread-safe DateTimeFormatter 85/172985/4
Matthias Sohn [Sun, 29 Nov 2020 20:43:51 +0000 (21:43 +0100)]
[spotbugs]  parse time using thread-safe DateTimeFormatter

LfsConnectionFactory used a static SimpleDateFormat which isn't
thread-safe. Use DateTimeFormatter instead to fix this.

Change-Id: Id580251c999e1e412c269f37b29860d310124c89
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years agoFetchProcess#execute: fix formatting 71/172971/5
Matthias Sohn [Sun, 29 Nov 2020 00:24:08 +0000 (01:24 +0100)]
FetchProcess#execute: fix formatting

Change-Id: I133af64e6b165bdc58b8d7c805f0c68b6919baf2
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years ago[errorprone] FetchProcess: ensure exception isn't suppressed 70/172970/5
Matthias Sohn [Sat, 28 Nov 2020 23:34:41 +0000 (00:34 +0100)]
[errorprone] FetchProcess: ensure exception isn't suppressed

If TransportException is thrown in the finally block of execute()
ensure that the exception handled in the previous catch block isn't
suppressed.

Change-Id: I670acdfb4d36e7a419a9a79ae9faab2e085a43ee
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years ago[errorprone] WalkFetchConnection: ensure exception isn't suppressed 69/172969/5
Matthias Sohn [Sat, 28 Nov 2020 23:29:08 +0000 (00:29 +0100)]
[errorprone] WalkFetchConnection: ensure exception isn't suppressed

If TransportException is thrown in the finally block of
downloadPackedObject() ensure that the exception handled in the previous
catch block isn't suppressed.

Change-Id: I23982a2b215e38f681cc1719788985e60232699a
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years agoRemove unused API problem filters 95/173795/1
Matthias Sohn [Tue, 15 Dec 2020 00:47:23 +0000 (01:47 +0100)]
Remove unused API problem filters

Change-Id: I982f21dfaec4e35818eca7a4793e24a2cec4e467
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years agoRemove reftree and ketch 41/152841/2
Han-Wen Nienhuys [Sun, 17 Nov 2019 17:51:14 +0000 (09:51 -0800)]
Remove reftree and ketch

This was experimental code and never used in production.

Change-Id: Ia3da7f2b82d9e365cec2ccf9397cbc47439cd150
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years agoLsRemote: suppress warning for non-externalized string 94/173794/1
Matthias Sohn [Tue, 15 Dec 2020 00:53:01 +0000 (01:53 +0100)]
LsRemote: suppress warning for non-externalized string

Change-Id: Ic1d8f2eef4a8de0a75d5b523b584b1ac275a8811
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years agoLooseObjects: fix formatting 93/173793/1
Matthias Sohn [Tue, 15 Dec 2020 01:00:17 +0000 (02:00 +0100)]
LooseObjects: fix formatting

Change-Id: I992e5066d1dc4603e5bae991b26605d319f5cdc2
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years agoSplit out loose object handling from ObjectDirectory 60/122060/6
Martin Fick [Thu, 26 Apr 2018 16:53:57 +0000 (10:53 -0600)]
Split out loose object handling from ObjectDirectory

The ObjectDirectory class manages the interactions for the entire object
database, this includes loose objects, packfiles, alternates, and
shallow commits. To help reduce the complexity of this class, abstract
some of the loose object specific details into a class which understands
just this, leaving the ObjectDirectory to focus more on the interactions
between the different mechanisms.

Change-Id: I39f3a74d6308f042a2a2baa57769f4acde5ba5e0
Signed-off-by: Martin Fick <mfick@codeaurora.org>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years agoMerge branch 'stable-5.9' 56/173756/1
Matthias Sohn [Mon, 14 Dec 2020 15:03:00 +0000 (16:03 +0100)]
Merge branch 'stable-5.9'

* stable-5.9:
  Fix stamping to produce stable file timestamps

Change-Id: Icd092cd9b883556fcbd115c17346a9d88dc172ce
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years agoFix stamping to produce stable file timestamps 23/173523/3
David Ostrovsky [Sat, 5 Dec 2020 13:48:23 +0000 (14:48 +0100)]
Fix stamping to produce stable file timestamps

Change-Id: I628ab5feb4a70f81ec832f1b81d1ad3a9caca615

3 years agoPackDirectory: fix formatting 27/173727/1
Matthias Sohn [Sat, 12 Dec 2020 22:32:09 +0000 (23:32 +0100)]
PackDirectory: fix formatting

Change-Id: I10586981323529c7e9041110ebb58033e7180194
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years agoSplit out packfile handling from ObjectDirectory 59/122059/6
Martin Fick [Wed, 25 Apr 2018 17:59:21 +0000 (11:59 -0600)]
Split out packfile handling from ObjectDirectory

The ObjectDirectory class manages the interactions for the entire object
database, this includes loose objects, packfiles, alternates, and
shallow commits. To help reduce the complexity of this class, abstract
some of the packfile specific details into a class which understands
just this, leaving the ObjectDirectory to focus more on the interactions
between the different mechanisms.

Change-Id: I5cc87b964434b0afa860b3fe23867a77b3c3a4f2
Signed-off-by: Martin Fick <mfick@codeaurora.org>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years agoTagCommand: propagate NO_CHANGE information 38/173538/2
Thomas Wolf [Tue, 8 Dec 2020 14:45:35 +0000 (15:45 +0100)]
TagCommand: propagate NO_CHANGE information

Some clients may wish to allow NO_CHANGE lightweight tag updates
without setting the force flag. (For instance EGit does so.)
Command-line git does not allow this.

Propagate the RefUpdate result via the RefAlreadyExistsException.
That way a client has the possibility to catch it and check the
failure reason without having to parse the exception message, and
take appropriate action, like ignoring the exception on NO_CHANGE.

Change-Id: I60e7a15a3c309db4106cab87847a19b6d24866f6
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
3 years agoTagCommand: make -f work with lightweight tags for NO_CHANGE 33/173533/3
Thomas Wolf [Tue, 8 Dec 2020 13:52:00 +0000 (14:52 +0100)]
TagCommand: make -f work with lightweight tags for NO_CHANGE

JGit treated a NO_CHANGE RefUpdate as an error in all cases. But when
updating a lightweight tag, this is a successful result if -f was
specified.

Change-Id: Iddfa6d6a6dc8bf8fed81138a008ebc32d5f960bd
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
3 years agoMerge branch 'stable-5.10' 58/173558/1
Matthias Sohn [Tue, 8 Dec 2020 20:00:16 +0000 (21:00 +0100)]
Merge branch 'stable-5.10'

* stable-5.10:
  Prepare 5.10.1-SNAPSHOT builds
  JGit v5.10.0.202012080955-r

Change-Id: I751f55944d2aebbd622dda8acd8c113208a972eb
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years agoPrepare 5.10.1-SNAPSHOT builds 56/173556/1
Matthias Sohn [Tue, 8 Dec 2020 16:35:15 +0000 (17:35 +0100)]
Prepare 5.10.1-SNAPSHOT builds

Change-Id: If1e44edfa0a80a29c00ed5112291d1338baf56f1
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years agoJGit v5.10.0.202012080955-r 42/173542/1 v5.10.0.202012080955-r
Matthias Sohn [Tue, 8 Dec 2020 14:56:08 +0000 (15:56 +0100)]
JGit v5.10.0.202012080955-r

Change-Id: I7ca88bcc54992625a6fafd84172adee58d487dc3
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years agoTagCommand: support signing annotated tags 39/173439/3
Thomas Wolf [Sat, 5 Dec 2020 21:01:25 +0000 (22:01 +0100)]
TagCommand: support signing annotated tags

Add the two config constants from C git that can switch on signing
of annotated tags. Add them to the GpgConfig, and implement actually
signing a tag in TagCommand.

The interactions between command line options for "git tag" and config
options is a bit murky in C git. There are two config settings for it:

* tag.gpgSign is the main option, if set to true, it kicks in if
  neither -s nor -u are given on the command line.
* tag.forceSignAnnotated signs only tags created via "git tag -m",
  but only if command-line option "-a" is not present. It applies
  even if tag.gpgSign is set explicitly to false.

Giving -s or -u on the command line also forces an annotated tag
since lightweight tags cannot be signed.

Bug: 386908
Change-Id: Ic8a1a44b5f12f47d5cdf3aae2456c1f6ca9ef057
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
3 years agoEnable GpgSigner to also sign tags 38/173438/3
Thomas Wolf [Sat, 5 Dec 2020 20:55:29 +0000 (21:55 +0100)]
Enable GpgSigner to also sign tags

Factor out a common ObjectBuilder as super class of CommitBuilder
and TagBuilder, and make the GpgSigner work on ObjectBuilder.

In order not to break API, add the new method for signing an
ObjectBuilder in a new interface GpgObjectSigner.

The signature for a tag is just tacked onto the end of the tag
message. The message of a signed tag must end in LF.

Bug: 386908
Change-Id: I5e021e3c927f4051825cd7355b129113b949455e
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
3 years agoMerge branch 'stable-5.10' 78/173278/1
Matthias Sohn [Wed, 2 Dec 2020 23:51:23 +0000 (00:51 +0100)]
Merge branch 'stable-5.10'

* stable-5.10:
  Prepare 5.10.0-SNAPSHOT builds
  JGit v5.10.0.202012021225-rc1
  Don't install 3rd party dependency bundles via features

Change-Id: Ia901830d1057667dc8e78d235c63f84373f8887b

3 years agoPrepare 5.10.0-SNAPSHOT builds 63/173263/1
Matthias Sohn [Wed, 2 Dec 2020 20:01:52 +0000 (21:01 +0100)]
Prepare 5.10.0-SNAPSHOT builds

Change-Id: I9cc9fa32a737b4916cdb5b52bac8f724ebee09bc
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years agoJGit v5.10.0.202012021225-rc1 61/173261/1 v5.10.0.202012021225-rc1
Matthias Sohn [Wed, 2 Dec 2020 17:25:20 +0000 (18:25 +0100)]
JGit v5.10.0.202012021225-rc1

Change-Id: Ic774356e09bb9d24e5d99334bd4ea173bd4071ec
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years agoDon't install 3rd party dependency bundles via features 55/173255/1
Matthias Sohn [Fri, 2 Oct 2020 19:54:53 +0000 (21:54 +0200)]
Don't install 3rd party dependency bundles via features

Instead provide them only in the p2 repository. This way they are
available when installing from the jgit p2 repository but we are not
enforcing the version we bring but can also use the version available in
Eclipse if it matches our requirements.

Bug: 514326
Bug: 566475
Change-Id: I3e8d0bad12cfb0c1003ade3e6f13e9af35626f14
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years agoPrepare 5.11.0-SNAPSHOT builds 43/173243/1
Matthias Sohn [Wed, 2 Dec 2020 14:57:16 +0000 (15:57 +0100)]
Prepare 5.11.0-SNAPSHOT builds

Change-Id: I91e5532526775191fbd34f81e2ef777cba605e3b
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years agoMerge branch 'master' into stable-5.10 38/173238/1
Matthias Sohn [Wed, 2 Dec 2020 14:49:35 +0000 (15:49 +0100)]
Merge branch 'master' into stable-5.10

* master:
  Prepare 5.3.10-SNAPSHOT builds
  JGit v5.3.9.202012012026-r
  Prepare 5.1.16-SNAPSHOT builds
  JGit v5.1.15.202012011955-r
  Fix PackInvalidException when fetch and repack run concurrently
  Upgrade maven-pmd-plugin to 3.14.0
  Update Orbit to R20201130205003 for 2020-12
  Use new protocol version constants
  PacketLineInTest: test for END and DELIM being distinguishable
  Add constants for parsing git wire protocol version
  Ignore missing javadoc tags in test bundles
  Bazel: Allow to build and run the tests with JDK 15
  [releng] japicmp: update last release version
  Add support for reading symrefs from pack capabilities

Change-Id: I5afbbb912f502991f0cf9c2501b024f5f00144ba
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years agoMerge branch 'stable-5.9' 37/173237/1
Matthias Sohn [Wed, 2 Dec 2020 14:33:52 +0000 (15:33 +0100)]
Merge branch 'stable-5.9'

* stable-5.9:
  Prepare 5.3.10-SNAPSHOT builds
  JGit v5.3.9.202012012026-r
  Prepare 5.1.16-SNAPSHOT builds
  JGit v5.1.15.202012011955-r
  Fix PackInvalidException when fetch and repack run concurrently

Change-Id: I3cf6c71e8310c1d7ef333d4a9c23fa41f45118c4
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years agoMerge branch 'stable-5.8' into stable-5.9 34/173234/1
Matthias Sohn [Wed, 2 Dec 2020 14:31:00 +0000 (15:31 +0100)]
Merge branch 'stable-5.8' into stable-5.9

* stable-5.8:
  Prepare 5.3.10-SNAPSHOT builds
  JGit v5.3.9.202012012026-r
  Prepare 5.1.16-SNAPSHOT builds
  JGit v5.1.15.202012011955-r
  Fix PackInvalidException when fetch and repack run concurrently

Change-Id: I08caea979ac4c1298b453e6e5558bccb86fb0181
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years agoMerge branch 'stable-5.7' into stable-5.8 33/173233/1
Matthias Sohn [Wed, 2 Dec 2020 14:28:33 +0000 (15:28 +0100)]
Merge branch 'stable-5.7' into stable-5.8

* stable-5.7:
  Prepare 5.3.10-SNAPSHOT builds
  JGit v5.3.9.202012012026-r
  Prepare 5.1.16-SNAPSHOT builds
  JGit v5.1.15.202012011955-r
  Fix PackInvalidException when fetch and repack run concurrently

Change-Id: I638ee6409f25ac8bcb2e365b1c37939b520b289f

3 years agoMerge branch 'stable-5.6' into stable-5.7 32/173232/1
Matthias Sohn [Wed, 2 Dec 2020 14:25:44 +0000 (15:25 +0100)]
Merge branch 'stable-5.6' into stable-5.7

* stable-5.6:
  Prepare 5.3.10-SNAPSHOT builds
  JGit v5.3.9.202012012026-r
  Prepare 5.1.16-SNAPSHOT builds
  JGit v5.1.15.202012011955-r
  Fix PackInvalidException when fetch and repack run concurrently

Change-Id: If5f001c414e677bb2bac59714421f0191b23ea1f
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years agoMerge branch 'stable-5.5' into stable-5.6 31/173231/1
Matthias Sohn [Wed, 2 Dec 2020 14:21:10 +0000 (15:21 +0100)]
Merge branch 'stable-5.5' into stable-5.6

* stable-5.5:
  Prepare 5.3.10-SNAPSHOT builds
  JGit v5.3.9.202012012026-r
  Prepare 5.1.16-SNAPSHOT builds
  JGit v5.1.15.202012011955-r
  Fix PackInvalidException when fetch and repack run concurrently

Change-Id: I986029816ef66fbfae1a59bd97179392320a485c
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years agoMerge branch 'stable-5.4' into stable-5.5 30/173230/1
Matthias Sohn [Wed, 2 Dec 2020 14:15:58 +0000 (15:15 +0100)]
Merge branch 'stable-5.4' into stable-5.5

* stable-5.4:
  Prepare 5.3.10-SNAPSHOT builds
  JGit v5.3.9.202012012026-r
  Prepare 5.1.16-SNAPSHOT builds
  JGit v5.1.15.202012011955-r
  Fix PackInvalidException when fetch and repack run concurrently

Change-Id: Iede8686198332d6271771bef6eb00c25f1103979
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years agoMerge branch 'stable-5.3' into stable-5.4 27/173227/1
Matthias Sohn [Wed, 2 Dec 2020 13:26:26 +0000 (14:26 +0100)]
Merge branch 'stable-5.3' into stable-5.4

* stable-5.3:
  Prepare 5.3.10-SNAPSHOT builds
  JGit v5.3.9.202012012026-r
  Prepare 5.1.16-SNAPSHOT builds
  JGit v5.1.15.202012011955-r
  Fix PackInvalidException when fetch and repack run concurrently

Change-Id: I319b54ceffe095add60420c6ae83eac0ba9c14b6
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years agoPrepare 5.3.10-SNAPSHOT builds 25/173225/1
Matthias Sohn [Wed, 2 Dec 2020 12:09:57 +0000 (13:09 +0100)]
Prepare 5.3.10-SNAPSHOT builds

Change-Id: I6f131ad04574bd0d569ae6a59c29ea987be0efb2
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years agoJGit v5.3.9.202012012026-r 89/173189/1 v5.3.9.202012012026-r
Matthias Sohn [Wed, 2 Dec 2020 01:27:44 +0000 (02:27 +0100)]
JGit v5.3.9.202012012026-r

Change-Id: I75e03ef8630d7a369e97be0f797253b968575354
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years agoMerge branch 'stable-5.2' into stable-5.3 88/173188/1
Matthias Sohn [Wed, 2 Dec 2020 01:18:51 +0000 (02:18 +0100)]
Merge branch 'stable-5.2' into stable-5.3

* stable-5.2:
  Prepare 5.1.16-SNAPSHOT builds
  JGit v5.1.15.202012011955-r
  Fix PackInvalidException when fetch and repack run concurrently

Change-Id: If1d8034b5e0cbc004a11a31b228cb5732efb390d
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years agoMerge branch 'stable-5.1' into stable-5.2 87/173187/1
Matthias Sohn [Wed, 2 Dec 2020 01:17:27 +0000 (02:17 +0100)]
Merge branch 'stable-5.1' into stable-5.2

* stable-5.1:
  Prepare 5.1.16-SNAPSHOT builds
  JGit v5.1.15.202012011955-r
  Fix PackInvalidException when fetch and repack run concurrently

Change-Id: Id83e29e567646a3945a5b817860ea8f7c3e6e5cf
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years agoPrepare 5.1.16-SNAPSHOT builds 86/173186/1
Matthias Sohn [Wed, 2 Dec 2020 01:02:48 +0000 (02:02 +0100)]
Prepare 5.1.16-SNAPSHOT builds

Change-Id: I50e59e1e73a92fa4fe366398fb8141f5e2e289c1
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years agoJGit v5.1.15.202012011955-r 85/173185/1 v5.1.15.202012011955-r
Matthias Sohn [Wed, 2 Dec 2020 00:53:39 +0000 (01:53 +0100)]
JGit v5.1.15.202012011955-r

Change-Id: Icb4f04a40ab366cbacbb3fdf0db1748f27277fda
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years agoFix PackInvalidException when fetch and repack run concurrently 40/173040/4
Petr Hrebejk [Mon, 30 Nov 2020 19:19:53 +0000 (20:19 +0100)]
Fix PackInvalidException when fetch and repack run concurrently

We are running several servers with jGit. We need to run repack from
time to time to keep the repos performant. I.e. after push we test how
many small packs are in the repo and when a threshold is reached we run
the repack.

After upgrading jGit version we've found that if someone does the clone
at the time repack is running the clone sometimes (not always) fails
because the repack removes .pack file used by the clone. Server
exception and client error attached.

I've tracked down the cause and it seems to be introduced between jGit
5.2 (which we upgraded from) and 5.3 and being caused by this commit:
Move throw of PackInvalidException outside the catch -
https://github.com/eclipse/jgit/commit/afef866a44cd65fef292c174cad445b3fb526400

The problem is that when the throw was inside of the try block the last
catch block catched the exception and called openFailed(false) method.
It is true that it called it with invalidate = false, which is wrong.
The real problem though is that with the throw outside of the try block
the openFail is not called at all and the fields activeWindows and
activeCopyRawData are not set to 0. Which affects the later called tests
like: if (++activeCopyRawData == 1 && activeWindows == 0).

The fix for this is relatively simple keeping the throw outside of the
try block and still having the invalid field set to true. I did
exhaustive testing of the change running concurrent clones and pushes
indefinitely and with the patch applied it never fails while without the
patch it takes relatively short to get the error.

See: https://www.eclipse.org/lists/jgit-dev/msg04014.html

Bug: 569349
Change-Id: I9dbf8801c8d3131955ad7124f42b62095d96da54
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years agoUpgrade maven-pmd-plugin to 3.14.0 82/172682/4
Marco Miller [Mon, 23 Nov 2020 14:16:11 +0000 (09:16 -0500)]
Upgrade maven-pmd-plugin to 3.14.0

Change-Id: I45b49e1262db50e74b43c6273d3b3df692765330
Signed-off-by: Marco Miller <marco.miller@ericsson.com>
3 years agoUpdate Orbit to R20201130205003 for 2020-12 77/173177/1
Matthias Sohn [Tue, 1 Dec 2020 20:32:35 +0000 (21:32 +0100)]
Update Orbit to R20201130205003 for 2020-12

Change-Id: I9a563d6f125e9a3983990b8a111d3288c9100162
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years agoUse new protocol version constants 25/173025/2
Matthias Sohn [Mon, 30 Nov 2020 15:44:05 +0000 (16:44 +0100)]
Use new protocol version constants

Change-Id: Icd6b876e392c55a7322a990ac7f618250b732b4b
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years agoMerge branch 'stable-5.9' 19/173019/3
Matthias Sohn [Mon, 30 Nov 2020 14:29:01 +0000 (15:29 +0100)]
Merge branch 'stable-5.9'

* stable-5.9:
  Add constants for parsing git wire protocol version

Change-Id: I1e4174ae8bbefcb71a191dcbf32027d4b35c2b37
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years agoPacketLineInTest: test for END and DELIM being distinguishable 12/173012/1
Thomas Wolf [Mon, 30 Nov 2020 12:02:18 +0000 (13:02 +0100)]
PacketLineInTest: test for END and DELIM being distinguishable

Explicitly test that END and DELIM can be distinguished. If not, the
wire protocol V2 breaks down.

Bug: 568950
Change-Id: I5f3496168244303c68893f1c756831dd27440aeb
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
3 years agoAdd constants for parsing git wire protocol version 79/172979/3
David Ostrovsky [Sun, 29 Nov 2020 12:06:00 +0000 (13:06 +0100)]
Add constants for parsing git wire protocol version

This would allow other JGit users to access and reuse the constants.

Change-Id: I1608802f45586af5f8582afa592e26679e9cebe3
Signed-off-by: David Ostrovsky <david@ostrovsky.org>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years agoIgnore missing javadoc tags in test bundles 68/172968/3
Matthias Sohn [Thu, 19 Nov 2020 00:55:35 +0000 (01:55 +0100)]
Ignore missing javadoc tags in test bundles

It seems Eclipse 4.18 reports them as error whereas earlier versions
ignored this maybe since we don't require javadoc comments for all the
test bundles.

Change-Id: I3f4d42ce681ea5c2b4b302991d2641290ac8561d
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years agoBazel: Allow to build and run the tests with JDK 15 99/172699/2
David Ostrovsky [Mon, 23 Nov 2020 19:04:07 +0000 (20:04 +0100)]
Bazel: Allow to build and run the tests with JDK 15

To avoid JDK specific bugs in future, like Bug: 568950, and given that
upcoming Bazel release 4.0.0 added support to JDK 15 java toolchain,
add definition for remote JDK 15 to WORKSPACE file and add build and
test instructions.

To build and execute the tests with JDK 15 on Linux run:

  $ bazelisk test \
    --java_toolchain=@remote_java_tools_linux//:toolchain_jdk_15 \
    --host_java_toolchain=@remote_java_tools_linux//:toolchain_jdk_15 \
    --javabase=@openjdk15_linux_archive//:runtime \
    --host_javabase=@openjdk15_linux_archive//:runtime \
    //...

To build and execute the tests with JDK 15 on Mac Os X run:

  $ bazelisk test \
    --java_toolchain=@remote_java_tools_darwin//:toolchain_jdk_15 \
    --host_java_toolchain=@remote_java_tools_darwin//:toolchain_jdk_15 \
    --javabase=@openjdk15_darwin_archive//:runtime \
    --host_javabase=@openjdk15_darwin_archive//:runtime \
    //...

To skip the options on the command line, put them in ~/.bazelrc file:

  build --java_toolchain=@remote_java_tools_linux//:toolchain_jdk_15
  build --host_java_toolchain=@remote_java_tools_linux//:toolchain_jdk_15
  build --javabase=@openjdk15_linux_archive//:runtime
  build --host_javabase=@openjdk15_linux_archive//:runtime

Change-Id: I79d5e99f0c731847a82ce7d4c410855434d85f8d
Signed-off-by: David Ostrovsky <david@ostrovsky.org>
3 years ago[releng] japicmp: update last release version 66/172966/1
Thomas Wolf [Sat, 28 Nov 2020 18:58:23 +0000 (19:58 +0100)]
[releng] japicmp: update last release version

The baseline for the 5.10 release is 5.9.0.202009080501-r.

Change-Id: I0071e4930c54e4a27cccb1d96842c86c3422dfbf
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
3 years agoMerge branch 'stable-5.10' 52/172952/1
Matthias Sohn [Fri, 27 Nov 2020 09:58:43 +0000 (10:58 +0100)]
Merge branch 'stable-5.10'

* stable-5.10:
  Remove unused imports
  Silence API warnings
  Remove erraneously merged source features
  Prepare 5.3.9-SNAPSHOT builds
  JGit v5.3.8.202011260953-r
  Prepare 5.1.15-SNAPSHOT builds
  JGit v5.1.14.202011251942-r
  GC#deleteOrphans: log warning for deleted orphaned files
  GC#deleteOrphans: handle failure to list files in pack directory
  Ensure that GC#deleteOrphans respects pack lock
  PacketLineIn: ensure that END != DELIM
  Update API warning filters
  Remove unused imports

Change-Id: I25f50c3807a4e6b22a264320ea7ed3758e2a75ec
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years agoMerge branch 'stable-5.9' into stable-5.10 51/172951/1
Matthias Sohn [Fri, 27 Nov 2020 09:10:35 +0000 (10:10 +0100)]
Merge branch 'stable-5.9' into stable-5.10

* stable-5.9:
  Remove unused imports
  Silence API warnings
  Remove erraneously merged source features
  Prepare 5.3.9-SNAPSHOT builds
  JGit v5.3.8.202011260953-r
  Prepare 5.1.15-SNAPSHOT builds
  JGit v5.1.14.202011251942-r
  GC#deleteOrphans: log warning for deleted orphaned files
  GC#deleteOrphans: handle failure to list files in pack directory
  Ensure that GC#deleteOrphans respects pack lock
  PacketLineIn: ensure that END != DELIM
  Update API warning filters
  Remove unused imports

Change-Id: Icf415ac5bab2f69f71189c942424ee69f8a64d4e
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years agoMerge branch 'stable-5.8' into stable-5.9 16/172916/1
Matthias Sohn [Fri, 27 Nov 2020 08:38:30 +0000 (09:38 +0100)]
Merge branch 'stable-5.8' into stable-5.9

* stable-5.8:
  Remove unused imports
  Silence API warnings
  Remove erraneously merged source features
  Prepare 5.3.9-SNAPSHOT builds
  JGit v5.3.8.202011260953-r
  Prepare 5.1.15-SNAPSHOT builds
  JGit v5.1.14.202011251942-r
  GC#deleteOrphans: log warning for deleted orphaned files
  GC#deleteOrphans: handle failure to list files in pack directory
  Ensure that GC#deleteOrphans respects pack lock
  PacketLineIn: ensure that END != DELIM
  Update API warning filters
  Remove unused imports

Change-Id: I70b399eb3df02aa2fb112e86e844cf5a0daa5515
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years agoMerge branch 'stable-5.7' into stable-5.8 15/172915/1
Matthias Sohn [Fri, 27 Nov 2020 08:07:00 +0000 (09:07 +0100)]
Merge branch 'stable-5.7' into stable-5.8

* stable-5.7:
  Remove unused imports
  Silence API warnings
  Remove erraneously merged source features
  Prepare 5.3.9-SNAPSHOT builds
  JGit v5.3.8.202011260953-r
  Prepare 5.1.15-SNAPSHOT builds
  JGit v5.1.14.202011251942-r
  GC#deleteOrphans: log warning for deleted orphaned files
  GC#deleteOrphans: handle failure to list files in pack directory
  Ensure that GC#deleteOrphans respects pack lock
  Update API warning filters
  Remove unused imports

Change-Id: I9b94938f5c09bd726e8e368c98c56da8280fd0b2
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years agoMerge branch 'stable-5.6' into stable-5.7 13/172913/1
Matthias Sohn [Fri, 27 Nov 2020 02:05:22 +0000 (03:05 +0100)]
Merge branch 'stable-5.6' into stable-5.7

* stable-5.6:
  Remove unused imports
  Silence API warnings
  Remove erraneously merged source features

Change-Id: Iad4da36d82e8a4dad965c0de52910a4ce4e2d2da
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years agoMerge branch 'stable-5.5' into stable-5.6 12/172912/1
Matthias Sohn [Fri, 27 Nov 2020 02:04:00 +0000 (03:04 +0100)]
Merge branch 'stable-5.5' into stable-5.6

* stable-5.5:
  Remove unused imports
  Silence API warnings
  Remove erraneously merged source features

Change-Id: Ifb6ebe56577719c0dfc6425557130b91e510d5c7
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years agoMerge branch 'stable-5.4' into stable-5.5 11/172911/1
Matthias Sohn [Fri, 27 Nov 2020 01:37:17 +0000 (02:37 +0100)]
Merge branch 'stable-5.4' into stable-5.5

* stable-5.4:
  Remove unused imports
  Silence API warnings
  Remove erraneously merged source features

Change-Id: I25eff574e4c1cd0aef7cf2c685aade2f87fb0409
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years agoRemove unused imports 05/172905/1
Matthias Sohn [Fri, 27 Nov 2020 01:27:25 +0000 (02:27 +0100)]
Remove unused imports

Change-Id: Id78f4fd7d11a8908f41160a2ab9f3d81b7f771da
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years agoSilence API warnings 04/172904/1
Matthias Sohn [Fri, 27 Nov 2020 01:26:23 +0000 (02:26 +0100)]
Silence API warnings

Change-Id: I5de476935e79f8f0beefc27885cbc3ffe31c0aed
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years agoRemove erraneously merged source features 03/172903/1
Matthias Sohn [Fri, 27 Nov 2020 01:20:00 +0000 (02:20 +0100)]
Remove erraneously merged source features

In 5.4 source features were combined into a single feature.

Change-Id: I4055ec805bb036d0f445c8b9b0bb670495a32cc0
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years agoMerge branch 'stable-5.6' into stable-5.7 98/172898/1
Matthias Sohn [Fri, 27 Nov 2020 00:02:49 +0000 (01:02 +0100)]
Merge branch 'stable-5.6' into stable-5.7

* stable-5.6:
  Prepare 5.3.9-SNAPSHOT builds
  JGit v5.3.8.202011260953-r
  Prepare 5.1.15-SNAPSHOT builds
  JGit v5.1.14.202011251942-r
  GC#deleteOrphans: log warning for deleted orphaned files
  GC#deleteOrphans: handle failure to list files in pack directory
  Ensure that GC#deleteOrphans respects pack lock
  Update API warning filters
  Remove unused imports

Change-Id: Ie24d381f295cccfb99068c7ed5817179da29c1db
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years agoMerge branch 'stable-5.5' into stable-5.6 97/172897/1
Matthias Sohn [Fri, 27 Nov 2020 00:01:17 +0000 (01:01 +0100)]
Merge branch 'stable-5.5' into stable-5.6

* stable-5.5:
  Prepare 5.3.9-SNAPSHOT builds
  JGit v5.3.8.202011260953-r
  Prepare 5.1.15-SNAPSHOT builds
  JGit v5.1.14.202011251942-r
  GC#deleteOrphans: log warning for deleted orphaned files
  GC#deleteOrphans: handle failure to list files in pack directory
  Ensure that GC#deleteOrphans respects pack lock
  Update API warning filters
  Remove unused imports

Change-Id: I00c8ddad0059a20a978743dfb7ad1b513dc7fef6
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years agoMerge branch 'stable-5.4' into stable-5.5 96/172896/1
Matthias Sohn [Thu, 26 Nov 2020 23:40:00 +0000 (00:40 +0100)]
Merge branch 'stable-5.4' into stable-5.5

* stable-5.4:
  Prepare 5.3.9-SNAPSHOT builds
  JGit v5.3.8.202011260953-r
  Prepare 5.1.15-SNAPSHOT builds
  JGit v5.1.14.202011251942-r
  GC#deleteOrphans: log warning for deleted orphaned files
  GC#deleteOrphans: handle failure to list files in pack directory
  Ensure that GC#deleteOrphans respects pack lock
  Update API warning filters
  Remove unused imports

Change-Id: Icc34f809a3bb019d8d640b9bdb71363e617942e2
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years agoMerge branch 'stable-5.3' into stable-5.4 95/172895/1
Matthias Sohn [Thu, 26 Nov 2020 23:29:39 +0000 (00:29 +0100)]
Merge branch 'stable-5.3' into stable-5.4

* stable-5.3:
  Prepare 5.3.9-SNAPSHOT builds
  JGit v5.3.8.202011260953-r
  Prepare 5.1.15-SNAPSHOT builds
  JGit v5.1.14.202011251942-r
  GC#deleteOrphans: log warning for deleted orphaned files
  GC#deleteOrphans: handle failure to list files in pack directory
  Ensure that GC#deleteOrphans respects pack lock
  Update API warning filters
  Remove unused imports

Change-Id: I82576ad0f61cf3ff11b54691b32666c61401ad9b
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years agoAdd support for reading symrefs from pack capabilities 75/171875/7
Lee Worrall [Sat, 10 Oct 2020 03:31:19 +0000 (11:31 +0800)]
Add support for reading symrefs from pack capabilities

A SymbolicRef is added to the advertised refs for any symref in
capabilities whose target is an advertised ref; this may replace an
existing entry, such as HEAD.

When cloning, if any advertised HEAD is symbolic then use the target
rather than looking for an advertised ref with a matching objectId.

Add --symref option to LsRemote command.

Bug: 514052
Change-Id: Idfb48e6f6e8dcfe57a6896883fe6d84d533aa9d0
Signed-off-by: Lee Worrall <worrall.la@gmail.com>
3 years agoPrepare 5.3.9-SNAPSHOT builds 94/172894/1
Matthias Sohn [Thu, 26 Nov 2020 15:30:32 +0000 (16:30 +0100)]
Prepare 5.3.9-SNAPSHOT builds

Change-Id: I69f181453c79cef2b4f43fac38d9836917cdc973
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years agoJGit v5.3.8.202011260953-r 81/172881/1 v5.3.8.202011260953-r
Matthias Sohn [Thu, 26 Nov 2020 14:52:53 +0000 (15:52 +0100)]
JGit v5.3.8.202011260953-r

Change-Id: I7b128942ef224335f415f867c2d9d5da7498ed8b
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years agoMerge branch 'stable-5.2' into stable-5.3 80/172880/1
Matthias Sohn [Thu, 26 Nov 2020 14:37:19 +0000 (15:37 +0100)]
Merge branch 'stable-5.2' into stable-5.3

* stable-5.2:
  Prepare 5.1.15-SNAPSHOT builds
  JGit v5.1.14.202011251942-r
  GC#deleteOrphans: log warning for deleted orphaned files
  GC#deleteOrphans: handle failure to list files in pack directory
  Ensure that GC#deleteOrphans respects pack lock
  Update API warning filters
  Remove unused imports

Change-Id: Id9386846a202b5ae98dd602744963f8897ddaa8c

3 years agoMerge branch 'stable-5.1' into stable-5.2 74/172874/1
Matthias Sohn [Thu, 26 Nov 2020 14:34:08 +0000 (15:34 +0100)]
Merge branch 'stable-5.1' into stable-5.2

* stable-5.1:
  Prepare 5.1.15-SNAPSHOT builds
  JGit v5.1.14.202011251942-r
  GC#deleteOrphans: log warning for deleted orphaned files
  GC#deleteOrphans: handle failure to list files in pack directory
  Ensure that GC#deleteOrphans respects pack lock
  Update API warning filters
  Remove unused imports

Change-Id: I91cfe2820c40d2d773cbf018cc2a6c36b062801e
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years agoPrepare 5.1.15-SNAPSHOT builds 73/172873/1
Matthias Sohn [Thu, 26 Nov 2020 14:02:01 +0000 (15:02 +0100)]
Prepare 5.1.15-SNAPSHOT builds

Change-Id: I70246b66c76e865aef4e3adada3a507750ca7c63
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years agoJGit v5.1.14.202011251942-r 62/172862/1 v5.1.14.202011251942-r
Matthias Sohn [Thu, 26 Nov 2020 00:42:17 +0000 (01:42 +0100)]
JGit v5.1.14.202011251942-r

Change-Id: Ibe124988be39feaa029c3770777126dd87b18abc
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years agoGC#deleteOrphans: log warning for deleted orphaned files 61/172861/4
Matthias Sohn [Wed, 25 Nov 2020 23:58:03 +0000 (00:58 +0100)]
GC#deleteOrphans: log warning for deleted orphaned files

Change-Id: Ie245bf5c8c924dfb1f0f40b8bcdcb1e6f5815526
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years agoGC#deleteOrphans: handle failure to list files in pack directory 60/172860/3
Matthias Sohn [Wed, 25 Nov 2020 23:24:56 +0000 (00:24 +0100)]
GC#deleteOrphans: handle failure to list files in pack directory

- log an error
- either there is no list or it is incomplete hence return immediately

Change-Id: Ieee5378ca06304056b9ccc30c1acd5f52360052d
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years agoEnsure that GC#deleteOrphans respects pack lock 29/172829/8
Matthias Sohn [Wed, 25 Nov 2020 16:00:09 +0000 (17:00 +0100)]
Ensure that GC#deleteOrphans respects pack lock

If pack or index files are guarded by a pack lock (.keep file)
deleteOrphans() should not touch the respective files protected by the
lock file. Otherwise it may interfere with PackInserter concurrently
inserting a new pack file and its index.

The problem was caused by the following race.

All mentioned files are located in  "objects/pack/".
File endings relevant in "pack" dir:
  .pack
  .keep
  .idx
  .bitmap

When ReceivePack receives a pack file it executes the following steps:

ReceivePack.service():
  receivePackAndCheckConnectivity():
    receivePack():
      receive the pack
      parse the pack, returns packLock (.keep file)
      PackInserter.flush():
        write tmpPck file:  "insert_<random>.pack"
        write tmpIdx file:  "insert_<random>.idx"
        real pack name: "pack-<SHA1>.pack"
        real index name: "pack-<SHA1>.idx"
        atomic rename tmpPack to realPack
        atomic rename tmpIdx to tmpIdx
  execute commands
  unlock pack by removing .keep file
  trigger auto gc if enabled

When PackInserter.flush() renames the temporary pack to the final
"pack-xxx.pack" file  the temporary pack index file "insert_xxx.idx"
has no matching .pack file with the same base name for a short interval.
If deleteOrphans() ran during that interval it deduced the pack index
file was orphaned. Subsequently the missing pack index caused
MissingObjectExceptions since objects contained in the pack couldn't be
looked up anymore.

Bug: https://bugs.chromium.org/p/gerrit/issues/detail?id=13544
Change-Id: I559c81e4b1d7c487f92a751bd78b987d32c98719
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years agoMerge branch 'stable-5.10' 51/172851/1
Matthias Sohn [Wed, 25 Nov 2020 21:33:04 +0000 (22:33 +0100)]
Merge branch 'stable-5.10'

* stable-5.10:
  Prepare 5.10.0-SNAPSHOT builds
  JGit v5.10.0.202011251205-m3
  Prepare 5.10.0-SNAPSHOT builds
  JGit v5.10.0.202011041322-m2

Change-Id: Ifc188fec62d9ee86243d289a2595a92113c9dd0a

3 years agoPrepare 5.10.0-SNAPSHOT builds 50/172850/1
Matthias Sohn [Wed, 25 Nov 2020 21:30:34 +0000 (22:30 +0100)]
Prepare 5.10.0-SNAPSHOT builds

Change-Id: Iabc845edf565ac706344f68f854384faa63b6f43
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years agoJGit v5.10.0.202011251205-m3 37/172837/1 v5.10.0.202011251205-m3
Matthias Sohn [Wed, 25 Nov 2020 17:05:35 +0000 (18:05 +0100)]
JGit v5.10.0.202011251205-m3

Change-Id: Id58d8eb49f550e62b04053a71366f7eabd9f9a53
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years agoMerge branch 'master' into stable-5.10 30/172830/1
Matthias Sohn [Wed, 25 Nov 2020 16:39:25 +0000 (17:39 +0100)]
Merge branch 'master' into stable-5.10

* master:
  Update Orbit to S20201118210000 and add target for 4.18
  PacketLineIn: ensure that END != DELIM
  PacketLineIn: ensure that END != DELIM
  Allow to resolve a conflict by checking out a file
  Update Orbit to I20201111205634
  Document that setLastModified sets time of symlink target
  Fix bug in PerformanceLogContext
  Fix IOException occurring during gc

Change-Id: I2980552381d1ae61b9b2d81d7289de37d6bf4cae
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years agoPacketLineIn: ensure that END != DELIM 01/172601/1
Thomas Wolf [Thu, 19 Nov 2020 12:23:05 +0000 (13:23 +0100)]
PacketLineIn: ensure that END != DELIM

Just allocate the two string objects directly. The previously used
new StringBuilder(0).toString() returns the same object for both END
and DELIM when run on Java 15, which breaks the wire protocol since
then END and DELIM cannot be distinguished anymore.

Bug: 568950
Change-Id: I9d54d7bf484948c24b51a094256bd9d38b085f35
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
(cherry picked from commit 7da0f0a8f37e35e9c3108588f1e6f7a7381d8f77)

3 years agoUpdate Orbit to S20201118210000 and add target for 4.18 77/172577/1
Matthias Sohn [Fri, 20 Nov 2020 10:05:08 +0000 (11:05 +0100)]
Update Orbit to S20201118210000 and add target for 4.18

- replace target platform for 4.17 staging with final release
- add target platform for Eclipse 4.18 (2020-12)

Change-Id: I4fb60cc346e275b755bba8d32b1964c2673fb615
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years agoMerge branch 'stable-5.9' 76/172576/1
Matthias Sohn [Fri, 20 Nov 2020 09:56:12 +0000 (10:56 +0100)]
Merge branch 'stable-5.9'

* stable-5.9:
  PacketLineIn: ensure that END != DELIM

Change-Id: Ib2408d71b56080bb1fd1670f0cd62dc7f4cb6c4d

3 years agoPacketLineIn: ensure that END != DELIM 35/172535/1
Thomas Wolf [Thu, 19 Nov 2020 12:23:05 +0000 (13:23 +0100)]
PacketLineIn: ensure that END != DELIM

Just allocate the two string objects directly. The previously used
new StringBuilder(0).toString() returns the same object for both END
and DELIM when run on Java 15, which breaks the wire protocol since
then END and DELIM cannot be distinguished anymore.

Bug: 568950
Change-Id: I9d54d7bf484948c24b51a094256bd9d38b085f35
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
(cherry picked from commit 7da0f0a8f37e35e9c3108588f1e6f7a7381d8f77)

3 years agoPacketLineIn: ensure that END != DELIM 02/172502/1
Thomas Wolf [Thu, 19 Nov 2020 12:23:05 +0000 (13:23 +0100)]
PacketLineIn: ensure that END != DELIM

Just allocate the two string objects directly. The previously used
new StringBuilder(0).toString() returns the same object for both END
and DELIM when run on Java 15, which breaks the wire protocol since
then END and DELIM cannot be distinguished anymore.

Bug: 568950
Change-Id: I9d54d7bf484948c24b51a094256bd9d38b085f35
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
3 years agoAllow to resolve a conflict by checking out a file 72/172372/1
Thomas Wolf [Sun, 15 Nov 2020 17:45:12 +0000 (18:45 +0100)]
Allow to resolve a conflict by checking out a file

DirCacheEditor unconditionally applied a PathEdit to all stages in the
index. This gives wrong results if one wants to check out a file from
some commit to resolve a conflict: JGit would update the working tree
file multiple times (once per stage), and set all stages to point to
the checked-out blob.

C git replaces the stages by the entry for the checked-out file.

To support this, add a DirCacheEntry.setStage() method so that
CheckoutCommand can force the stage to zero. In DirCacheEditor, keep
only the zero stage if the PathEdit re-set the stage.

Bug: 568038
Change-Id: Ic7c635bb5aaa06ffaaeed50bc5e45702c56fc6d1
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
3 years agoUpdate Orbit to I20201111205634 47/172247/1
Matthias Sohn [Sat, 14 Nov 2020 20:48:31 +0000 (21:48 +0100)]
Update Orbit to I20201111205634

and update
- org.apache.ant to 1.10.9.v20201106-1946
- org.slf4j.binding.log4j12 to 1.7.30.v20201108-2042

Change-Id: Id15d14dea3a61dabde974c3ea9332d47fb19f4d9
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years agoDocument that setLastModified sets time of symlink target 17/167817/10
Matthias Sohn [Mon, 17 Aug 2020 12:23:29 +0000 (14:23 +0200)]
Document that setLastModified sets time of symlink target

Due to Java bug JDK-8220793 [1] Java cannot set timestamps of a symlink
but only of the symlink target. This bug was fixed in Java 13. Since we
don't have a use case to set the timestamp of the symlink itself simply
document the current behavior of setLastModified methods.

[1] https://bugs.openjdk.java.net/browse/JDK-8220793

Change-Id: Ibc28c1702a1b9845602bd257606fbd44803a43fb
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years agoFix bug in PerformanceLogContext 01/171201/15
Alexa Panfil [Fri, 23 Oct 2020 17:23:23 +0000 (17:23 +0000)]
Fix bug in PerformanceLogContext

PerformanceLogContext threw NullPointerException when multiple threads
tried to add an event to the PerformanceLogContext. The cause for this
is that the ThreadLocal was initialized only in the class constructor
for the first thread; for subsequent threads it was null.

To fix this initialize eventRecords for each thread.

Change-Id: I18ef67dff8f0488e3ad28c9bbc18ce73d5168cf9
Signed-off-by: Alexa Panfil <alexapizza@google.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years agoFix IOException occurring during gc 62/171362/2
Nail Samatov [Tue, 27 Oct 2020 13:56:24 +0000 (16:56 +0300)]
Fix IOException occurring during gc

Fix IOException occurring when calling
GC on a repository with absent objects/pack folder.

Change-Id: I5be1333a0726f4d7491afd25ddac85451686c30a
Signed-off-by: Nail Samatov <sanail@yandex.ru>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years agoPrepare 5.10.0-SNAPSHOT builds 82/171782/1
Matthias Sohn [Wed, 4 Nov 2020 22:48:37 +0000 (23:48 +0100)]
Prepare 5.10.0-SNAPSHOT builds

Change-Id: Ie13f90948669c8cdebd14e74a91df9daf0387ccf
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years agoJGit v5.10.0.202011041322-m2 63/171763/1 v5.10.0.202011041322-m2
Matthias Sohn [Wed, 4 Nov 2020 18:38:49 +0000 (19:38 +0100)]
JGit v5.10.0.202011041322-m2

Change-Id: Ia2709321f61f61208350eaa8aa48e56b88455146
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years agoRevert "Client-side protocol V2 support for fetching" 24/171724/2
Thomas Wolf [Tue, 3 Nov 2020 22:33:19 +0000 (23:33 +0100)]
Revert "Client-side protocol V2 support for fetching"

This reverts commit f802f06e7fd5a98f256b7b7727598491f563bf2f.

I had misunderstood how protocol V2 works. This implementation only
works if the negotiation during fetch is done in one round.

Fixing this is substantial work in BasePackFetchConnection. Basically
I think I'd have to change back negotiate to the V0 version, and have
a doFetch() that does

  if protocol V2
    doFetchV2()
  else
    doFetchV0()

with doFetchV0 the old code, and doFetchV2 completely new.

Plus there would need to be a HTTP test case requiring several
negotiation rounds.

This is a couple of days work at least, and I don't know when I will
have the time to revisit this. So although the rest of the code is
fine I prefer to back this out completely and not leave a only half
working implementation in the code for an indeterminate time.

Bug: 553083
Change-Id: Icbbbb09882b3b83f9897deac4a06d5f8dc99d84e
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
3 years agoClose Repository to fix tests failing on Windows 63/171363/2
Nail Samatov [Tue, 27 Oct 2020 14:37:24 +0000 (17:37 +0300)]
Close Repository to fix tests failing on Windows

Fix tests failing on Windows because Repository
instance is created but not closed on tear down.

Change-Id: I72488ba5efeec95110926b1fbd56b7d96fca0d37
Signed-off-by: Nail Samatov <sanail@yandex.ru>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years agoClient-side protocol V2 support for fetching 04/167204/9
Thomas Wolf [Sun, 2 Aug 2020 17:22:05 +0000 (19:22 +0200)]
Client-side protocol V2 support for fetching

Make all transports request protocol V2 when fetching. Depending on
the transport, set the GIT_PROTOCOL environment variable (file and
ssh), pass the Git-Protocol header (http), or set the hidden
"\0version=2\0" (git anon). We'll fall back to V0 if the server
doesn't reply with a version 2 answer.

A user can control which protocol the client requests via the git
config protocol.version; if not set, JGit requests protocol V2 for
fetching. Pushing always uses protocol V0 still.

In the API, there is only a new Transport.openFetch() version that
takes a collection of RefSpecs plus additional patterns to construct
the Ref prefixes for the "ls-refs" command in protocol V2. If none
are given, the server will still advertise all refs, even in protocol
V2.

BasePackConnection.readAdvertisedRefs() handles falling back to
protocol V0. It newly returns true if V0 was used and the advertised
refs were read, and false if V2 is used and an explicit "ls-refs" is
needed. (This can't be done transparently inside readAdvertisedRefs()
because a "stateless RPC" transport like TransportHttp may need to
open a new connection for writing.)

BasePackFetchConnection implements the changes needed for the protocol
V2 "fetch" command (simplified ACK handling, delimiters, section
headers).

In TransportHttp, change readSmartHeaders() to also recognize the
"version 2" packet line as a valid smart server indication.

Adapt tests, and run all the HTTP tests not only with both HTTP
connection factories (JDK and Apache HttpClient) but also with both
protocol V0 and V2. Do the same for the SSH transport tests.

Bug: 553083
Change-Id: Ice9866aa78020f5ca8f397cde84dc224bf5d41b4
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years agoUpdate slf4j to 1.7.30 94/171394/2
Matthias Sohn [Wed, 28 Oct 2020 10:29:35 +0000 (11:29 +0100)]
Update slf4j to 1.7.30

Bug: 566475
Change-Id: Ia3e5b72d53ead435e4677e46c73a3ff45a606b41
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years agoUpdate Orbit to S20201027182932 (2020-12 M2) 93/171393/1
Matthias Sohn [Wed, 28 Oct 2020 10:04:53 +0000 (11:04 +0100)]
Update Orbit to S20201027182932 (2020-12 M2)

Change-Id: I24add2e8133f5c83675ab3ade58d7d6db29771ec
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>