]> source.dussan.org Git - jgit.git/log
jgit.git
3 years agoMerge branch 'stable-5.10' into stable-5.11 53/186553/1
Matthias Sohn [Fri, 15 Oct 2021 20:45:18 +0000 (22:45 +0200)]
Merge branch 'stable-5.10' into stable-5.11

* stable-5.10:
  Fix missing peel-part in lsRefsV2 for loose annotated tags
  reftable: drop code for truncated reads
  reftable: pass on invalid object ID in conversion
  Update eclipse-jarsigner-plugin to 1.3.2
  Fix running benchmarks from bazel
  Update eclipse-jarsigner-plugin to 1.3.2

Change-Id: I23ccb89306263ce042ce782d881812d4b5187672

3 years agoMerge branch 'stable-5.9' into stable-5.10 52/186552/1
Matthias Sohn [Fri, 15 Oct 2021 20:32:00 +0000 (22:32 +0200)]
Merge branch 'stable-5.9' into stable-5.10

* stable-5.9:
  Fix missing peel-part in lsRefsV2 for loose annotated tags
  reftable: drop code for truncated reads
  reftable: pass on invalid object ID in conversion
  Update eclipse-jarsigner-plugin to 1.3.2
  Fix running benchmarks from bazel
  Update eclipse-jarsigner-plugin to 1.3.2

Change-Id: I4e7c7727ebfa9a7748477f2300bd66d775548ad6

3 years agoFix missing peel-part in lsRefsV2 for loose annotated tags 20/186520/4
Saša Živkov [Fri, 15 Oct 2021 08:13:53 +0000 (10:13 +0200)]
Fix missing peel-part in lsRefsV2 for loose annotated tags

We observed the following issue:

  $ git tag -a v1.0 -m v1.0
  $ git push origin tag v1.0
  $ git ls-remote origin v1.0^{}
  ... empty result ...

  On the server (Gerrit) side run git-gc to pack the refs:
  $ git gc

  Repeat the ls-remote from the client and the result is correct:
  $ git ls-remote origin v1.0^{}
  7ad85c810de3ae922903d4bdd17c53cd627260ba        refs/tags/v1.0^{}

Unfortunately, the existing UploadPackTest didn't reveal this issue
although it provided the test case needed to do so: testV2LsRefsPeel.
This is because The UploadPackTest uses InMemoryRepository which
internally uses Dfs* implementations. The issue is only reproducible
when using the FileRepository.

It is a non-trivial task to refactor the UploadPackTest to work against
both InMemoryRepository and FileRepository and this change is not trying
to do that. This change creates a new test:
UploadPackLsRefsFileRepositoryTest and copies the necesssary code from
the UploadPackTest.

Change-Id: Icfc7d0ca63f1524bafe24c9626ce12ea72aa3718
Signed-off-by: Saša Živkov <sasa.zivkov@sap.com>
3 years agoMerge branch 'stable-5.8' into stable-5.9 99/186299/1
Matthias Sohn [Thu, 7 Oct 2021 22:36:14 +0000 (00:36 +0200)]
Merge branch 'stable-5.8' into stable-5.9

* stable-5.8:
  reftable: drop code for truncated reads
  reftable: pass on invalid object ID in conversion
  Update eclipse-jarsigner-plugin to 1.3.2

Change-Id: I9e66ef90dc9a65bac47b35705d679bf992bd72b9

3 years agoMerge branch 'stable-5.7' into stable-5.8 97/186297/1
Matthias Sohn [Thu, 7 Oct 2021 22:33:33 +0000 (00:33 +0200)]
Merge branch 'stable-5.7' into stable-5.8

* stable-5.7:
  reftable: drop code for truncated reads
  reftable: pass on invalid object ID in conversion
  Update eclipse-jarsigner-plugin to 1.3.2

Change-Id: I88c47ff57f4829baec5b19aad3d8d6bd21f31a86

3 years agoMerge branch 'stable-5.6' into stable-5.7 96/186296/1
Matthias Sohn [Thu, 7 Oct 2021 22:18:42 +0000 (00:18 +0200)]
Merge branch 'stable-5.6' into stable-5.7

* stable-5.6:
  reftable: drop code for truncated reads
  reftable: pass on invalid object ID in conversion
  Update eclipse-jarsigner-plugin to 1.3.2

Change-Id: I1c18f5f435f4a4a86e0548a310dbfc74191e1ed5

3 years agoreftable: drop code for truncated reads 02/185902/4
Han-Wen Nienhuys [Tue, 28 Sep 2021 18:05:03 +0000 (20:05 +0200)]
reftable: drop code for truncated reads

The reftable format is a block based format, but allows for variably
sized blocks. This obviously happens for reflog blocks (which are zlib
compressed), but is also accepted for index blocks: In the spec, this
is motivated as

     To achieve constant O(1) disk seeks for lookups the index must be
     a single level, which is permitted to exceed the file's
     configured block size, but not the format's max block size of
     15.99 MiB.

Hence, when parsing a block, one cannot be sure of its exact size:
after reading a default-size block (eg. 4kb), the block header may
state that the block is in fact larger.

Before, the code would mark the block as `truncated`, noting

     // Its OK during sequential scan for an index block to have been
     // partially read and be truncated in-memory. This happens when
     // the index block is larger than the file's blockSize. Caller
     // will break out of its scan loop once it sees the blockType.

This looks like either

* a remnant of never-implemented functionality. There is no reason to
  ever sequentially scan an index block.

* alluding to sequential scan of the data blocks before the index
  blocks (eg. scanning refs, which ends when we find the first ref index
  block, and we can then ignore the index block).

This comment is followed by code that populates the
restartTbl/restartCnt fields relative to the (possibly truncated)
buffer. If the buffer is truncated, this essentially reads garbage,
leading to OOB array access when using the index block.

Fix this by dropping the truncated logic and issuing a second read if
the first read was short.

Add a test.

We have never observed this failure scenario at Google. We use 64kb
blocksize, which requires us to need fewer index entries. The reftable
spec mentions an Android repo of size 36M. With 64kb blocks, that's
just 562 index entries. Even with historical growth, we are long from
requiring an index whose size exceeds a single block.

When adding the analogous test for seeking refs, there was no failure.
This points to another possibility which is that the code tries to
avoid writing large index blocks for refs.

I did not investigate further which one it is.

Fixes https://bugs.eclipse.org/bugs/show_bug.cgi?id=576250

Bug: 576250
Change-Id: I41ec21fac9e526ef57b3d6fb57b988bd353ee338
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
3 years agoreftable: pass on invalid object ID in conversion 56/185856/2
Han-Wen Nienhuys [Mon, 27 Sep 2021 14:07:27 +0000 (16:07 +0200)]
reftable: pass on invalid object ID in conversion

Before, while trying to determine if an object ID was a tag or not,
the reftable conversion would yield an exception.

Change-Id: I3688a0ffa9e774ba27f320e3840ff8cada21ecf0

3 years agoUpdate eclipse-jarsigner-plugin to 1.3.2 54/185754/1
Matthias Sohn [Mon, 20 Sep 2021 22:18:03 +0000 (00:18 +0200)]
Update eclipse-jarsigner-plugin to 1.3.2

