Commit Graph

8223 Commits

Author SHA1 Message Date
Matthias Sohn a56624349e [spotbugs] silence short-circuit warning in PackOutputStream#write
Change-Id: I47b7a7991afae0dd1e678bd5e1f8e81599791e5f
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2020-12-17 17:18:11 +01:00
Matthias Sohn f29668f7a0 [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>
2020-12-17 17:18:11 +01:00
Matthias Sohn 5b16f32de0 FetchProcess#execute: fix formatting
Change-Id: I133af64e6b165bdc58b8d7c805f0c68b6919baf2
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2020-12-17 17:18:11 +01:00
Matthias Sohn c8c0556f76 [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>
2020-12-17 17:18:11 +01:00
Matthias Sohn 9680407e45 [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>
2020-12-17 17:18:11 +01:00
Matthias Sohn 5dfe4c096e Remove unused API problem filters
Change-Id: I982f21dfaec4e35818eca7a4793e24a2cec4e467
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2020-12-15 02:00:35 +01:00
Han-Wen Nienhuys 7386f73bb0 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>
2020-12-15 02:00:35 +01:00
Matthias Sohn 8548cb4e51 LsRemote: suppress warning for non-externalized string
Change-Id: Ic1d8f2eef4a8de0a75d5b523b584b1ac275a8811
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2020-12-15 02:00:35 +01:00
Matthias Sohn 3fc8da3a3c LooseObjects: fix formatting
Change-Id: I992e5066d1dc4603e5bae991b26605d319f5cdc2
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2020-12-15 02:00:17 +01:00
Martin Fick ecad2dc0a6 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>
2020-12-15 00:18:32 +01:00
Matthias Sohn 415788df28 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>
2020-12-14 16:03:35 +01:00
David Ostrovsky 5d925ecbb3 Fix stamping to produce stable file timestamps
Change-Id: I628ab5feb4a70f81ec832f1b81d1ad3a9caca615
2020-12-14 15:45:29 +01:00
Matthias Sohn ff0590812a PackDirectory: fix formatting
Change-Id: I10586981323529c7e9041110ebb58033e7180194
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2020-12-12 23:32:09 +01:00
Martin Fick a84a2d22ab 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>
2020-12-12 23:15:21 +01:00
Thomas Wolf e3ac56e2d0 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>
2020-12-08 22:20:46 +01:00
Thomas Wolf 29e1270768 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>
2020-12-08 22:20:45 +01:00
Matthias Sohn dc8a927ce4 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>
2020-12-08 21:00:27 +01:00
Matthias Sohn 1363b1acfe Prepare 5.10.1-SNAPSHOT builds
Change-Id: If1e44edfa0a80a29c00ed5112291d1338baf56f1
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2020-12-08 17:35:15 +01:00
Matthias Sohn 4262a68f55 JGit v5.10.0.202012080955-r
Change-Id: I7ca88bcc54992625a6fafd84172adee58d487dc3
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2020-12-08 15:56:08 +01:00
Thomas Wolf 41b9159795 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>
2020-12-07 09:33:57 +01:00
Thomas Wolf 5abd8a4feb 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>
2020-12-07 09:04:33 +01:00
Tudor Matrescu aa3a1ecd13 Added check for null on DirCacheEntry in checkoutEntry method
Observed the error when trying to force checkout from a branch
that had no changes on it. When the 'keep()' method from 'DirCacheCheckout'
method was called the 'DirCacheEntry e' was null and was passed like
this to the 'checkoutEntry()' method where the 'getObjectId()' is
being called on the 'e' object

Change-Id: If3a9b9e60064459d187c7db04eb4471a72c6cece
2020-12-03 02:59:10 -05:00
Matthias Sohn 99d612db2b 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
2020-12-03 00:51:23 +01:00
Matthias Sohn ad7806f4ef Prepare 5.10.0-SNAPSHOT builds
Change-Id: I9cc9fa32a737b4916cdb5b52bac8f724ebee09bc
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2020-12-02 21:11:20 +01:00
Matthias Sohn 13b866a6f8 JGit v5.10.0.202012021225-rc1
Change-Id: Ic774356e09bb9d24e5d99334bd4ea173bd4071ec
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2020-12-02 18:25:20 +01:00
Matthias Sohn 4380921d66 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>
2020-12-02 16:56:52 +01:00
Matthias Sohn 9034c7d423 Prepare 5.11.0-SNAPSHOT builds
Change-Id: I91e5532526775191fbd34f81e2ef777cba605e3b
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2020-12-02 15:57:16 +01:00
Matthias Sohn 485e4f9cf1 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>
2020-12-02 15:49:59 +01:00
Matthias Sohn 205ee010f6 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>
2020-12-02 15:34:14 +01:00
Matthias Sohn 9a1065afec 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>
2020-12-02 15:31:11 +01:00
Matthias Sohn 8f422e9a9a 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
2020-12-02 15:28:33 +01:00
Matthias Sohn f621c31f4c 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>
2020-12-02 15:26:00 +01:00
Matthias Sohn c9d871f15d 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>
2020-12-02 15:21:32 +01:00
Matthias Sohn e62a93955b 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>
2020-12-02 15:16:11 +01:00
Matthias Sohn e8948056fa 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>
2020-12-02 14:26:37 +01:00
Matthias Sohn 0a63e045c9 Prepare 5.3.10-SNAPSHOT builds
Change-Id: I6f131ad04574bd0d569ae6a59c29ea987be0efb2
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2020-12-02 13:09:57 +01:00
Matthias Sohn aa5d1e425c JGit v5.3.9.202012012026-r
Change-Id: I75e03ef8630d7a369e97be0f797253b968575354
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2020-12-02 02:27:44 +01:00
Matthias Sohn 5bb71dd2d4 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>
2020-12-02 02:19:11 +01:00
Matthias Sohn babc56ef0f 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>
2020-12-02 02:17:41 +01:00
Matthias Sohn 5e0cfce5ad Prepare 5.1.16-SNAPSHOT builds
Change-Id: I50e59e1e73a92fa4fe366398fb8141f5e2e289c1
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2020-12-02 02:02:48 +01:00
Matthias Sohn f72a001250 JGit v5.1.15.202012011955-r
Change-Id: Icb4f04a40ab366cbacbb3fdf0db1748f27277fda
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2020-12-02 01:53:39 +01:00
Petr Hrebejk 2fbbd6d890 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 -
afef866a44

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>
2020-12-02 01:43:25 +01:00
Marco Miller 0a991fad5d Upgrade maven-pmd-plugin to 3.14.0
Change-Id: I45b49e1262db50e74b43c6273d3b3df692765330
Signed-off-by: Marco Miller <marco.miller@ericsson.com>
2020-12-01 19:25:42 -05:00
Matthias Sohn a68f241247 Update Orbit to R20201130205003 for 2020-12
Change-Id: I9a563d6f125e9a3983990b8a111d3288c9100162
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2020-12-01 21:32:35 +01:00
Matthias Sohn 85ac3c5996 Use new protocol version constants
Change-Id: Icd6b876e392c55a7322a990ac7f618250b732b4b
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2020-11-30 16:54:16 +01:00
Matthias Sohn 180dfdefa4 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>
2020-11-30 16:54:02 +01:00
Thomas Wolf c053b510b3 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>
2020-11-30 13:02:18 +01:00
David Ostrovsky 23389a6323 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>
2020-11-29 22:46:51 +01:00
Matthias Sohn 4f30dc5eb9 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>
2020-11-29 20:16:38 +01:00
David Ostrovsky 96411d1abb 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>
2020-11-28 23:29:41 +01:00