Commit Graph

8129 Commits

Author SHA1 Message Date
Matthias Sohn 1ed6353962 [spotbugs] Fix potential NPE in PackFileSnapshotTest
Path#getFileName can return null. Fix the warning by asserting the file
name isn't null.

Change-Id: I7f2fe75b46113d8be1d14e3f18dd77da27df25ed
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2020-12-17 18:42:00 +01:00
Matthias Sohn cc7a1891ee [spotbugs] Fix potential NPEs in FileReftableStackTest
File#listFiles can return null. Use Files#list instead to fix the
problem.

Change-Id: I74e0b49aa6dae370219507c64aa43be4d8aa7b82
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2020-12-17 18:42:00 +01:00
Matthias Sohn 90b046e7ab [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>
2020-12-17 18:42:00 +01:00
Matthias Sohn b1d8e8642f [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>
2020-12-17 18:42:00 +01:00
Matthias Sohn 3705ac5839 [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>
2020-12-17 18:41:52 +01:00
Matthias Sohn a2bb540f29 [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>
2020-12-17 17:18:11 +01:00
Matthias Sohn 15998622fa [spotbugs] silence warnings for intended use of == to compare strings
Change-Id: Ib6967ad4deb5cf233d1f1d714cd094da5fad48e3
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2020-12-17 17:18:11 +01:00
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
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