Change-Id: Id5d05d96c392913de7b4451421c2ffb7b63ab83f
(cherry picked from commit c70c0acb4752f00672e3b856539587e4977bfaea)

3 years agoFix running benchmarks from bazel 55/185855/2
Matthias Sohn [Mon, 27 Sep 2021 13:53:30 +0000 (15:53 +0200)]
Fix running benchmarks from bazel

add missing dependency to
- javaewah
- slf4j-api

Change-Id: I28dc982791b32f10d20b2fd0671aa8d2514a0fb3

3 years agoUpdate eclipse-jarsigner-plugin to 1.3.2 43/185643/2
Matthias Sohn [Mon, 20 Sep 2021 22:18:03 +0000 (00:18 +0200)]
Update eclipse-jarsigner-plugin to 1.3.2

Change-Id: Id5d05d96c392913de7b4451421c2ffb7b63ab83f

3 years agoMerge branch 'stable-5.10' into stable-5.11 58/184858/1
Matthias Sohn [Wed, 1 Sep 2021 14:08:03 +0000 (16:08 +0200)]
Merge branch 'stable-5.10' into stable-5.11

* stable-5.10:
  GitServlet: allow to override default error handlers

Change-Id: If10a99bcdc91105059b15a1d137dd38af228c58d

3 years agoMerge branch 'stable-5.9' into stable-5.10 57/184857/1
Matthias Sohn [Wed, 1 Sep 2021 13:55:58 +0000 (15:55 +0200)]
Merge branch 'stable-5.9' into stable-5.10

* stable-5.9:
  GitServlet: allow to override default error handlers

Change-Id: I55273087f8a67762130728eaaf635519c25255b3

3 years agoGitServlet: allow to override default error handlers 43/184843/3
Antonio Barone [Wed, 1 Sep 2021 10:04:07 +0000 (12:04 +0200)]
GitServlet: allow to override default error handlers

GitServlet delegates repository access over HTTP to the GitFilter
servlet.

GitServlet, in turn, can be extended by jgit consumers to provide custom
logic when handling such operations.

This is the case, for example, with Gerrit Code Review, which provides
custom behavior with a GitOverHttpServlet [1].

Among possible customizations, the ability of specifying a custom error
handler for UploadPack and ReceivePack was already introduced in
GitFilter by Idd3b87d6b and I9c708aa5a2, respectively.

However the `setUploadPackErrorHandler` and `setReceivePackErrorHandler`
methods were never added to the GitServlet.

Expose the `setUploadPackErrorHandler` and `setReceivePackErrorHandler`
methods to the GitServlet, so that consumers of the jgit library might
specify custom error handlers.

[1] https://gerrit.googlesource.com/gerrit/+/refs/heads/stable-3.2/java/com/google/gerrit/httpd/GitOverHttpServlet.java#95

Change-Id: I712d485ff68b662b48c71ef75650c5a155950d23

3 years agoMerge branch 'stable-5.10' into stable-5.11 83/183483/1
Thomas Wolf [Thu, 29 Jul 2021 11:11:08 +0000 (13:11 +0200)]
Merge branch 'stable-5.10' into stable-5.11

* stable-5.10:
  [test] Create keystore with the keytool of the running JDK
  ReachabilityCheckerTestCase: fix reachable from self test case

Change-Id: I55f4dd19e9fa3b789bd9a79d256fe9abb55ee7f4
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
3 years agoMerge branch 'stable-5.9' into stable-5.10 82/183482/1
Thomas Wolf [Thu, 29 Jul 2021 11:10:33 +0000 (13:10 +0200)]
Merge branch 'stable-5.9' into stable-5.10

* stable-5.9:
  [test] Create keystore with the keytool of the running JDK
  ReachabilityCheckerTestCase: fix reachable from self test case

Change-Id: Ic37426211905d987ddd11480a54d95b86143c94c
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
3 years agoMerge branch 'stable-5.8' into stable-5.9 81/183481/1
Thomas Wolf [Thu, 29 Jul 2021 11:09:52 +0000 (13:09 +0200)]
Merge branch 'stable-5.8' into stable-5.9

* stable-5.8:
  [test] Create keystore with the keytool of the running JDK
  ReachabilityCheckerTestCase: fix reachable from self test case

Change-Id: If09cbb877c674f15261715cecef7a2393bf66fa3
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
3 years agoMerge branch 'stable-5.7' into stable-5.8 80/183480/1
Thomas Wolf [Thu, 29 Jul 2021 11:09:13 +0000 (13:09 +0200)]
Merge branch 'stable-5.7' into stable-5.8

* stable-5.7:
  [test] Create keystore with the keytool of the running JDK
  ReachabilityCheckerTestCase: fix reachable from self test case

Change-Id: I32010c6bf45d5138e17143d6c284ac56434eade1
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
3 years agoMerge branch 'stable-5.6' into stable-5.7 79/183479/1
Thomas Wolf [Thu, 29 Jul 2021 11:08:01 +0000 (13:08 +0200)]
Merge branch 'stable-5.6' into stable-5.7

* stable-5.6:
  [test] Create keystore with the keytool of the running JDK
  ReachabilityCheckerTestCase: fix reachable from self test case

Change-Id: I1f6b4fc26f6ee6f22cc0aacd032c1e73ba246dbc
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
3 years agoMerge branch 'stable-5.5' into stable-5.6 78/183478/1
Thomas Wolf [Thu, 29 Jul 2021 11:06:56 +0000 (13:06 +0200)]
Merge branch 'stable-5.5' into stable-5.6

* stable-5.5:
  [test] Create keystore with the keytool of the running JDK

Change-Id: Icb0bb6dc4ad05b1f3eb562547893f2e0aedf8775
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
3 years agoMerge branch 'stable-5.4' into stable-5.5 77/183477/1
Thomas Wolf [Thu, 29 Jul 2021 11:05:59 +0000 (13:05 +0200)]
Merge branch 'stable-5.4' into stable-5.5

* stable-5.4:
  [test] Create keystore with the keytool of the running JDK

Change-Id: I5ff3dc1c771aeb33af39eb68f166c7282b478cf8
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
3 years agoMerge branch 'stable-5.3' into stable-5.4 76/183476/1
Thomas Wolf [Thu, 29 Jul 2021 11:05:20 +0000 (13:05 +0200)]
Merge branch 'stable-5.3' into stable-5.4

* stable-5.3:
  [test] Create keystore with the keytool of the running JDK

Change-Id: If92372b7bfbfb9445fcb934c48dc1cd6610e061b
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
3 years agoMerge branch 'stable-5.2' into stable-5.3 75/183475/1
Thomas Wolf [Thu, 29 Jul 2021 11:03:56 +0000 (13:03 +0200)]
Merge branch 'stable-5.2' into stable-5.3

* stable-5.2:
  [test] Create keystore with the keytool of the running JDK

Change-Id: I981de862c614986a7b443fed1cce7b895b758682
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
3 years agoMerge branch 'stable-5.1' into stable-5.2 74/183474/1
Thomas Wolf [Thu, 29 Jul 2021 11:02:16 +0000 (13:02 +0200)]
Merge branch 'stable-5.1' into stable-5.2

* stable-5.1:
  [test] Create keystore with the keytool of the running JDK

