Commit Graph

8129 Commits

Author SHA1 Message Date
David Pursehouse e342d6a2d8 LfsConnectionFactory#getLfsUrl: Fix unconditional break in for-loop
When iterating over the remote URLs to find one that matches "origin",
it always exits after the first iteration whether it has found the
remote or not. The break should be inside the conditional block so
that it exits when "origin" is found, otherwise continues to iterate
over the remaining remote URLs.

Found by Sonar Lint.

Change-Id: Ic969e54071d1cf095334007c1c1bab6579044dd2
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2020-06-29 08:57:38 +09:00
David Pursehouse 14509f4cbb DiffFormatterTest: Add a test to confirm the default rename detection settings
Add a test that confirms:

- No rename detector is initialized by default

- Rename detector is initialized after calling setDetectRenames(true)

- Rename limit and rename score have the default values 400 and
  60, respectively. Note that there are no constants for these values
  so the test hard codes them.

Change-Id: I327e2b348a40ef67d8a184e5ab09f4e9ab573e1c
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2020-06-26 11:24:48 +09:00
David Pursehouse d1577f79c4 Upgrade maven-site-plugin to 3.9.1
Change-Id: I8fd46eef2851d48429b21c543c2441efcb1378fe
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2020-06-25 19:05:07 +09:00
David Pursehouse 73717f7660 Upgrade build-helper-maven-plugin to 3.2.0
Change-Id: I1826a1641e026320d433031c45030712977e8151
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2020-06-25 16:44:32 +09:00
David Pursehouse b67224005c Upgrade spotbugs to 4.0.4
Change-Id: I774e625efe486383c66a034091da16500677466a
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2020-06-25 16:44:32 +09:00
Matthias Sohn 93612d4f8e Merge branch 'stable-5.8'
* stable-5.8:
  Add new osgi fragments to maven-central deploy scripts
  Do not require org.assertj.core.annotations

Change-Id: I338065e7d2bf95b59a13d09cff7aea0c7689fe42
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2020-06-25 00:10:28 +02:00
Minh Thai 9719ca411e MergedReftable: Include the last reftable in determining minUpdateIndex
MergedReftable ignores the last reftable in the stack while calculating the
minUpdateIndex.

Update the loop indices to include all reftables in the minUpdateIndex
calculation, while skipping position 0 as it is read outside the loop.

Change-Id: I12d3e714581e93d178be79c02408a67ab2bd838e
Signed-off-by: Minh Thai <mthai@google.com>
2020-06-22 17:14:35 -07:00
Matthias Sohn f2bfaca084 Add new osgi fragments to maven-central deploy scripts
Change-Id: I075b539fcc72f7492573426247134aed7a545fe9
2020-06-20 09:25:06 +02:00
Terry Parker 641069971d Merge "PackBitmapIndex: Not buffer inflated bitmap during bitmap creation." 2020-06-19 21:23:56 -04:00
Yunjie Li b94758441d PackBitmapIndex: Not buffer inflated bitmap during bitmap creation.
Currently we're buffering the inflated bitmap entry in
BasePackBitmapIndex to optimize running time. However, this will use
lots of memory during the creation of the pack bitmap index file.

And change 161456, which rewrote the entire getBitmap method, increased
the fetch latency significantly.

This commit introduces getBitmapWithoutCaching method which is used in
the pack bitmap index file creation only and aims to save memory during
garbage collection and not increase fetch latency.

Change-Id: I7b982c9d4e38f5f6193eaa03894e894ba992b33b
Signed-off-by: Yunjie Li <yunjieli@google.com>
2020-06-18 12:36:42 -07:00
Sebastian Ratz 979ed737a2 Do not require org.assertj.core.annotations
Bug: 564410
Change-Id: I9797f1dbc9338056c4f8c43fddc4a998ca14e319
Signed-off-by: Sebastian Ratz <sebastian.ratz@sap.com>
2020-06-18 13:02:30 +02:00
David Pursehouse b2e260e618 Upgrade ecj to 3.22.0
Change-Id: I97a99f6245afb49d916e226b16a5e60927f32353
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2020-06-18 18:31:14 +09:00
Matthias Sohn c3db32d51a Remove workaround for signing jars using Tycho plugins
The workaround became obsolete when https://git.eclipse.org/r/#/c/16027/
was released.

