Commit Graph

5853 Commits

Author SHA1 Message Date
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
andrewxian2000 64b0dee98f Fix garbage collection failing to delete pack file
The loosen() method has opened pack file and the open pack file handle
may prevent it from being deleted e.g. on Windows. Fix this by closing
the pack file only after loosen() finished.

Bug: 574178
Change-Id: Icd59931a218d84c9c97b450eea87b21ed01248ff
Signed-off-by: andrew.xian2000@gmail.com
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2021-06-24 11:03:27 +12:00
andrewxian2000 1ae7e08bca Fix garbage collection failing to delete pack file
The loosen() method has opened pack file and the open pack file handle
may prevent it from being deleted e.g. on Windows. Fix this by closing
the pack file only after loosen() finished.

Bug: 574178
Change-Id: Icd59931a218d84c9c97b450eea87b21ed01248ff
Signed-off-by: andrew.xian2000@gmail.com
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2021-06-22 14:16:30 +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
Matthias Sohn 6a8afeb9f2 Merge branch 'master' into next
* master: (47 commits)
  Fix @since from commit 64d0aaa2
  Prepare 5.13.0-SNAPSHOT builds
  Prepare 5.12.1-SNAPSHOT builds
  Teach independent negotiation (no pack file) using an option "wait-for-done"
  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
  Update Orbit to R20210602031627
  Prepare 5.12.0-SNAPSHOT builds
  Fixing visibility for HostEntry constructors.
  JGit v5.12.0.202106021050-rc1
  Prepare 5.12.0-SNAPSHOT builds
  JGit v5.12.0.202106011439-rc1
  Clarify operator precedence to fix errorprone error
  Prepare 5.12.0-SNAPSHOT builds
  Update Orbit to S20210518003616 and ant to 1.10.10.v20210426-1926
  ...

Change-Id: I76a1f155201648a62df11a41a9e02d97f522d00f
2021-06-15 00:05:14 +02:00
Thomas Wolf 01b2c4fc90 Fix @since from commit 64d0aaa2
That commit was submitted on master between the 5.12.0 release and
the 5.13.0 version bump.

Change-Id: I679e818bfc5a4695b66548add9a83a22c89a4ffc
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2021-06-14 21:23: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 ae692779ce [errorprone] Fix warning InputStreamSlowMultibyteRead
Change-Id: I50dace6e310016c04f524eb0cfcce0da05fadd47
2021-06-07 00:28:48 +02:00
Matthias Sohn c2f9acdc32 [errorprone] Make operator precedence explicit in OpenSshConfigFile
This fixes the errorprone warning OperatorPrecedence.

Change-Id: I4c7dafa5ac8e1d58fa15cf91fe1b3cf3f182d536
2021-06-07 00:25:32 +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
Demetr Starshov f6b9b392e7 Fixing visibility for HostEntry constructors.
HostEntry class was public with empty constructor, so adding
constructors with default visibility actually reduced visibility of
constructor.

Change-Id: I4c996c0559102084946ba49a71afe10dda5e0f95
2021-06-02 16:19:39 -07: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
Matthias Sohn a14bc9bb69 Clarify operator precedence to fix errorprone error
Errorprone raised error OperatorPrecedence in bazel build.

Change-Id: Ibab601e67d4d5cafe9a7d900c78b0d432181a073
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2021-06-01 11:16:59 -04: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 c59626ad7a RepoCommand: Retry commit on LockFailure
When the target repository is receiving commits from other sources,
the repo command commit can fail with a LOCK_FAILURE. We could let
callers retry, but then the command needs to redo all the work (opening
all subrepos to recreate the tree).

Retry the commit in LOCK_FAILURE inside the command. The commit
rewrites the whole tree, so it shouldn't have merge errors. Use an
exponential delay with jitter for the retries.

Change-Id: I517b6f2afd16a4b695e6cf471b5d6cf492024ec4
Signed-off-by: Ivan Frade <ifrade@google.com>
2021-05-26 14:07:28 -07: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
Matthias Sohn a43ad1e56d Merge "Add git config for conflict style merge/diff3" 2021-05-26 08:30:41 -04: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
Thomas Wolf 0fe794a433 ApplyCommand: add a stream to apply a delta patch
Add a new BinaryDeltaInputStream that applies a delta provided by
another InputStream to a given base. Because delta application needs
random access to the base, the base itself cannot be yet another
InputStream. But at least this enables streaming of the result.