Change-Id: Ic56f4f23c37432377be88e07d06c5ad75591d84f
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
3 years ago[test] Create keystore with the keytool of the running JDK 71/183471/1
Thomas Wolf [Sun, 25 Jul 2021 13:44:35 +0000 (15:44 +0200)]
[test] Create keystore with the keytool of the running JDK

Call keytool with the absolute path of "java.home". Otherwise a keytool
for a different, maybe even newer Java version might be picked up, and
then the keystore may not be readable by the JVM used to run the tests.

(cherry picked from commit 2d73c702d3e9128b7dc03a01fe2cf18f119d3ffe)

Change-Id: Iea77024947a34267f008847d81312fe0abadc615
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
3 years agoMerge branch 'stable-5.10' into stable-5.11 88/182488/2
Matthias Sohn [Sat, 26 Jun 2021 13:41:19 +0000 (15:41 +0200)]
Merge branch 'stable-5.10' into stable-5.11

* stable-5.10:
  Retry loose object read upon "Stale file handle" exception
  Ignore missing javadoc in test bundles

Change-Id: Ia385fa6b5d2fee64476793e06860a279bf2f6e36

3 years agoMerge branch 'stable-5.9' into stable-5.10 80/182480/1
Matthias Sohn [Fri, 25 Jun 2021 20:23:47 +0000 (22:23 +0200)]
Merge branch 'stable-5.9' into stable-5.10

* stable-5.9:
  Retry loose object read upon "Stale file handle" exception
  Ignore missing javadoc in test bundles

Change-Id: I56fc2c47193a891285a705d44b3507f23982dc8a

3 years agoRetry loose object read upon "Stale file handle" exception 95/181295/12
Antonio Barone [Wed, 2 Jun 2021 15:13:17 +0000 (18:13 +0300)]
Retry loose object read upon "Stale file handle" exception

When reading loose objects over NFS it is possible that the OS syscall
would fail with ESTALE errors: This happens when the open file
descriptor no longer refers to a valid file.

Notoriously it is possible to hit this scenario when git data is shared
among multiple clients, for example by multiple gerrit instances in HA.

If one of the two clients performs a GC operation that would cause the
packing and then the pruning of loose objects, the other client might
still hold a reference to those objects, which would cause an exception
to bubble up the stack.

The Linux NFS FAQ[1] (at point A.10), suggests that the proper way to
handle such ESTALE scenarios is to:

"[...] close the file or directory where the error occurred, and reopen
it so the NFS client can resolve the pathname again and retrieve the new
file handle."

In case of a stale file handle exception, we now attempt to read the
loose object again (up to 5 times), until we either succeed or encounter
a FileNotFoundException, in which case the search can continue to
Packfiles and alternates.

The limit of 5 provides an arbitrary upper bounds that is consistent to
the one chosen when handling stale file handles for packed-refs
files (see [2] for context).

[1] http://nfs.sourceforge.net/
[2] https://git.eclipse.org/r/c/jgit/jgit/+/54350

Bug: 573791
Change-Id: I9950002f772bbd8afeb9c6108391923be9d0ef51

3 years agoIgnore missing javadoc in test bundles 25/182425/1
Matthias Sohn [Thu, 24 Jun 2021 21:13:51 +0000 (23:13 +0200)]
Ignore missing javadoc in test bundles

Change-Id: I83ed20823dc6b22ff48c2a554acb2f7d3b6067b7

3 years agoReachabilityCheckerTestCase: fix reachable from self test case 55/182055/1
Han-Wen Nienhuys [Wed, 16 Jun 2021 15:41:24 +0000 (17:41 +0200)]
ReachabilityCheckerTestCase: fix reachable from self test case

Change-Id: I8f94a0a0ff401f1691b3757002756b4e83dd8640
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
3 years agoMerge branch 'stable-5.10' into stable-5.11 89/181889/1
Matthias Sohn [Sun, 13 Jun 2021 23:13:18 +0000 (01:13 +0200)]
Merge branch 'stable-5.10' into stable-5.11

* stable-5.10:
  Prepare 5.1.17-SNAPSHOT builds
  JGit v5.1.16.202106041830-r
  BatchRefUpdate: Skip saving conflicting ref names and prefixes in memory
  BatchRefUpdateTest: Accurately assert RefsChangedEvent(s) fired
  Optimize RefDirectory.isNameConflicting()
  Update bazlets and bazel version

Change-Id: I265425194c24fd82cbeff869ce41cbc9b73571a2

3 years agoMerge branch 'stable-5.9' into stable-5.10 82/181882/1
Matthias Sohn [Sun, 13 Jun 2021 21:55:46 +0000 (23:55 +0200)]
Merge branch 'stable-5.9' into stable-5.10

* stable-5.9:
  Prepare 5.1.17-SNAPSHOT builds
  JGit v5.1.16.202106041830-r
  BatchRefUpdate: Skip saving conflicting ref names and prefixes in memory
  BatchRefUpdateTest: Accurately assert RefsChangedEvent(s) fired
  Optimize RefDirectory.isNameConflicting()
  Update bazlets and bazel version

Change-Id: Ib1299564a4cfb9c01f422d7ada05fcfac29700f8

3 years agoMerge branch 'stable-5.8' into stable-5.9 81/181881/1
Matthias Sohn [Sun, 13 Jun 2021 21:55:03 +0000 (23:55 +0200)]
Merge branch 'stable-5.8' into stable-5.9

* stable-5.8:
  Prepare 5.1.17-SNAPSHOT builds
  JGit v5.1.16.202106041830-r
  BatchRefUpdate: Skip saving conflicting ref names and prefixes in memory
  BatchRefUpdateTest: Accurately assert RefsChangedEvent(s) fired
  Optimize RefDirectory.isNameConflicting()
  Update bazlets and bazel version

Change-Id: I9abf7dd8b8e5eb3199fd6b43a4653c4e4cf4bf1b

3 years agoMerge branch 'stable-5.7' into stable-5.8 80/181880/1
Matthias Sohn [Sun, 13 Jun 2021 21:54:06 +0000 (23:54 +0200)]
Merge branch 'stable-5.7' into stable-5.8

* stable-5.7:
  Prepare 5.1.17-SNAPSHOT builds
  JGit v5.1.16.202106041830-r
  BatchRefUpdate: Skip saving conflicting ref names and prefixes in memory
  BatchRefUpdateTest: Accurately assert RefsChangedEvent(s) fired
  Optimize RefDirectory.isNameConflicting()
  Update bazlets and bazel version

Change-Id: I1ee0d01c14fb7dca151b4e7ae1b989da5a3a01e3

3 years agoMerge branch 'stable-5.6' into stable-5.7 79/181879/1
Matthias Sohn [Sun, 13 Jun 2021 21:52:46 +0000 (23:52 +0200)]
Merge branch 'stable-5.6' into stable-5.7

* stable-5.6:
  Prepare 5.1.17-SNAPSHOT builds
  JGit v5.1.16.202106041830-r
  BatchRefUpdate: Skip saving conflicting ref names and prefixes in memory
  BatchRefUpdateTest: Accurately assert RefsChangedEvent(s) fired
  Optimize RefDirectory.isNameConflicting()
  Update bazlets and bazel version

Change-Id: I4570cce185877cb4c50eee519a1cf9467a766dea