Change-Id: Id20f79a1059550c1e5637fec30ae09a202cb2f2a
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2020-06-14 21:11:29 +02:00
Matthias Sohn fa0f47698a Use https for URL of jgit website
Change-Id: Ic9bcbac5de23f670ae6b008a201b1fe9c6478fab
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2020-06-14 20:39:27 +02:00
Matthias Sohn 1d6385280f Fix CI information in pom.xml
Change-Id: I066702cd9f4465eff919e46fc0cc8558d3f3178b
2020-06-14 20:35:45 +02:00
Matthias Sohn c40ee7b4b9 Use gitiles as scm url in pom.xml for browsing source code
Change-Id: I6c18ffe822f62883d2f331ad77c28ce8afc3ebd8
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2020-06-14 20:34:18 +02:00
Matthias Sohn 96fd562d02 Update API baseline to 5.8.0.202006091008-r
Change-Id: I3afc8a9ec5a49b9dd0b392b56fd1860a6285ec2f
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2020-06-10 15:44:25 +02:00
Matthias Sohn 13802cd592 Remove trailing whitespace
Change-Id: I1635b79c8051699a3a5e78a4cef8d2014be4e92c
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2020-06-10 10:48:55 +02:00
Demetr Starshov 0ec6e4b3d5 SimpleMergeTest: Clean up code style
Signed-off-by: Demetr Starshov <dstarshov@google.com>
Change-Id: Ib0149279324a8b085eec4c60d02c8f32a8cc86bb
2020-06-10 11:35:58 +09:00
Matthias Sohn 760cf0ba16 Merge branch 'stable-5.8'
* stable-5.8:
  Prepare 5.8.1-SNAPSHOT builds
  Handle Fragment-Host declaration when updating version
  JGit v5.8.0.202006091008-r

Change-Id: I956947c8bbceb09f9cf9bfc58fff2ed6a15aba99
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2020-06-09 21:31:45 +02:00
Matthias Sohn 6abe695aa5 Prepare 5.8.1-SNAPSHOT builds
Change-Id: Ic654fb45abe4e94f4eee532af0f4278d372d37f5
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2020-06-09 16:45:56 +02:00
Matthias Sohn 4475a55f84 Handle Fragment-Host declaration when updating version
Change-Id: If7ad9c4b26025e4358e3b4228dda43fdf93d2978
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
(cherry picked from commit a51b440840)
2020-06-09 16:45:19 +02:00
Matthias Sohn 8e79d5a290 JGit v5.8.0.202006091008-r
Change-Id: I2020e9821c359b90b7c830031945e2fc659ea607
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2020-06-09 16:07:50 +02:00
Matthias Sohn 855842af19 Prepare 5.9.0-SNAPSHOT builds
Change-Id: Ia998e2772df1285a4c674b07201f15d53156eb78
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2020-06-09 12:51:12 +02:00
Matthias Sohn a51b440840 Handle Fragment-Host declaration when updating version
Change-Id: Ic1b17245f221496818a975bc4f07b74878d257a5
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2020-06-09 12:50:18 +02:00
Matthias Sohn 80dcd94bfd Merge branch 'master' into stable-5.8
* master:
  Add benchmark for strategies how to move a file
  Add getter for unpackErrorHandler in ReceivePack
  Upgrade maven-project-info-reports-plugin to 3.1.0
  Upgrade maven-shade-plugin to 3.2.4
  ObjectDirectoryInserter: Open FileOutputStream in try-with-resource
  ObjectDirectoryInserter: Remove redundant 'throws' declarations
  ObjectDirectory: Further clean up insertUnpackedObject
  Add Git#shutdown for releasing resources held by JGit process
  ApplyCommand: use context lines to determine hunk location
  GPG: don't prompt for a passphrase for unprotected keys
  Fix typo in org.eclipse.jgit.ssh.jsch.test MANIFEST
  Fix ProtectedMembersInFinalClass warning flagged by error prone
  Use version range to define fragment host bundle version
  ObjectDirectory: Explicitly handle NoSuchFileException
  ObjectDirectory: Fail immediately when atomic move is not supported
  Fix jgit packaging
  Fix InvalidInlineTag error flagged by error prone
  Fix BadComparable error flagged by error prone
  Add tests for RawTextComparator.WS_IGNORE_CHANGE.hash()
  Update Orbit to R20200529191137 for final Eclipse release 2020-06
  Organize manifest of org.eclipse.jgit.pgm
  Do not include log4j implementation in jgit
  Decouple JSch from JGit Core
  Decouple BouncyCastle from JGit Core
  Verify that the user home directory is valid
  WindowCache: conditional JMX setup
  RawTextComparator.WS_IGNORE_CHANGE must not compare whitespace
  Revert "PackBitmapIndex: Not buffer inflated bitmap in BasePackBitmapIndex"
  Update jetty to 9.4.28.v20200408
  Add 4.16 staging target platform
  In-memory SSH keys for the "no files" sshd tests
  Builder API to configure SshdSessionFactories
  TransportHttp: abort on time-out or on SocketException
  Ignore core.eol if core.autocrlf=input
  Attributes: fix handling of text=auto in combination with eol
  Bazel: Remove superfluous dependencies flagged by unused_deps
  Log stack trace if CachingKeyPairProvider hits unexpected exception
  Update Orbit to S20200519202422 and ant to 1.10.8
  Include full IssuerFingerprint in GPG signature
  Bazel: Fix src_sha1 of bcpg-jdk15on
  Suppress API error for new method BitmapIndex.Bitmap#retrieveCompressed
  Fix wrong @since tags added in dcb0265
  PackBitmapIndex: Set distance threshold
  PackBitmapIndex: Not buffer inflated bitmap in BasePackBitmapIndex
  PackBitmapIndex: Remove convertedBitmaps in the Remapper
  PackBitmapIndex: Reduce memory usage in GC
  PackBitmapIndex: Add AddToBitmapWithCacheFilter class
  PackBitmapIndex: Add util methods and builder to BitmapCommit
  PackBitmapIndex: Move BitmapCommit to a top-level class
  Refactor: Make retriveCompressed an method of the Bitmap class
  Fix downloading LFS Object fails behind proxy
  Allow for using custom s3 host with lfs server
  ReceivePack: adding IterativeConnectivityChecker
  Moving transport/internal -> internal/transport
  Fix error occurring during checkout

