Commit Graph

2987 Commits

Author SHA1 Message Date
Thomas Wolf 1825a2230c Merge branch 'stable-5.12'
* stable-5.12:
  [test] Create keystore with the keytool of the running JDK
  Fix garbage collection failing to delete pack file
  ReachabilityCheckerTestCase: fix reachable from self test case

Change-Id: I4b54f4850819736144edb784617ee902f491ffd6
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2021-07-29 18:19:23 +02:00
Thomas Wolf 65de0d4863 Merge branch 'stable-5.11' into stable-5.12
* stable-5.11:
  [test] Create keystore with the keytool of the running JDK
  ReachabilityCheckerTestCase: fix reachable from self test case

Change-Id: Ie8db450a1fad05bddb812a55b2ceb03b2805403a
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2021-07-29 13:12:13 +02:00
Thomas Wolf 1a963b3976 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>
2021-07-29 13:11:37 +02:00
Thomas Wolf bae2f86ac7 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>
2021-07-29 13:10:56 +02:00
Thomas Wolf 59aec9b15a 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>
2021-07-29 13:10:16 +02:00
Thomas Wolf 60bffc2fa8 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>
2021-07-29 13:09:39 +02:00
Thomas Wolf ae56213210 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>
2021-07-29 13:09:00 +02:00
Julian Ruppel e2798413f9 Support commit.template config property
Adds functionality to read the git commit.template property. The
template content is read either via a default encoding or, if present,
via encoding specified by i18n.commitEncoding property.

Bug: 446355

Change-Id: I0c45db98e324ddff26a7e0262835f259d6528a86
Signed-off-by: Julian Ruppel <julian.ruppel@sap.com>
2021-07-21 15:50:02 -04:00
Matthias Sohn ca969ecc61 Relax version range for hamcrest and assertj
We currently cannot use hamcrest 2.2 and assertj 3.20.2 (which requires
hamcrest 2.2) in egit tests since other Eclipse dependencies (e.g.
swtbot) require hamcrest 1.1.

Hence relax version range for these components in jgit so that jgit
tests also work when using the egit target platform.

Change-Id: I521e2ec4491bd8d790609b8a66a8f14511a865a1
2021-07-19 12:32:26 +02:00
Matthias Sohn e0ba98edd2 Update orbit to I20210711110031
and update
- assertj to 3.20.2.v20210706-1104
- hamcrest to 2.2.0.v20210711-0821
  - classes which were in org.hamcrest.core 1.3 and org.hamcrest.library
    1.3 were all moved to org.hamcrest in 2.2
  - the annotation org.hamcrest.Factory was removed and is no longer
    needed
  - junit 4.13 requires hamcrest-core and hamcrest-library 1.3 therefore
    keep them in the target platform

CQ: 23501
Change-Id: Ife871c0343b611be9203aed7f86577e85bbf5c95
2021-07-16 23:47:29 +02:00
Matthias Sohn d46af8c69d Merge branch 'stable-5.12'
* stable-5.12:
  Retry loose object read upon "Stale file handle" exception
  Ignore missing javadoc in test bundles

Change-Id: I67c613c066a3252f9b0d0a3dcc026b57e10bfe1d
2021-06-26 16:37:59 +02:00
Matthias Sohn 8bd0161c83 Merge branch 'stable-5.11' into stable-5.12
* stable-5.11:
  Retry loose object read upon "Stale file handle" exception
  Ignore missing javadoc in test bundles

Change-Id: Ia4dc886c920cec3c9da86e1a90a0af68bd016b4f
2021-06-26 16:36:55 +02:00
Matthias Sohn e6ace4a96d 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
2021-06-26 16:35:20 +02:00
Matthias Sohn bbb1c7f645 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
2021-06-25 22:23:47 +02:00
Fabio Ponciroli 6976a30f44 searchForReuse might impact performance in large repositories
The search for reuse phase for *all* the objects scans *all*
the packfiles, looking for the best candidate to serve back to the
client.

This can lead to an expensive operation when the number of
packfiles and objects is high.

Add parameter "pack.searchForReuseTimeout" to limit the time spent
on this search.

Change-Id: I54f5cddb6796fdc93ad9585c2ab4b44854fa6c48
2021-06-25 17:57:59 +02:00
Antonio Barone 24d6d60538 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
2021-06-24 23:52:22 +02:00
Matthias Sohn 12f39c26b0 Ignore missing javadoc in test bundles
Change-Id: I83ed20823dc6b22ff48c2a554acb2f7d3b6067b7
2021-06-24 23:14:13 +02:00
Thomas Wolf fc57689774 Fix PathSuffixFilter: can decide only on full paths
On a subtree, a PathSuffixFilter must return -1 ("indeterminate"),
not 0 ("include"), otherwise negation goes wrong: an indeterminate
result (-1) is passed on, but a decision (0/1) is inverted.