3 years agoMerge branch 'stable-5.5' into stable-5.6 79/181479/5
Matthias Sohn [Sun, 6 Jun 2021 08:45:57 +0000 (10:45 +0200)]
Merge branch 'stable-5.5' into stable-5.6

* stable-5.5:
  Prepare 5.1.17-SNAPSHOT builds
  JGit v5.1.16.202106041830-r
  BatchRefUpdate: Skip saving conflicting ref names and prefixes in
    memory
  BatchRefUpdateTest: Accurately assert RefsChangedEvent(s) fired
  Optimize RefDirectory.isNameConflicting()
  Update bazlets and bazel version

Change-Id: I504483a4dc979c5e7af18bad45dc18675e32afd2

3 years agoMerge branch 'stable-5.4' into stable-5.5 78/181478/1
Matthias Sohn [Sat, 5 Jun 2021 20:49:56 +0000 (22:49 +0200)]
Merge branch 'stable-5.4' into stable-5.5

* stable-5.4:
  Prepare 5.1.17-SNAPSHOT builds
  JGit v5.1.16.202106041830-r
  BatchRefUpdate: Skip saving conflicting ref names and prefixes in memory
  BatchRefUpdateTest: Accurately assert RefsChangedEvent(s) fired
  Optimize RefDirectory.isNameConflicting()
  Update bazlets and bazel version

Change-Id: If5232b68d3e25df7b71e417cbcbb39476e925f22

3 years agoMerge branch 'stable-5.3' into stable-5.4 77/181477/1
Matthias Sohn [Sat, 5 Jun 2021 20:49:07 +0000 (22:49 +0200)]
Merge branch 'stable-5.3' into stable-5.4

* stable-5.3:
  Prepare 5.1.17-SNAPSHOT builds
  JGit v5.1.16.202106041830-r
  BatchRefUpdate: Skip saving conflicting ref names and prefixes in memory
  BatchRefUpdateTest: Accurately assert RefsChangedEvent(s) fired
  Optimize RefDirectory.isNameConflicting()
  Update bazlets and bazel version

Change-Id: I1338fc79a7be6b77fb28df511dd7504fb19b6d1a

3 years agoMerge branch 'stable-5.2' into stable-5.3 76/181476/1
Matthias Sohn [Sat, 5 Jun 2021 20:48:01 +0000 (22:48 +0200)]
Merge branch 'stable-5.2' into stable-5.3

* stable-5.2:
  Prepare 5.1.17-SNAPSHOT builds
  JGit v5.1.16.202106041830-r
  BatchRefUpdate: Skip saving conflicting ref names and prefixes in memory
  BatchRefUpdateTest: Accurately assert RefsChangedEvent(s) fired
  Optimize RefDirectory.isNameConflicting()
  Update bazlets and bazel version

Change-Id: I7838f7d237a3598bf55995426d7ba1de146cb6ad

3 years agoMerge branch 'stable-5.1' into stable-5.2 75/181475/1
Matthias Sohn [Sat, 5 Jun 2021 20:19:47 +0000 (22:19 +0200)]
Merge branch 'stable-5.1' into stable-5.2

* stable-5.1:
  Prepare 5.1.17-SNAPSHOT builds
  JGit v5.1.16.202106041830-r
  BatchRefUpdate: Skip saving conflicting ref names and prefixes in memory
  BatchRefUpdateTest: Accurately assert RefsChangedEvent(s) fired
  Optimize RefDirectory.isNameConflicting()
  Update bazlets and bazel version

Change-Id: If1b5a2b380cf155e66bf5d5c6d216f86c919bb37

3 years agoPrepare 5.1.17-SNAPSHOT builds 72/181472/1
Matthias Sohn [Fri, 4 Jun 2021 22:45:08 +0000 (00:45 +0200)]
Prepare 5.1.17-SNAPSHOT builds

Change-Id: I20c69728465f956a5744a75eb548ef18962286dd
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years agoJGit v5.1.16.202106041830-r 71/181471/1 v5.1.16.202106041830-r
Matthias Sohn [Fri, 4 Jun 2021 22:31:03 +0000 (00:31 +0200)]
JGit v5.1.16.202106041830-r

Change-Id: I526ed2a08553bc0b2678aaefaff9e0c6529baefc
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years agoMerge changes I853ac6c7,I01878116,Ie994fc18 into stable-5.1
Matthias Sohn [Fri, 4 Jun 2021 22:21:31 +0000 (18:21 -0400)]
Merge changes I853ac6c7,I01878116,Ie994fc18 into stable-5.1

* changes:
  BatchRefUpdate: Skip saving conflicting ref names and prefixes in memory
  BatchRefUpdateTest: Accurately assert RefsChangedEvent(s) fired
  Optimize RefDirectory.isNameConflicting()

3 years agoBatchRefUpdate: Skip saving conflicting ref names and prefixes in memory 97/180697/4
Kaushik Lingarkar [Wed, 12 May 2021 23:12:27 +0000 (16:12 -0700)]
BatchRefUpdate: Skip saving conflicting ref names and prefixes in memory

Rather than getting all ref names and prefixes and saving them
in memory to perform the check for conflicting names, rely on
RefDirectory.isNameConflicting as it is no longer an expensive
call after it was optimized in Ie994fc.

The old optimization to save ref names and prefixes in memory
was targeted towards making clones faster. With this change,
the clone performance is unaffected when tests were done with
repos containing many(~500k) refs.

Here are few recorded elapsed times for creating 10 branches
using BatchRefUpdate on NFS based repositories with varying
loose refs count. As seen here, this change helps improve the
BatchRefUpdate performance from O(n^2) to O(1).

loose_refs_count  with_change  without_change
50                241 ms        310 ms
300               263 ms        1502 ms
1k                181 ms        4241 ms
2k                204 ms        6440 ms
9k                158 ms        25930 ms
20k               154 ms        60443 ms
50k               171 ms        135199 ms
110k              157 ms        329450 ms
160k              209 ms        396328 ms

This update improves the Gerrit notedb migration performance
as it uses BatchRefUpdate to write change meta refs similar to
the test performed above.

Change-Id: I853ac6c7feb4b39c3156c01876b38cbd182accfe
Signed-off-by: Kaushik Lingarkar <quic_kaushikl@quicinc.com>
3 years agoBatchRefUpdateTest: Accurately assert RefsChangedEvent(s) fired 96/180696/7
Kaushik Lingarkar [Fri, 14 May 2021 21:24:41 +0000 (14:24 -0700)]
BatchRefUpdateTest: Accurately assert RefsChangedEvent(s) fired

Update tests to record the number of events fired post-setup and only
assert for events fired during BatchRefUpdate.execute. For tests which
use writeLooseRef to setup refs, create new tests which assert the
number of RefsChangedEvent(s) rather than updating the existing ones
to call RefDirectory.exactRef as it changes the code path.

Change-Id: I0187811628d179d9c7e874c9bb8a7ddb44dd9df4
Signed-off-by: Kaushik Lingarkar <quic_kaushikl@quicinc.com>
3 years agoOptimize RefDirectory.isNameConflicting() 59/180559/4
Kaushik Lingarkar [Wed, 12 May 2021 21:57:49 +0000 (14:57 -0700)]
Optimize RefDirectory.isNameConflicting()