Add a simple test using delta hunks generated by C git.

Bug: 371725
Change-Id: Ibd26fa2f49860737ad5c5387f7f4870d3e85e628
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2021-05-26 00:37:59 +02:00
Thomas Wolf 2eb54afe6a ApplyCommand: add streams to read/write binary patch hunks
Add streams that can encode or decode git binary patch data on the fly.
Git writes binary patches base-85 encoded, at most 52 un-encoded bytes,
with the unencoded data length prefixed in a one-character encoding, and
suffixed with a newline character.

Add a test for both the new input and the output stream. The test
roundtrips binary data of different lengths in different ways.

Bug: 371725
Change-Id: Ic3faebaa4637520f5448b3d1acd78d5aaab3907a
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2021-05-26 00:37:59 +02:00
Thomas Wolf 501fc0dadd ApplyCommand: add a base-85 codec
Add an implementation for base-85 encoding and decoding [1]. Git binary
patches use this format.

Base-85 encoding assembles bytes as 32-bit MSB values, then converts
these values to base-85 numbers (always 5 bytes) encoded as printable
ASCII characters. Decoding base-85 is the reverse operation. Note
that decoding may overflow on invalid input as 85^5 > 2^32. Encodings
always have a length that is a multiple of 5. If input length is not
divisible by 4, padding bytes are (logically) added, which are ignored
when decoding. The encoding for n bytes has thus always exactly length
(n + 3) / 4 * 5 in integer arithmetic (truncating division).

Includes tests.

[1] https://datatracker.ietf.org/doc/html/rfc1924

Bug: 371725
Change-Id: Ib5b9a503cd62cf70e080a4fb38c8cd1eeeaebcfe
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2021-05-26 00:37:45 +02:00
Kaushik Lingarkar 8bc166b00d 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>
2021-05-24 13:00:54 -07:00
Kaushik Lingarkar 303dd019d1 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>
2021-05-24 12:59:28 -07:00
Thomas Wolf d2846cc8b2 ApplyCommand: convert to git internal format before applying patch
Applying a patch on Windows failed if the patch had the (normal)
single-LF line endings, but the file on disk had the usual Windows
CR-LF line endings.

Git (and JGit) compute diffs on the git-internal blob, i.e., after
CR-LF transformation and clean filtering. Applying patches to files
directly is thus incorrect and may fail if CR-LF settings don't
match, or if clean/smudge filtering is involved.

Change ApplyCommand to run the file content through the check-in
filters before applying the patch, and run the result through the
check-out filters. This makes patch application succeed even if the
patch has single-LFs, but the file has CR-LF and core.autocrlf is
true.

Add tests for various combinations of line endings in the file and in
the patch, and a test to verify the clean/smudge handling.

See also [1].

Running the file though clean/smudge may give strange results with
LFS-managed files. JGit's DiffFormatter has some extra code and
applies the smudge filter again after having run the file through
the check-in filters (CR-LF and clean). So JGit can actually produce
a diff on LFS-managed files using the normal diff machinery. (If it
doesn't run out of memory, that is. After all, LFS is intended for
_large_ files.) How such a diff would be applied with either C git
or JGit is entirely unclear; neither has any code for this special
case. Compare also [2].

Note that C git just doesn't know about LFS and always diffs after
the check-in filter chain, so for LFS files, it'll produce a diff
of the LFS pointers.

[1] https://github.com/git/git/commit/c24f3abac
[2] https://github.com/git-lfs/git-lfs/issues/440

Bug: 571585
Change-Id: I8f71ff26313b5773ff1da612b0938ad2f18751f5
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2021-05-18 17:23:34 +02:00
Thomas Wolf c718e6059c SSH config: fix whitespace handling
Use Character.isWhitespace() instead of Character.isSpaceChar() to
treat TABs as whitespace, too.