As a result a negated PathSuffixFilter would skip all folders.

Bug: 574253
Change-Id: I27fe785c0d772392a5b5efe0a7b1c9cafcb6e566
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2021-06-21 13:03:22 +02:00
Han-Wen Nienhuys ae081b8dc1 ReachabilityCheckerTestCase: fix reachable from self test case
Change-Id: I8f94a0a0ff401f1691b3757002756b4e83dd8640
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
2021-06-16 17:45:29 +02:00
Matthias Sohn 1cbfea9ece Prepare 5.13.0-SNAPSHOT builds
Change-Id: Ie9cfc1eeb0eda7b2bbe744a22a7e4cfe6d59bc37
2021-06-14 01:49:05 +02:00
Matthias Sohn eb4deda909 Merge branch 'stable-5.12'
* stable-5.12:
  Prepare 5.12.1-SNAPSHOT builds
  JGit v5.12.0.202106070339-r
  [license-check] Update list of project dependencies
  [errorprone] Fix warning InputStreamSlowMultibyteRead
  [errorprone] Make operator precedence explicit in OpenSshConfigFile
  Update jetty to 9.4.41.v20210516
  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: I9bd4dfc3796a5034be7b3e86b35ef591bb516a2c
2021-06-14 01:32:21 +02:00
Matthias Sohn 3b300e5ed5 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
2021-06-14 01:13:18 +02:00
Matthias Sohn b8e57d2745 Merge "Prepare 5.12.1-SNAPSHOT builds" into stable-5.12 2021-06-13 18:52:44 -04:00
Matthias Sohn 527119120f Merge "Merge branch 'stable-5.10' into stable-5.11" into stable-5.12 2021-06-13 18:48:42 -04:00
Matthias Sohn a397727e4a Prepare 5.12.1-SNAPSHOT builds
Change-Id: Idf266c34aa9a04cf9c5e0e09bcb415c13d773d4c
2021-06-13 23:59:14 +02:00
Matthias Sohn 21f9d919ed 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: I50dcc037a96f3a4237c09516c82e1c18acbd2e0b
2021-06-13 23:57:08 +02:00
Matthias Sohn e2dc4b9c64 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
2021-06-13 23:55:46 +02:00
Matthias Sohn 84063386b5 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
2021-06-13 23:55:03 +02:00
Matthias Sohn 0c7b101329 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
2021-06-13 23:54:06 +02:00
Matthias Sohn e68c381917 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
2021-06-13 23:52:46 +02:00
Matthias Sohn 7856402c4b 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
2021-06-13 23:49:25 +02:00
Ronald Bhuleskar 64d0aaa2b6 Teach independent negotiation (no pack file) using an option "wait-for-done"
From Git commit 9c1e657a8f:
  Currently, the packfile negotiation step within a Git fetch cannot be
  done independent of sending the packfile, even though there is at
  least one application wherein this is useful - push negotiation.
  Therefore, make it possible for this negotiation step to be done
  independently.

  This feature is for protocol v2 only.

  In the protocol, the main hindrance towards independent negotiation is
  that the server can unilaterally decide to send the packfile. This is
  solved by a "wait-for-done" argument: the server will then wait for
  the client to say "done". In practice, the client will never say it;
  instead it will cease requests once it is satisfied.

Advertising the server capability option "wait-for-done" is behind the
transport config: uploadpack.advertisewaitfordone, which by default is
false.