Avoid having to scan over ALL loose refs to determine if the
name is nested within or is a container of an existing reference.
This can get really expensive if there are too many loose refs.
Instead use exactRef and getRefsByPrefix which scan based on a
prefix.

With a simple shell script(like below) using jgit client to create
1k refs in a new repository on NFS, this change brings down the time
from 12mins to 7mins.

for ref in $(seq 1 1000); do
    jgit branch "$ref"
done

Here are few recorded elapsed times to create a new branch on NFS
based repositories with varying loose refs count. As we see here,
this change improves the name conflicting check from O(n^2) to O(1).

loose_refs_count  with_change  without_change
50                44 ms        164 ms
300               45 ms        1193 ms
1k                38 ms        2610 ms
2k                44 ms        6003 ms
9k                46 ms        27860 ms
20k               45 ms        48591 ms
50k               51 ms        135471 ms
110k              43 ms        294252 ms
160k              52 ms        430976 ms

Change-Id: Ie994fc184b8f82811bfb37b111eb9733dbe3e6e0
Signed-off-by: Kaushik Lingarkar <quic_kaushikl@quicinc.com>
3 years agoUpdate bazlets and bazel version 22/180622/1
Matthias Sohn [Thu, 16 Jan 2020 12:07:20 +0000 (13:07 +0100)]
Update bazlets and bazel version

- bazlets need to be updated to react on Maven central no longer
supporting http protocol but only https
- update bazel to 2.0

Change-Id: I07f5f050f3b1db2014a5198a28b6bbf893434814
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
(cherry picked from commit d74daad1e064da9614c5ca2c0138c8046cfb0829)

3 years agoPrepare 5.11.2-SNAPSHOT builds 90/180590/2
Matthias Sohn [Fri, 14 May 2021 06:25:09 +0000 (08:25 +0200)]
Prepare 5.11.2-SNAPSHOT builds

Change-Id: Idfd81bd3bbcd99034f69fffb1a562bf07b0f8209
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years agoJGit v5.11.1.202105131744-r 85/180585/1 v5.11.1.202105131744-r
Matthias Sohn [Thu, 13 May 2021 21:42:10 +0000 (23:42 +0200)]
JGit v5.11.1.202105131744-r

Change-Id: Id74eecbde63edbc58b6262ae01ef34d8bebc0f88
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years agoMerge branch 'stable-5.10' into stable-5.11 12/180512/1
Matthias Sohn [Wed, 12 May 2021 06:56:27 +0000 (08:56 +0200)]
Merge branch 'stable-5.10' into stable-5.11

* stable-5.10:
  Remove texts which were added by mistake in 00386272
  Fix formatting which was broken in 00386272

Change-Id: I0f1511be5375716d41565e72b271cb956c3e847b

3 years agoMerge branch 'stable-5.9' into stable-5.10 98/180498/2
Matthias Sohn [Wed, 12 May 2021 06:55:17 +0000 (08:55 +0200)]
Merge branch 'stable-5.9' into stable-5.10

* stable-5.9:
  Remove texts which were added by mistake in 00386272
  Fix formatting which was broken in 00386272

Change-Id: Ifa135077d8d07d2317df3b479822e30d87eca950

3 years agoMerge branch 'stable-5.8' into stable-5.9 97/180497/2
Matthias Sohn [Tue, 11 May 2021 22:03:00 +0000 (00:03 +0200)]
Merge branch 'stable-5.8' into stable-5.9

* stable-5.8:
  Remove texts which were added by mistake in 00386272
  Fix formatting which was broken in 00386272

Change-Id: I9ca7a0237f87d1d4bcaba81e709eaa67902f27e5

3 years agoMerge branch 'stable-5.7' into stable-5.8 96/180496/1
Matthias Sohn [Tue, 11 May 2021 21:34:30 +0000 (23:34 +0200)]
Merge branch 'stable-5.7' into stable-5.8

* stable-5.7:
  Remove texts which were added by mistake in 00386272
  Fix formatting which was broken in 00386272

Change-Id: I7ed3f47cb46e6c1bf483702c8925a24e88658e47

3 years agoMerge branch 'stable-5.6' into stable-5.7 95/180495/1
Matthias Sohn [Tue, 11 May 2021 21:32:22 +0000 (23:32 +0200)]
Merge branch 'stable-5.6' into stable-5.7

* stable-5.6:
  Remove texts which were added by mistake in 00386272
  Fix formatting which was broken in 00386272

Change-Id: I45d444b360485564744bf3dfad2c2f5a5e7fcdf6

3 years agoRemove texts which were added by mistake in 00386272 87/180487/1
Matthias Sohn [Tue, 11 May 2021 16:37:37 +0000 (18:37 +0200)]
Remove texts which were added by mistake in 00386272

Change-Id: Iaed25dac0bc9af8f3fda6138a5f9fe553bff5d39
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years agoFix formatting which was broken in 00386272 86/180486/1
Matthias Sohn [Tue, 11 May 2021 16:36:05 +0000 (18:36 +0200)]
Fix formatting which was broken in 00386272

Change-Id: I10a3e2b117e790f64386a8e9e7663db8e59230d9
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years agoMerge branch 'stable-5.10' into stable-5.11 38/180438/1
Matthias Sohn [Mon, 10 May 2021 22:57:46 +0000 (00:57 +0200)]
Merge branch 'stable-5.10' into stable-5.11

* stable-5.10:
  LockFile: create OutputStream only when needed
  Remove ReftableNumbersNotIncreasingException

Change-Id: Id6e0a78caf12c19a01a88d1ddb8a7df2b3590f98

3 years agoMerge branch 'stable-5.9' into stable-5.10 37/180437/1
Matthias Sohn [Mon, 10 May 2021 22:56:57 +0000 (00:56 +0200)]
Merge branch 'stable-5.9' into stable-5.10

* stable-5.9:
  LockFile: create OutputStream only when needed
  Remove ReftableNumbersNotIncreasingException
  Fix stamping to produce stable file timestamps

Change-Id: I056382d1d93f3e0a95838bdd1f0be89711c8a722

3 years agoMerge branch 'stable-5.8' into stable-5.9 36/180436/1
Matthias Sohn [Mon, 10 May 2021 22:55:54 +0000 (00:55 +0200)]
Merge branch 'stable-5.8' into stable-5.9

* stable-5.8:
  LockFile: create OutputStream only when needed
  Remove ReftableNumbersNotIncreasingException

Change-Id: I3274c97cf560398c3c4c27d6759500452f315db0

3 years agoMerge branch 'stable-5.7' into stable-5.8 35/180435/1
Matthias Sohn [Mon, 10 May 2021 22:51:21 +0000 (00:51 +0200)]
Merge branch 'stable-5.7' into stable-5.8

* stable-5.7:
  LockFile: create OutputStream only when needed
  Remove ReftableNumbersNotIncreasingException

Change-Id: Ib3f280e0741f87a0ff615d857a5ea39b35527e74

3 years agoMerge branch 'stable-5.6' into stable-5.7 34/180434/1
Matthias Sohn [Mon, 10 May 2021 22:19:10 +0000 (00:19 +0200)]
Merge branch 'stable-5.6' into stable-5.7

* stable-5.6:
  LockFile: create OutputStream only when needed

Change-Id: I7c0e37d2cee0923662a7e39df5a802a84c017e4f