Change-Id: Iffc59c13357d981ede6a1e0feb6ea6ff03fb3064
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2021-05-17 08:31:41 +02:00
Thomas Wolf 87704b7736 SSH config: fix negated patterns
Negated patterns were handled wrongly. According to the OpenBSD
ssh_config man page,[1] a negated pattern never matches. Negated
patterns make only sense if there are positive patterns; the
negated pattern then can define exceptions for the positive
patterns.

OpenSshConfigFile did this wrongly. It handled "!foo" as "matching
everything but foo", but actually the semantics is "if the input is
"foo", this entry doesn't apply. If the input is anything else,
other patterns determine whether the entry may apply.".

[1] https://man.openbsd.org/ssh_config

Change-Id: I50f6e46581b7ece4c949eddf62f4a265573ec29e
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2021-05-17 08:26:23 +02:00
Matthias Sohn cb65846722 Fix @since tag for introduction of PUBKEY_ACCEPTED_ALGORITHMS
This constant was shipped with 5.11.1.

Change-Id: I480dbefab1cccca78cefbc709b79e5405f8bf8cd
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2021-05-14 09:02:46 +02:00
Matthias Sohn 93d3d481f8 Prepare 5.11.2-SNAPSHOT builds
Change-Id: Idfd81bd3bbcd99034f69fffb1a562bf07b0f8209
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2021-05-14 08:28:59 +02:00
Matthias Sohn 8dad905f20 JGit v5.11.1.202105131744-r
Change-Id: Id74eecbde63edbc58b6262ae01ef34d8bebc0f88
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2021-05-13 23:42:10 +02:00
Matthias Sohn 1aa3cf7f41 Merge branch 'master' into next
* master: (34 commits)
  Remove texts which were added by mistake in 00386272
  Fix formatting which was broken in 00386272
  LockFile: create OutputStream only when needed
  Add a cgit interoperability test for LockFile
  Add TemporaryBuffer.toString(int limit)
  LockFile: create OutputStream only when needed
  Prepare 5.12.0-SNAPSHOT builds
  JGit v5.12.0.202105051250-m2
  Update jetty to 9.4.40.v20210413
  [releng] Update eclipse-jarsigner-plugin to 1.3.1
  Implement ours/theirs content conflict resolution
  ssh: ensure list is modifiable before using Iterator.remove().
  Update orbit to S20210406213021 and add 4.20-staging target
  Fix typo in test method name
  Allow file mode conflicts in virtual base commit on recursive merge.
  sshd: don't lock the known_hosts files on reading
  Allow info messages in UsernamePasswordCredentialsProvider
  ssh config: do environment variable replacement
  sshd: implement server-sig-algs SSH extension (client side)
  Upgrade ecj to 3.25.0
  ...

Change-Id: Ibc39a9c4e431d15b67ab4a307241f47a7f3740a9
2021-05-12 08:59:07 +02:00
Matthias Sohn fe3034d5b9 Merge branch 'stable-5.12'
* stable-5.12:
  Remove texts which were added by mistake in 00386272
  Fix formatting which was broken in 00386272

Change-Id: I1c936183e1fa17ea95ada7849a75bc76af275fa3
2021-05-12 08:58:09 +02:00
Matthias Sohn 4e290d389a Merge branch 'stable-5.11' into stable-5.12
* stable-5.11:
  Remove texts which were added by mistake in 00386272
  Fix formatting which was broken in 00386272

Change-Id: I6184772bdeca1b9ccecf6e400ae15604ab4f5a69
2021-05-12 08:57:20 +02:00
Matthias Sohn 618d8c4784 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
2021-05-12 08:56:27 +02:00
Matthias Sohn 3d156790e9 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
2021-05-12 08:55:44 +02:00
Matthias Sohn 73f8acdc5c 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
2021-05-12 08:50:18 +02:00
Matthias Sohn adc1fc645f 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
2021-05-11 23:34:30 +02:00
Matthias Sohn 26dee2d984 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
2021-05-11 23:32:22 +02:00
Matthias Sohn 37436cc933 Remove texts which were added by mistake in 00386272
Change-Id: Iaed25dac0bc9af8f3fda6138a5f9fe553bff5d39
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2021-05-11 21:41:02 +02:00
Matthias Sohn 70e250c356 Fix formatting which was broken in 00386272
Change-Id: I10a3e2b117e790f64386a8e9e7663db8e59230d9
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2021-05-11 18:36:05 +02:00
Matthias Sohn cf76a92e04 Merge branch 'stable-5.12'
* stable-5.12:
  LockFile: create OutputStream only when needed
  Remove ReftableNumbersNotIncreasingException