Change-Id: I5ebd3e99ad76b8943597216e23ced2ed38eb5224
2021-06-11 12:29:12 -04:00
Matthias Sohn 1f062c64be JGit v5.12.0.202106070339-r
Change-Id: I0fbfea2c83f1ce83f75130cc97591547032f1104
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2021-06-07 09:38:29 +02:00
Matthias Sohn 5977260af6 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
2021-06-05 22:49:56 +02:00
Matthias Sohn c14cb5c0ed 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
2021-06-05 22:49:07 +02:00
Matthias Sohn 8e52e30b92 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
2021-06-05 22:48:01 +02:00
Matthias Sohn 87c42c1b3c 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
2021-06-05 22:20:46 +02:00
Matthias Sohn e7b4af0d95 Prepare 5.1.17-SNAPSHOT builds
Change-Id: I20c69728465f956a5744a75eb548ef18962286dd
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2021-06-05 00:45:08 +02:00
Matthias Sohn f3d07f6649 JGit v5.1.16.202106041830-r
Change-Id: I526ed2a08553bc0b2678aaefaff9e0c6529baefc
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2021-06-05 00:31:03 +02:00
Matthias Sohn 044c5f215c Prepare 5.12.0-SNAPSHOT builds
Change-Id: Ifc72d3f3ac84b9c4055b95ec0093d877ffb09ab0
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2021-06-03 20:04:28 +02:00
Matthias Sohn 45a4c131ae JGit v5.12.0.202106021050-rc1
Change-Id: I622ee049f14f37504ff4a062f03d6fc25465d0ec
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2021-06-02 16:49:17 +02:00
Matthias Sohn 1f733663bf Prepare 5.12.0-SNAPSHOT builds
Change-Id: I25e4efc9b40ae4e7168b37385445c73992c5beb0
2021-06-02 08:47:28 +02:00
Matthias Sohn 94aa245023 JGit v5.12.0.202106011439-rc1
Change-Id: Ieac1d02879defe0f4791062448d4efc328a2f652
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2021-06-01 20:38:31 +02:00
Han-Wen NIenhuys 6dc3506b52 Merge "Skip detecting content renames for binary files" 2021-05-31 08:57:13 -04:00
Youssef Elghareeb 1788b72d1a Skip detecting content renames for binary files
This is similar to change Idbc2c29bd that skipped detecting content
renames for large files. With this change, we added a new option in
RenameDetector called "skipContentRenamesForBinaryFiles", that when set,
causes binary files with any slight modification to be identified as
added/deleted. The default for this boolean is false, so preserving
current behaviour.

Change-Id: I4770b1f69c60b1037025ddd0940ba86df6047299
2021-05-31 13:48:37 +02:00
Ivan Frade 0667b8ec4d RepoCommand: Do not set 'branch' if the revision is a tag
The "branch" field in the .gitmodules is the signal for gerrit to keep
the superproject autoupdated. Tags are immutable and there is no need to
track them, plus the cgit client requires the field to be a "remote
branch name" but not a tag.

Do not set the "branch" field if the revision is a tag. Keep those tags
in another field ("ref") as they help other tools to find the commit in
the destination repository.

We can still have false negatives when a refname is not fully qualified,
but this check covers e.g. the most common case in android.

Note that the javadoc of #setRecordRemoteBranch already mentions that
"submodules that request a tag will not have branch name recorded".

Change-Id: Ib1c321a4d3b7f8d51ca2ea204f72dc0cfed50c37
Signed-off-by: Ivan Frade <ifrade@google.com>
2021-05-26 14:32:04 +02:00
Thomas Wolf 1126f26d21 ApplyCommand: fix "no newline at end" detection
Check the last line of the last hunk of a file, not the last line of
the whole patch.

Note that C git only checks that this line starts with "\ " and is at
least 12 characters long because of possible different texts when non-
English messages are used.

Change-Id: I0db81699eb3e99ed7b536a3e2b8dc97df1f58a89
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2021-05-26 00:38:00 +02:00
Thomas Wolf 2a0295ccfd ApplyCommand: handle completely empty context lines in text patches
C git treats completely empty lines as empty context lines (which
traditionally have a single blank). Apparently newer GNU diff may
produce such lines; see [1]. ("Newer" meaning "since 2006"...)

[1] https://github.com/git/git/commit/b507b465f7831

Change-Id: I80c1f030edb17a46289b1dabf11a2648d2660d38
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2021-05-26 00:38:00 +02:00
Thomas Wolf 76b76a6048 ApplyCommand: use byte arrays for text patches, not strings
Instead of converting the patch bytes to strings apply the patch on
byte level, like C git does. Converting the input lines and the hunk
lines from bytes to strings and then applying the patch based on
strings may give surprising results if a patch converts a text file
from one encoding to another. Moreover, in the end we don't know which
encoding to use to write the result.

Previous code just wrote the result as UTF-8, which forcibly changed
the encoding if the original input had some other encoding (even if the
patch had the same non-UTF-8 encoding). It was also wrong if the input
was UTF-8, and the patch should have changed the encoding to something
else.

So use ByteBuffers instead of Strings. This has the additional advantage
that all these ByteBuffers can share the underlying byte arrays of the
input and of the patch, so it also reduces memory consumption.

Change-Id: I450975f2ba0e7d0bec8973e3113cc2e7aea187ee
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2021-05-26 00:38:00 +02:00
Thomas Wolf 10ac449911 ApplyCommand: support binary patches
Implement applying binary patches. Handles both literal and delta
patches. Note that C git also runs binary files through the clean
and smudge filters. Implement the same safeguards against corrupted
patches as in C git: require the full OIDs to be present in the patch
file, and apply a binary patch only if both pre- and post-image hashes
match.

Add tests for applying literal and delta patches.

Bug: 371725
Change-Id: I71dc214fe4145d7cc8e4769384fb78c7d0d6c220
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2021-05-26 00:38:00 +02:00