3 years agoLockFile: create OutputStream only when needed 32/180432/1
Thomas Wolf [Tue, 4 May 2021 21:48:56 +0000 (23:48 +0200)]
LockFile: create OutputStream only when needed

Don't create the stream eagerly in lock(); that may cause JGit to
exceed OS or JVM limits on open file descriptors if many locks need
to be created, for instance when creating many refs. Instead create
the output stream only when one really needs to write something.

Bug: 573328
Change-Id: If9441ed40494d46f594a896d34a5c4f56f91ebf4
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
3 years agoRefactor CommitCommand to improve readability 42/178142/2
Matthias Sohn [Sat, 20 Mar 2021 10:35:27 +0000 (11:35 +0100)]
Refactor CommitCommand to improve readability

Change-Id: Id3cac81cd32c07f677b7f669d58e32b5290e1790
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years agoCommitCommand: fix formatting 41/178141/2
Matthias Sohn [Sat, 20 Mar 2021 10:20:52 +0000 (11:20 +0100)]
CommitCommand: fix formatting

Change-Id: I5efd1ffee4ebb08b3b5c27e29162493615727840
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years agoCommitCommand: remove unncessary comment 40/178140/2
Matthias Sohn [Sat, 20 Mar 2021 10:19:07 +0000 (11:19 +0100)]
CommitCommand: remove unncessary comment

Let the code speak for itself.

Change-Id: I6a6d6c327ffac23fc607295a7f4fd3131b3d1e58
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years agoEnsure post-commit hook is called after index lock was released 38/178138/3
Matthias Sohn [Sat, 20 Mar 2021 10:15:20 +0000 (11:15 +0100)]
Ensure post-commit hook is called after index lock was released

Otherwise a post-commit hook cannot modify the index.

Bug: 566934
Change-Id: I0093dccd93b2064f243544b516bdce198afdb18b
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years agosshd: try all configured signature algorithms for a key 43/178043/3
Thomas Wolf [Fri, 19 Mar 2021 08:35:34 +0000 (09:35 +0100)]
sshd: try all configured signature algorithms for a key

For RSA keys, there may be several configured signature algorithms:
rsa-sha2-512, rsa-sha2-256, and ssh-rsa. Upstream sshd has bug
SSHD-1105 [1] and always and unconditionally uses only the first
configured algorithm. With the default order, this means that it cannot
connect to a server that knows only ssh-rsa, like for instance Apache
MINA sshd servers older than 2.6.0.

This affects for instance bitbucket.org or also AWS Code Commit.

Re-introduce our own pubkey authenticator that fixes this.

Note that a server may impose a penalty (back-off delay) for subsequent
authentication attempts with signature algorithms unknown to the server.
In such cases, users can re-order the signature algorithm list via the
PubkeyAcceptedAlgorithms (formerly PubkeyAcceptedKeyTypes) ssh config.

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

Bug: 572056
Change-Id: I7fb9c759ab6532e5f3b6524e9084085ddb2f30d6
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
3 years agosshd: modernize ssh config file parsing 42/178042/2
Thomas Wolf [Fri, 19 Mar 2021 08:24:31 +0000 (09:24 +0100)]
sshd: modernize ssh config file parsing

OpenSSH has changed some things in ssh config files. Update our parser
to implement some of these changes:

* ignore trailing comments on a line
* rename PubkeyAcceptedKeyTypes to PubkeyAcceptedAlgorithms

Note that for the rename, openSSH still accepts both names. We do the
same, translating names whenever we get or set values.

Change-Id: Icccca060e6a4350a7acf05ff9e260f2c8c60ee1a
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
3 years agosshd: implement ssh config PubkeyAcceptedAlgorithms 41/178041/2
Thomas Wolf [Thu, 18 Mar 2021 20:16:48 +0000 (21:16 +0100)]
sshd: implement ssh config PubkeyAcceptedAlgorithms

Apache MINA sshd 2.6.0 appears to use only the first appropriate
public key signature algorithm for a particular key. See [1]. For
RSA keys, that is rsa-sha2-512. This breaks authentication at servers
that only know the older (and deprecated) ssh-rsa algorithm.

With PubkeyAcceptedAlgorithms, users can re-order algorithms in
the ssh config file per host, if needed. Setting

  PubkeyAcceptedAlgorithms ^ssh-rsa

will put "ssh-rsa" at the front of the list of algorithms, and then
authentication at such servers with RSA keys works again.

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

Bug: 572056
Change-Id: I86c3b93f05960c68936e80642965815926bb2532
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
3 years agoUpdate Orbit to R20210223232630 68/177468/1
Matthias Sohn [Tue, 9 Mar 2021 23:39:29 +0000 (00:39 +0100)]
Update Orbit to R20210223232630

Change-Id: I7577131b2c6e808b59f6c453233b261c64646d35
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years agoPrepare 5.11.1-SNAPSHOT builds 65/177465/1
Matthias Sohn [Tue, 9 Mar 2021 22:42:31 +0000 (23:42 +0100)]
Prepare 5.11.1-SNAPSHOT builds

Change-Id: I94628ccbb5099a65aa4345cfd28a141ff5555b68
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years agoJGit v5.11.0.202103091610-r 61/177461/1 v5.11.0.202103091610-r
Matthias Sohn [Tue, 9 Mar 2021 21:10:22 +0000 (22:10 +0100)]
JGit v5.11.0.202103091610-r

Change-Id: I8e6855eaf7228459f492036feb4e34ca085698a7
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years agoMerge branch 'master' into stable-5.11 44/177444/1
Matthias Sohn [Tue, 9 Mar 2021 17:00:55 +0000 (18:00 +0100)]
Merge branch 'master' into stable-5.11

* master:
  Manually set status of jmh dependencies
  Update DEPENDENCIES report for 5.11.0
  Add dependency to dash-licenses
  PackFile: Add id + ext based constructors
  GC: deleteOrphans: Use PackFile
  PackExt: Convert to Enum
  Restore preserved packs during missing object seeks
  Pack: Replace extensions bitset with bitmapIdx PackFile
  PackDirectory: Use PackFile to ensure we find preserved packs
  GC: Use PackFile to de-dup logic
  Create a PackFile class for Pack filenames

Change-Id: I1d56517cb6a95e10aed22cdb9e5f3e504872d110

3 years agoManually set status of jmh dependencies 25/177325/2
Matthias Sohn [Sun, 7 Mar 2021 17:41:05 +0000 (18:41 +0100)]
Manually set status of jmh dependencies

The following jmh dependencies were approved as works-with:
- jmh-core/1.21 has GPL-2.0 license and was approved in CQ20517
- jmh-generator-annprocess/1.21 has GPL-2.0 license and was approved in
CQ20518

Change-Id: Ibbe28c6e8359c576b23f40281e74f2e0d4a0dee0

3 years agoUpdate DEPENDENCIES report for 5.11.0 24/177324/3
Matthias Sohn [Sun, 7 Mar 2021 16:44:05 +0000 (17:44 +0100)]
Update DEPENDENCIES report for 5.11.0

Computed by dash license-tool-plugin [1].

[1] https://github.com/eclipse/dash-licenses

Change-Id: I28727115914613cefdcf9a9f462c195b6af23156