Change-Id: I9d85187d00771beef908f1136015d059024f4118
2021-05-11 01:00:31 +02:00
Matthias Sohn 1aff4369b0 Merge branch 'stable-5.11' into stable-5.12
* stable-5.11:
  LockFile: create OutputStream only when needed
  Remove ReftableNumbersNotIncreasingException

Change-Id: I7adb5c4fc28e0043a985b5136424f3f756b2f84f
2021-05-11 00:59:10 +02:00
Matthias Sohn 1ccdf83fbd Merge branch 'stable-5.10' into stable-5.11
* stable-5.10:
  LockFile: create OutputStream only when needed
  Remove ReftableNumbersNotIncreasingException

Change-Id: Id6e0a78caf12c19a01a88d1ddb8a7df2b3590f98
2021-05-11 00:57:46 +02:00
Matthias Sohn c557eea782 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
2021-05-11 00:56:57 +02:00
Matthias Sohn 587c7eab45 Merge branch 'stable-5.8' into stable-5.9
* stable-5.8:
  LockFile: create OutputStream only when needed
  Remove ReftableNumbersNotIncreasingException

Change-Id: I3274c97cf560398c3c4c27d6759500452f315db0
2021-05-11 00:55:54 +02:00
Matthias Sohn f2e5bace48 Merge branch 'stable-5.7' into stable-5.8
* stable-5.7:
  LockFile: create OutputStream only when needed
  Remove ReftableNumbersNotIncreasingException

Change-Id: Ib3f280e0741f87a0ff615d857a5ea39b35527e74
2021-05-11 00:51:21 +02:00
Matthias Sohn 0616016c83 Merge branch 'stable-5.6' into stable-5.7
* stable-5.6:
  LockFile: create OutputStream only when needed

Change-Id: I7c0e37d2cee0923662a7e39df5a802a84c017e4f
2021-05-11 00:31:58 +02:00
Thomas Wolf 0038627226 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>
2021-05-10 23:58:07 +02:00
Matthias Sohn cc07a471dc Add TemporaryBuffer.toString(int limit)
Change-Id: I8603fcdfd0244088b3b217f002a78e7a646ea205
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2021-05-09 22:49:15 +02:00
Thomas Wolf a9579ba60c 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>
2021-05-07 12:10:47 +02:00
Matthias Sohn 520b6d7dcf Prepare 5.12.0-SNAPSHOT builds
Change-Id: I2fc5305e7eaaa4593d418fc3b31d20e4b6e1e585
2021-05-06 09:53:25 +02:00
Matthias Sohn 92679d792f JGit v5.12.0.202105051250-m2
Change-Id: Ic7d86c91ec0ff9aa0678dcb971c197e62a4ca2dc
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2021-05-05 17:50:19 +02:00
Thomas Wolf e58bf0870e Add git config for conflict style merge/diff3
Add a constant in ConfigConstants, and a ConflictStyle enum in
MergeCommand.

Change-Id: Idf8e036b6b6953bec06d6923a39e5ff30c2da562
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2021-05-03 10:59:24 +02:00
Thomas Wolf 8210f29fe4 Implement ours/theirs content conflict resolution
Git has different conflict resolution strategies:

* There is a tree merge strategy "ours" which just ignores any changes
  from theirs ("-s ours"). JGit also has the mirror strategy "theirs"
  ignoring any changes from "ours". (This doesn't exist in C git.)
  Adapt StashApplyCommand and CherrypickCommand to be able to use those
  tree merge strategies.
* For the resolve/recursive tree merge strategies, there are content
  conflict resolution strategies "ours" and "theirs", which resolve
  any conflict hunks by taking the "ours" or "theirs" hunk. In C git
  those correspond to "-Xours" or -Xtheirs". Implement that in
  MergeAlgorithm, and add API to set and pass through such a strategy
  for resolving content conflicts.
* The "ours/theirs" content conflict resolution strategies also apply
  for binary files. Handle these cases in ResolveMerger.

Note that the content conflict resolution strategies ("-X ours/theirs")
do _not_ apply to modify/delete or delete/modify conflicts. Such
conflicts are always reported as conflicts by C git. They do apply,
however, if one side completely clears a file's content.

Bug: 501111
Change-Id: I2c9c170c61c440a2ab9c387991e7a0c3ab960e07
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2021-04-19 01:52:19 +02:00
Marija Savtchouk 7ceb61494b Allow file mode conflicts in virtual base commit on recursive merge.
Similar to https://git.eclipse.org/r/c/jgit/jgit/+/175166, ignore
path that have conflicts on attributes, so that the virtual base could
be used by RecursiveMerger.

Change-Id: I99c95445a305558d55bbb9c9e97446caaf61c154
Signed-off-by: Marija Savtchouk <mariasavtchouk@google.com>
2021-04-06 09:33:04 +01:00
Thomas Wolf 0c91bf4e17 Allow info messages in UsernamePasswordCredentialsProvider
o.e.j.ssh.apache produces passphrase prompts containing
InformationalMessage items to show the fingerprint of the key
the passphrase is being asked for. Allow this so that the credentials
provider can be used with o.e.j.ssh.apache.

Change-Id: Ibc2ffd3a987d3118952726091b9b80442972dfd8
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2021-04-01 19:01:24 +02:00
Thomas Wolf 1de2a9fbe7 ssh config: do environment variable replacement
OpenSSH 8.4 has introduced simple environment variable substitution
for some keys. Implement that feature in our ssh config file parser,
too.

Bug: 572103
Change-Id: I360f2c5510eea4ec3329aeedf3d29dfefc9163f0
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2021-04-01 19:01:13 +02:00
Matthias Sohn beecca02bb Merge branch 'stable-5.11'
* stable-5.11:
  Refactor CommitCommand to improve readability
  CommitCommand: fix formatting
  CommitCommand: remove unncessary comment
  Ensure post-commit hook is called after index lock was released
  sshd: try all configured signature algorithms for a key
  sshd: modernize ssh config file parsing
  sshd: implement ssh config PubkeyAcceptedAlgorithms

Change-Id: Ic3235ffd84c9d7537a1fe5ff4f216578e6e26724
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2021-03-26 09:56:19 +01:00
Matthias Sohn 502bfff7db Refactor CommitCommand to improve readability
Change-Id: Id3cac81cd32c07f677b7f669d58e32b5290e1790
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2021-03-23 11:01:53 +01:00
Matthias Sohn 18c735c474 CommitCommand: fix formatting
Change-Id: I5efd1ffee4ebb08b3b5c27e29162493615727840
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2021-03-23 11:01:53 +01:00
Matthias Sohn b08c599fb8 CommitCommand: remove unncessary comment
Let the code speak for itself.

Change-Id: I6a6d6c327ffac23fc607295a7f4fd3131b3d1e58
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2021-03-23 11:01:52 +01:00
Matthias Sohn f43cb3605c 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>
2021-03-23 11:01:52 +01:00
Thomas Wolf 6faee128f8 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>
2021-03-19 17:27:49 +01:00
Thomas Wolf ffc1f9b026 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>
2021-03-19 17:27:03 +01:00
Alex Blewitt b6d4844b5d Enable CommitCommand to use a fluent style
By returning `this` at the end of the `setCredentialsProvider()` the API
can be used as a fluent style.

This change is source compatible but not binary compatible with existing
clients, and so adding this will require a major version change.

Bug: 553116
Change-Id: I72eaefee72825fa2246319a94a0df3c0cb7061fc
Signed-off-by: Alex Blewitt <alex.blewitt@gmail.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2021-03-19 14:55:56 +01:00
Matthias Sohn d081ff78f7 Merge branch 'master' into next
* master: (27 commits)
  Optimize RevWalkUtils.findBranchesReachableFrom()
  Introduce getMergedInto(RevCommit commit, Collection<Ref> refs)
  Skip detecting content renames for large files
  Remove unused API problem filters
  Document http options supported by JGit
  HTTP cookies: do tilde expansion on http.cookieFile
  Prepare 5.12.0-SNAPSHOT builds
  Update Orbit to R20210223232630
  Prepare 5.11.1-SNAPSHOT builds
  JGit v5.11.0.202103091610-r
  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
  ...

Change-Id: I2326d4d728fbde3090a5b87b0e273db46e0c5f62
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2021-03-19 10:26:27 +01:00
Adithya Chakilam 41643dcb79 Optimize RevWalkUtils.findBranchesReachableFrom()
In [1], improved RevWalk.getMergedInto() is introduced to avoid repeated
work while performing RevWalk.isMergedInto() on many refs. Modify
findBranchesReachableFrom() to use it.

[1] I65de9873dce67af9c415d1d236bf52d31b67e8fe

Change-Id: I81d615241638d4093df64b449637af601843a5ed
Signed-off-by: Adithya Chakilam <quic_achakila@quicinc.com>
2021-03-14 13:38:49 -05:00
Adithya Chakilam 0bd2f4bf77 Introduce getMergedInto(RevCommit commit, Collection<Ref> refs)
In cases where we need to determine if a given commit is merged
into many refs, using isMergedInto(base, tip) for each ref would
cause multiple unwanted walks.

getMergedInto() marks the unreachable commits as uninteresting
which would then avoid walking that same path again.

Using the same api, also introduce isMergedIntoAny() and
isMergedIntoAll()

Change-Id: I65de9873dce67af9c415d1d236bf52d31b67e8fe
Signed-off-by: Adithya Chakilam <quic_achakila@quicinc.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2021-03-14 13:45:29 +01:00
Youssef Elghareeb 4a78d911c5 Skip detecting content renames for large files
There are two code paths for detecting renames: one on tree diffs
(using DiffFormatter#scan) and the other on single file diffs (using
DiffFormatter#format). The latter skips binary and large files
for rename detection - check [1], but the former doesn't.

This change skips content rename detection for the tree diffs case for
large files. This is essential to avoid expensive computations while
reading the file, especially for callers who don't want to pay that
cost. Content renames are those which involve files with slightly
modified content. Exact renames will still be identified.

The default threshold for file sizes is reused from
PackConfig.DEFAULT_BIG_FILE_THRESHOLD: 50 MB.

[1] 232876421d/org.eclipse.jgit/src/org/eclipse/jgit/diff/RawText.java (386)

Change-Id: Idbc2c29bd381c6e387185204638f76fda47df41e
Signed-off-by: Youssef Elghareeb <ghareeb@google.com>
2021-03-14 11:38:13 +01:00
Matthias Sohn 84ed57d2f6 Remove unused API problem filters
Change-Id: I34be8afa42971b94d86312ff8b672b133cd23d45
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2021-03-13 17:12:07 -05:00
Thomas Wolf 808c4495ca HTTP cookies: do tilde expansion on http.cookieFile
Git config http.cookieFile must have ~ expansion, compare [1].

It also should be an absolute path. While a relative path is allowed,
C git just passes the value on to libcurl, so it'll be relative to the
current working directory and thus not work in all directories.

Log a warning if the path is relative.

(Alternatives would be to throw an exception, or to resolve the path
relative to the .git directory, or relative to the working tree root,
or relative to the config file it occurs in. But C git does not seem
to do either.)

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

Bug: 571798
Change-Id: I5cdab6061d0613ac7d8cb7977e5b97f5b88f562d
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2021-03-12 12:02:22 +01:00
Matthias Sohn 232876421d Prepare 5.12.0-SNAPSHOT builds
Change-Id: I736de7c3deb11da75777d459f47332df0b486443
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2021-03-10 16:34:28 +01:00
Matthias Sohn 1f368f8867 Prepare 5.11.1-SNAPSHOT builds
Change-Id: I94628ccbb5099a65aa4345cfd28a141ff5555b68
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2021-03-09 23:42:31 +01:00
Matthias Sohn 30b6887d44 JGit v5.11.0.202103091610-r
Change-Id: I8e6855eaf7228459f492036feb4e34ca085698a7
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2021-03-09 22:10:22 +01:00
Nasser Grainawi 2a6b2eddcf 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>
2021-03-07 00:02:56 +01:00