Change-Id: I675cfb9eee956bab4903f28d8021115afc753dcd
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2020-06-08 00:33:13 +02:00
Matthias Sohn 8a44216e8b Add benchmark for strategies how to move a file
We can either
- try moving the file and, in case the target directory doesn't exist,
  handle the NoSuchFileException this raises to create the target
  directory
- or we always first test if the target directory exists and create it
 in case it is missing

On my Mac this yields

Benchmark                                        Mode  Cnt    Score     Error  Units
FileMoveBenchmark.moveFileToExistingDir        avgt    5  196.490 ±  15.194  us/op
FileMoveBenchmark.moveFileToExistingDirExists  avgt    5  223.217 ±  54.816  us/op
FileMoveBenchmark.moveFileToMissingDir         avgt    5  332.169 ±  43.871  us/op
FileMoveBenchmark.moveFileToMissingDirExists   avgt    5  303.815 ± 137.568  us/op

This means if the target directory of the move already exists the
first strategy is faster by around 25 us/op otherwise the second one
is faster by around 30 us/op. Which one is favorable depends on the
average probability that the target directory exists in real world
scenarios.

Change-Id: I03653b408b859a796508dfa1471b36c65633534e
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2020-06-06 11:10:35 +02:00
Matthias Sohn 001d747419 Merge "Merge branch 'stable-5.7'" 2020-06-05 16:56:32 -04:00
Jack Wickham 259d2540a3 Add getter for unpackErrorHandler in ReceivePack
The current mechanism for updating the unpack error handler requires
that the error handler is replaced entirely, including communicating
the error to the user. Adding a getter means that delegating
implementations can be constructed so that the error can be processed
before sending to the user, for example for logging.

Change-Id: I4b6f78a041d0f6f5b4076a9a5781565ca3857817
Signed-off-by: Jack Wickham <jwickham@palantir.com>
2020-06-05 15:25:22 -04:00
David Pursehouse 1b4b05d4a3 Merge branch 'stable-5.7'
* stable-5.7:
  ObjectDirectoryInserter: Open FileOutputStream in try-with-resource
  ObjectDirectoryInserter: Remove redundant 'throws' declarations
  ObjectDirectory: Further clean up insertUnpackedObject
  ObjectDirectory: Explicitly handle NoSuchFileException
  ObjectDirectory: Fail immediately when atomic move is not supported