3 years agoAdd dependency to dash-licenses 23/177323/2
Matthias Sohn [Wed, 27 Jan 2021 23:25:06 +0000 (00:25 +0100)]
Add dependency to dash-licenses

This is required to run the license check using the license tool [1]
required by the Eclipse project handbook [2]:

mvn org.eclipse.dash:license-tool-plugin:license-check -Ddash.summary=DEPENDENCIES

Note: the tool still requires Java 11 hence it needs to be run in a
separate build step and is not yet integrated in the build which runs
on Java 8.

[1] https://github.com/eclipse/dash-licenses
[2] https://www.eclipse.org/projects/handbook/#ip-license-tool

Change-Id: Ib41d54de246c3c9499cc3be9f026294c39fdfd99

3 years agoPackFile: Add id + ext based constructors 92/177192/3
Nasser Grainawi [Thu, 4 Mar 2021 21:14:43 +0000 (14:14 -0700)]
PackFile: Add id + ext based constructors

Add new constructors to PackFile to improve a common use case where
callers know the directory, id, and extension, but previously needed to
construct a valid file name (with prefix, '.', etc) to create a
PackFile. Most callers can use the variant that has id as an ObjectId,
but provide an id as String variant too.

Change-Id: I39e4466abe8c9509f5916d5bfe675066570b8585
Signed-off-by: Nasser Grainawi <quic_nasserg@quicinc.com>
3 years agoGC: deleteOrphans: Use PackFile 91/177191/1
Nasser Grainawi [Thu, 4 Mar 2021 00:05:21 +0000 (17:05 -0700)]
GC: deleteOrphans: Use PackFile

It's easier to follow the logic here when we can use our own objects
instead of Strings.

Change-Id: I6a166edcc67903fc1ca3544f458634c4cef8fde7
Signed-off-by: Nasser Grainawi <quic_nasserg@quicinc.com>
3 years agoPackExt: Convert to Enum 53/176953/3
Nasser Grainawi [Fri, 26 Feb 2021 22:49:06 +0000 (15:49 -0700)]
PackExt: Convert to Enum

This class already looked very much like an Enum, but wasn't one.

As an Enum, we can use PackExt in EnumMaps and EnumSets. Convert the
Map key usage in PackDirectory to an EnumMap.

Change-Id: Ice097fd468a05805f914e6862fbd1d96ec8c45d1
Signed-off-by: Nasser Grainawi <quic_nasserg@quicinc.com>
3 years agoRestore preserved packs during missing object seeks 88/122288/14
Martin Fick [Tue, 15 Dec 2020 21:20:44 +0000 (14:20 -0700)]
Restore preserved packs during missing object seeks

Provide a recovery path for objects being referenced during the pack
pruning race. Due to the pack pruning race, it is possible for objects
to become referenced after a pack has been deemed safe to prune, but
before it actually gets pruned. If this happened previously, the newly
referenced objects would be missing and potentially result in a
corrupted ref.

Add the ability to recover from this situation when an object is missing
but happens to still be available in a pack in the "preserved"
directory. This is likely only useful when used in conjunction with the
--preserve-old-packs GC option, which prunes packs by hard-linking to
the preserved directory. If an object is missing and found in a pack in
the preserved directory, immediately recover that pack and its
associated files (idx, bitmaps...) by moving them back to the original
pack directory, and then retry the operation that would have failed due
to the missing object. This retry can now succeed and the repository
may avoid corruption. This approach should drastically reduce the
chance of a corrupt repository during pack pruning at very little extra
cost. This extra cost should only be incurred when objects are missing
and a failure would normally occur.

Change-Id: I2a704e3276b88cc892159d9bfe2455c6eec64252
Signed-off-by: Martin Fick <quic_mfick@quicinc.com>
Signed-off-by: Nasser Grainawi <quic_nasserg@quicinc.com>
3 years agoPack: Replace extensions bitset with bitmapIdx PackFile 29/175129/8
Nasser Grainawi [Thu, 11 Feb 2021 06:26:17 +0000 (23:26 -0700)]
Pack: Replace extensions bitset with bitmapIdx PackFile

The only extension that was ever consulted from the bitmap was the
bitmap index. We can simplify the Pack code as well as the code of
all the callers if we focus on just that usage.

Change-Id: I799ddfdee93142af67ce5081d14a430d36aa4c15
Signed-off-by: Nasser Grainawi <quic_nasserg@quicinc.com>
3 years agoPackDirectory: Use PackFile to ensure we find preserved packs 30/175130/11
Nasser Grainawi [Thu, 11 Feb 2021 06:33:43 +0000 (23:33 -0700)]
PackDirectory: Use PackFile to ensure we find preserved packs

Update scanPacksImpl and listPackDirectory (renamed to
getPackFilesByExtById) to use the new PackFile functionality to
validate file names and complete pack file sets (.pack, .idx, etc).

Most importantly, this allows a later change to rely on scanPacks() to
complete a packList that contains packs with the 'old-' prefix in their
extension.

This also eliminates duplication of logic for how to identify and
construct pack files.

Change-Id: I7175e5fefb187a29e0a7cf53c392aee922314f31
Signed-off-by: Nasser Grainawi <quic_nasserg@quicinc.com>
3 years agoGC: Use PackFile to de-dup logic 33/176533/4
Nasser Grainawi [Fri, 19 Feb 2021 00:36:49 +0000 (17:36 -0700)]
GC: Use PackFile to de-dup logic

GC has several places where it tries to build files names for packs that
we can use the PackFile class for instead.

Change-Id: I99e5ceff9050f8583368fca35279251955e4644d
Signed-off-by: Nasser Grainawi <quic_nasserg@quicinc.com>
3 years agoCreate a PackFile class for Pack filenames 45/176145/5
Nasser Grainawi [Thu, 11 Feb 2021 05:51:05 +0000 (22:51 -0700)]
Create a PackFile class for Pack filenames

The PackFile class is intended to be a central place to do all
common pack filename manipulation and parsing to help reduce repeated
code and bugs. Use the PackFile class in the Pack class and in many
tests to ensure it works well in a variety of situations. Later changes
will expand use of PackFiles to even more areas.

Change-Id: I921b30f865759162bae46ddd2c6d669de06add4a
Signed-off-by: Nasser Grainawi <quic_nasserg@quicinc.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years agoPrepare 5.11.0-SNAPSHOT builds 63/177163/1
Matthias Sohn [Thu, 4 Mar 2021 15:27:51 +0000 (16:27 +0100)]
Prepare 5.11.0-SNAPSHOT builds

Change-Id: I89ed49a6acc53dd75d16f40c99e1140e0c18f646
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years agoJGit v5.11.0.202103031150-rc1 07/177107/1 v5.11.0.202103031150-rc1
Matthias Sohn [Wed, 3 Mar 2021 16:48:00 +0000 (17:48 +0100)]
JGit v5.11.0.202103031150-rc1

Change-Id: I0a86fa59645888f9f36ea6938c9121e095f02fc6
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years agoMerge branch 'master' into stable-5.11 03/177103/1
Matthias Sohn [Wed, 3 Mar 2021 16:44:20 +0000 (17:44 +0100)]
Merge branch 'master' into stable-5.11

* master:
  HTTP: cookie file stores expiration in seconds
  Update Orbit to S20210223232630
  LFS: handle invalid pointers better
  Fix errorprone configuration for maven-compiler-plugin with javac

Change-Id: Ib76e754bd36789de0a3c6b85a4814aa1fe9cb401

3 years agoHTTP: cookie file stores expiration in seconds 83/176983/3
Thomas Wolf [Mon, 1 Mar 2021 07:30:09 +0000 (08:30 +0100)]
HTTP: cookie file stores expiration in seconds

A cookie file stores the expiration in seconds since the Linux Epoch,
not in milliseconds. Correct reading and writing cookie files; with
a backwards-compatibility hack to read files that contain a millisecond
timestamp.

Add a test, and fix tests not to rely on the actual current time so
that they will also run successfully after 2030-01-01 noon.

Bug: 571574
Change-Id: If3ba68391e574520701cdee119544eedc42a1ff2
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
3 years agoMerge "Update Orbit to S20210223232630"
Matthias Sohn [Tue, 2 Mar 2021 16:07:49 +0000 (11:07 -0500)]
Merge "Update Orbit to S20210223232630"

3 years agoUpdate Orbit to S20210223232630 19/177019/1
Matthias Sohn [Mon, 1 Mar 2021 21:10:22 +0000 (22:10 +0100)]
Update Orbit to S20210223232630

Change-Id: Ida7a54cfe0bd15c1c28b892dea3452958924f0c0
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years agoLFS: handle invalid pointers better 22/175522/6
Thomas Wolf [Fri, 29 Jan 2021 22:03:44 +0000 (23:03 +0100)]
LFS: handle invalid pointers better

Make sure that SmudgeFilter calls LfsPointer.parseLfsPointer() with
a stream that supports mark/reset, and make sure that parseLfsPointer()
resets the stream properly if it decides that the stream content is not
a LFS pointer.

Add a test.

Bug: 570758
Change-Id: I2593d67cff31b2dfdfaaa48e437331f0ed877915
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
3 years agoRemove ReftableNumbersNotIncreasingException 10/159910/2
Han-Wen Nienhuys [Mon, 1 Mar 2021 11:17:54 +0000 (12:17 +0100)]
Remove ReftableNumbersNotIncreasingException

In a distributed setting, one can have multiple datacenters use
reftables for serving, while the ground truth for the Ref database is
administered centrally. In this setting, replication delays combined
with compaction can cause update-index ranges to overlap.

Such a setting is used at Google, and the JGit code already handles
this correctly (modulo a bugfix that applied in change I8f8215b99a).

Remove the restriction that was applied at FileReftableDatabase.

Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Change-Id: I6f9ed0fbd7fbc5220083ab808b22a909215f13a9

3 years agoFix errorprone configuration for maven-compiler-plugin with javac 27/174127/3
Matthias Sohn [Sun, 27 Dec 2020 01:11:47 +0000 (02:11 +0100)]
Fix errorprone configuration for maven-compiler-plugin with javac

See https://errorprone.info/docs/installation.

Add new profile jdk8 to enable running errorprone with javac on java 8
and java 11. Remove errorprone configuration from benchmark module,
didn't find a way to make it work and this module does not contain any
productive code.

Change-Id: I6a84195af05e6cea9e7c04ad5cd4c79742e80cb3
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years agoMerge branch 'stable-5.11' 80/176880/1
Matthias Sohn [Thu, 25 Feb 2021 08:09:57 +0000 (09:09 +0100)]
Merge branch 'stable-5.11'

* stable-5.11:
  Prepare 5.11.0-SNAPSHOT builds
  JGit v5.11.0.202102240950-m3

Change-Id: Ia216a698dd4f0dd235dfe4de4d2cc127aa530eed

3 years agoPrepare 5.11.0-SNAPSHOT builds 57/176857/1
Matthias Sohn [Wed, 24 Feb 2021 20:21:34 +0000 (21:21 +0100)]
Prepare 5.11.0-SNAPSHOT builds

Change-Id: If3dbe084ee37ae4b993d3a10ec48b14e8709ff6d
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years agoJGit v5.11.0.202102240950-m3 39/176839/1 v5.11.0.202102240950-m3
Matthias Sohn [Wed, 24 Feb 2021 14:50:41 +0000 (15:50 +0100)]
JGit v5.11.0.202102240950-m3

Change-Id: Iea6b3515fa63db497989194b6bf50fe7324086d0
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years agoMerge branch 'master' into stable-5.11 13/176813/1
Matthias Sohn [Wed, 24 Feb 2021 13:54:52 +0000 (14:54 +0100)]
Merge branch 'master' into stable-5.11

* master: (35 commits)
  [releng] japicmp: update last release version
  IgnoreNode: include path to file for invalid .gitignore patterns
  FastIgnoreRule: include bad pattern in log message
  init: add config option to set default for the initial branch name
  init: allow specifying the initial branch name for the new repository
  Fail clone if initial branch doesn't exist in remote repository
  GPG: fix reading unprotected old-format secret keys
  Update Orbit to S20210216215844
  Add missing bazel dependency for o.e.j.gpg.bc.test
  GPG: handle extended private key format
  dfs: handle short copies
  [GPG] Provide a factory for the BouncyCastleGpgSigner
  Fix boxing warnings
  GPG: compute the keygrip to find a secret key
  GPG signature verification via BouncyCastle
  Post commit hook failure should not cause commit failure
  Allow to define additional Hook classes outside JGit
  GitHook: use default charset for output and error streams
  GitHook: use generic OutputStream instead of PrintStream
  Update jetty to 9.4.36.v20210114
  ...

Change-Id: I1cf5ab262c67b986e82422c48dfc103e335d28cc

3 years ago[releng] japicmp: update last release version 55/176755/3
Thomas Wolf [Tue, 23 Feb 2021 21:17:07 +0000 (22:17 +0100)]
[releng] japicmp: update last release version

The baseline for the 5.11 release is 5.10.0.202012080955-r.

Change-Id: Ied9b42dc58ba981e5586fa58d1b3e70a39c78a10
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
3 years agoIgnoreNode: include path to file for invalid .gitignore patterns 44/176744/2
Thomas Wolf [Tue, 23 Feb 2021 17:10:08 +0000 (18:10 +0100)]
IgnoreNode: include path to file for invalid .gitignore patterns

Include the full file path of the .gitignore file and the line number
of the invalid pattern. Also include the pattern itself.

.gitignore files inside the repository are reported with their
repository-relative path; files outside (from git config
core.excludesFile or .git/info/exclude) are reported with their
full absolute path.

Bug: 571143
Change-Id: Ibe5969679bc22cff923c62e3ab9801d90d6d06d1
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
3 years agoFastIgnoreRule: include bad pattern in log message 31/176731/2
Thomas Wolf [Tue, 23 Feb 2021 12:11:56 +0000 (13:11 +0100)]
FastIgnoreRule: include bad pattern in log message

When a .gitignore pattern cannot be parsed include the pattern in the
log message. Just reporting "not closed bracket" isn't helpful if the
user doesn't know in which pattern the problem occurred.

Even better would be to include the full path of the .gitignore file
that contained the offending pattern. This is not implemented in this
change; it may need new API and needs more thought.

Bug: 571143
Change-Id: Id5b16d9cf550544ba3ad409a02041946fa8516ab
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>