Change-Id: I05186baa517388680fcc6825c940c4c772f26d32
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2020-06-05 17:09:38 +09:00
David Pursehouse 18050b569f Upgrade maven-project-info-reports-plugin to 3.1.0
Change-Id: I16e24bbec033ea707cb5c5a0ff3c21859e602f39
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2020-06-05 02:23:00 -04:00
David Pursehouse 6e6590d27e Upgrade maven-shade-plugin to 3.2.4
Change-Id: Iba47e9304b6f20e8aa4855378bc86063919bb909
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2020-06-05 02:22:48 -04:00
David Pursehouse c0c7f445f4 ObjectDirectoryInserter: Open FileOutputStream in try-with-resource
Change-Id: Icc569aeefdc79baee5dfb71fb34d881c561dcf52
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2020-06-05 14:59:54 +09:00
David Pursehouse f4f5d448b6 ObjectDirectoryInserter: Remove redundant 'throws' declarations
ObjectWritingException and FileNotFoundException are subclasses
of IOException, which is already declared. Error does not need
to be explicitly declared.

Change-Id: I879820a33e10ec3a7ef676adc9c9148d2b3c4b27
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2020-06-05 14:48:15 +09:00
David Pursehouse dac6801b47 ObjectDirectory: Further clean up insertUnpackedObject
- The code to move the file is repeated. Split it out into a
  utility method.

- Remove the catch block for AtomicMoveNotSupportedException which
  is redundant because it's handled in exactly the same way as the
  IOException further down. The only exception we need to explicitly
  handle differently in this block is NoSuchFileException.

- Improve the comments.

Change-Id: Ifc5490953ffb25ecd1c48a06289eccb3f19910c6
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2020-06-05 11:40:08 +09:00
Matthias Sohn aea95b819a Add Git#shutdown for releasing resources held by JGit process
The shutdown method releases
- ThreadLocal held by NLS
- GlobalBundleCache used by NLS
- Executor held by WorkQueue

Bug: 437855
Bug: 550529
Change-Id: Icfdccd63668ca90c730ee47a52a17dbd58695ada
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2020-06-04 23:51:59 +02:00
Thomas Wolf ed481f96b8 ApplyCommand: use context lines to determine hunk location
If a hunk does not apply at the position stated in the hunk header
try to determine its position using the old lines (context and
deleted lines).

This is still a far cry from a full git apply: it doesn't do binary
patches, it doesn't handle git's whitespace options, and it's perhaps
not the fastest on big patches. C git hashes the lines and uses these
hashes to speed up matching hunks (and to do its whitespace magic).

Bug: 562348
Change-Id: Id0796bba059d84e648769d5896f497fde0b787dd
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2020-06-04 22:16:12 +02:00
Thomas Wolf e3f7a06764 GPG: don't prompt for a passphrase for unprotected keys
BouncyCastle supports reading GPG keys without passphrase since 1.62.
Handle this in JGit, too, and don't prompt for a passphrase unless
it's necessary.

Make two passes over the private key files, a first pass without
passphrase provider. If that succeeds it has managed to read a
matching key without passphrase. Otherwise, ask the user for
the passphrase and make a second pass over the key files.

BouncyCastle 1.65 still has no method to get the GPG "key grip" from
a given public key, so JGit still cannot determine the correct file
to read up front. (The file name is the key grip as 40 hex digits,
upper case, with extension ".key").

Bug: 548763
Change-Id: I448181276548c08716d913c7ba1b4bc64c62f952
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2020-06-04 19:22:07 +02:00
Matthias Sohn c9dcdf559b Merge "Fix typo in org.eclipse.jgit.ssh.jsch.test MANIFEST" 2020-06-04 11:59:40 -04:00
Thomas Wolf c4e5dd3761 Fix typo in org.eclipse.jgit.ssh.jsch.test MANIFEST
Change-Id: I1d1484b32aa0c6464b5c38f2a2987716589ae9aa
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2020-06-04 17:10:38 +02:00
David Ostrovsky 0e87f70e0e Fix ProtectedMembersInFinalClass warning flagged by error prone
Running recent error prone version complaining on that code:

CharacterHead.java:22: error: [ProtectedMembersInFinalClass] Make
members of final classes package-private: <init>
	protected CharacterHead(char expectedCharacter) {
	          ^
    (see https://errorprone.info/bugpattern/ProtectedMembersInFinalClass)
  Did you mean 'CharacterHead(char expectedCharacter) {'

Bug: 562756
Change-Id: Ic46a0b07e46235592f6e63db631f583303420b73
Signed-off-by: David Ostrovsky <david@ostrovsky.org>
2020-06-04 16:24:16 +02:00
Matthias Sohn cd1023cf45 Use version range to define fragment host bundle version
Change-Id: Ie877e976b20d3448fc1f12a1c775942d626a12fc
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2020-06-04 14:15:08 +02:00
David Pursehouse 949ee670c6 ObjectDirectory: Explicitly handle NoSuchFileException
On the first attempt to move the temp file, NoSuchFileException can
be raised if the destination folder does not exist. Instead of handling
this implicitly in the catch of IOException and then continuing to
create the destination folder and try again, explicitly catch it and
create the destination folder. If any other IOException occurs, treat
it as an unexpected error and return FAILURE.

Subsequently, on the second attempt to move the temp file, if ANY kind
of IOException occurs, also consider this an unexpected error and
return FAILURE.

In both catch blocks for IOException, add logging at ERROR level.

Change-Id: I9de9ee3d2b368be36e02ee1c0daf8e844f7e46c8
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2020-06-04 14:07:34 +09:00
David Pursehouse c2ab332e81 ObjectDirectory: Fail immediately when atomic move is not supported
If atomic move is not supported, AtomicMoveNotSupportedException will
be thrown on the first attempt to move the temp file. There is no
point attempting the move operation a second time because it will only
fail for the same reason.

Add an immediate return of FAILURE on the first occasion. Remove the
unnecessary handling of the exception in the second block.

Change-Id: I4658a8b37cfec2d7ef0217c8346e512968d0964c
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2020-06-04 14:06:21 +09:00
Matthias Sohn e9f4cb1cba Fix jgit packaging
- new jsch and gpg.bc fragments need to be included in their features
  as fragments and require only the jgit bundle (not the jgit feature)
- feature org.eclipse.jgit should no longer include bouncycastle
- add missing url for gpg.bc feature in category.xml
- don't mark features as patch features

Change-Id: I4a46e3fed319221a704b754347a6798b4b199fe4
2020-06-03 13:51:46 +02:00
David Ostrovsky 7861f82029 Fix InvalidInlineTag error flagged by error prone
Running recent error prone version complaining on that code:

RefDatabase.java:444: error: [InvalidInlineTag] Tag name `linkObjectId`
is unknown.
	 * Includes peeled {@linkObjectId}s. This is the inverse lookup of
	                   ^
    (see https://errorprone.info/bugpattern/InvalidInlineTag)

Bug: 562756
Change-Id: If91da51d5138fb753c0550eeeb9e3883a394123d
Signed-off-by: David Ostrovsky <david@ostrovsky.org>
2020-06-01 22:51:37 -04:00
David Ostrovsky 3e2ec7e5e8 Fix BadComparable error flagged by error prone
Running recent error prone version complaining on that code:

LfsPointer.java:171: error: [BadComparable] Possible sign flip from
narrowing conversion
		return (int) (getSize() - o.getSize());
		       ^
    (see https://errorprone.info/bugpattern/BadComparable)
  Did you mean 'return Long.compare(getSize(), o.getSize());'?

Bug: 562756
Change-Id: I0522f1025319a9290c448a064fbafdb4b16d1d59
Signed-off-by: David Ostrovsky <david@ostrovsky.org>
2020-06-01 18:56:32 -04:00
Thomas Wolf 55371c5f06 Add tests for RawTextComparator.WS_IGNORE_CHANGE.hash()
Change-Id: I1ed4df789094e09c39b3c2054fe5b9bd0c1a8f9b
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2020-06-02 00:13:37 +02:00
Thomas Wolf ae2e12d584 Update Orbit to R20200529191137 for final Eclipse release 2020-06
This includes org.bouncycastle.bcprov 1.65.1 in the p2 repository.

Leave the maven and bazel dependencies for Bouncy Castle at 1.65.

Change-Id: I1fb39bd79e7339315f64f8b5dda89cb81dd035af
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2020-06-01 02:09:49 +02:00
Matthias Sohn 7c321144a6 Organize manifest of org.eclipse.jgit.pgm
Use "organize manifest" to auto-cleanup the manifest of
org.eclipse.jgit.pgm. This removes some unused imports and unnecessary
manifest headers and updates use clauses.

Change-Id: Iacbd6d3b184c6fa8db28d9f06cbf56e57cc8ef5d
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2020-06-01 01:56:33 +02:00