]> source.dussan.org Git - jgit.git/log
jgit.git
3 years agoMerge branch 'stable-5.12' 17/181417/1
Matthias Sohn [Thu, 3 Jun 2021 21:50:51 +0000 (23:50 +0200)]
Merge branch 'stable-5.12'

* stable-5.12:
  Update Orbit to R20210602031627
  Prepare 5.12.0-SNAPSHOT builds
  JGit v5.12.0.202106021050-rc1
  Prepare 5.12.0-SNAPSHOT builds
  JGit v5.12.0.202106011439-rc1
  Prepare 5.12.0-SNAPSHOT builds
  JGit v5.12.0.202105261145-m3

Change-Id: Iaf5d65a6e23c4d262fcb3dd3eda42bd634a38aad

3 years agoUpdate Orbit to R20210602031627 02/181402/1
Matthias Sohn [Thu, 3 Jun 2021 19:35:32 +0000 (21:35 +0200)]
Update Orbit to R20210602031627

Change-Id: I480093d9da393dae0c3b608762d38cba3db2f2b9
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years agoPrepare 5.12.0-SNAPSHOT builds 97/181397/1
Matthias Sohn [Thu, 3 Jun 2021 18:04:28 +0000 (20:04 +0200)]
Prepare 5.12.0-SNAPSHOT builds

Change-Id: Ifc72d3f3ac84b9c4055b95ec0093d877ffb09ab0
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years agoFixing visibility for HostEntry constructors. 23/181323/1
Demetr Starshov [Wed, 2 Jun 2021 23:19:39 +0000 (16:19 -0700)]
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

3 years agoJGit v5.12.0.202106021050-rc1 96/181296/1 v5.12.0.202106021050-rc1
Matthias Sohn [Wed, 2 Jun 2021 14:49:17 +0000 (16:49 +0200)]
JGit v5.12.0.202106021050-rc1

Change-Id: I622ee049f14f37504ff4a062f03d6fc25465d0ec
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years agoPrepare 5.12.0-SNAPSHOT builds 50/181250/1
Matthias Sohn [Wed, 2 Jun 2021 06:47:28 +0000 (08:47 +0200)]
Prepare 5.12.0-SNAPSHOT builds

Change-Id: I25e4efc9b40ae4e7168b37385445c73992c5beb0

3 years agoJGit v5.12.0.202106011439-rc1 34/181234/1 v5.12.0.202106011439-rc1
Matthias Sohn [Tue, 1 Jun 2021 18:38:31 +0000 (20:38 +0200)]
JGit v5.12.0.202106011439-rc1

Change-Id: Ieac1d02879defe0f4791062448d4efc328a2f652
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years agoClarify operator precedence to fix errorprone error 34/179734/5
Matthias Sohn [Fri, 23 Apr 2021 14:52:54 +0000 (16:52 +0200)]
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>
3 years agoMerge branch 'master' into stable-5.12 22/181222/1
Matthias Sohn [Tue, 1 Jun 2021 14:36:43 +0000 (16:36 +0200)]
Merge branch 'master' into stable-5.12

* master:
  Update Orbit to S20210518003616 and ant to 1.10.10.v20210426-1926
  Skip detecting content renames for binary files
  RepoCommand: Retry commit on LockFailure
  Finish upgrading eclipse-jarsigner-plugin to 1.3.1
  Upgrade maven-javadoc-plugin to 3.3.0
  Update maven-project-info-reports-plugin to 3.1.2
  Update spotbugs-maven-plugin to 4.2.3

Change-Id: I3b77b0ef21bdf69a3009fb64af0d23d79b518009

3 years agoPrepare 5.12.0-SNAPSHOT builds 21/181221/1
Matthias Sohn [Tue, 1 Jun 2021 14:13:41 +0000 (16:13 +0200)]
Prepare 5.12.0-SNAPSHOT builds

Change-Id: If563be77aab768ac1f31ae2211fb0892d0205a2a
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years agoUpdate Orbit to S20210518003616 and ant to 1.10.10.v20210426-1926 03/181203/1
Matthias Sohn [Mon, 31 May 2021 22:18:10 +0000 (00:18 +0200)]
Update Orbit to S20210518003616 and ant to 1.10.10.v20210426-1926

Change-Id: I87df882d4434c4fb107b8bd662ce63749078f1bd
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years agoMerge "Skip detecting content renames for binary files"
Han-Wen NIenhuys [Mon, 31 May 2021 12:57:13 +0000 (08:57 -0400)]
Merge "Skip detecting content renames for binary files"

3 years agoSkip detecting content renames for binary files 39/178739/5
Youssef Elghareeb [Wed, 12 May 2021 13:35:45 +0000 (15:35 +0200)]
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

3 years agoMerge changes I34319d70,I43fad374,Ie531a253,Id0dfcfd0
Matthias Sohn [Fri, 28 May 2021 22:33:52 +0000 (18:33 -0400)]
Merge changes I34319d70,I43fad374,Ie531a253,Id0dfcfd0

* changes:
  Finish upgrading eclipse-jarsigner-plugin to 1.3.1
  Upgrade maven-javadoc-plugin to 3.3.0
  Update maven-project-info-reports-plugin to 3.1.2
  Update spotbugs-maven-plugin to 4.2.3

3 years agoRepoCommand: Retry commit on LockFailure 49/180949/8
Ivan Frade [Mon, 24 May 2021 16:53:08 +0000 (09:53 -0700)]
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>
3 years agoFinish upgrading eclipse-jarsigner-plugin to 1.3.1 76/181076/1
Marco Miller [Wed, 26 May 2021 19:55:32 +0000 (15:55 -0400)]
Finish upgrading eclipse-jarsigner-plugin to 1.3.1

Commit 46b0f8a04 started that upgrade while missing this additional
change.

Change-Id: I34319d7006be13534497499e97536a8278906b1f
Signed-off-by: Marco Miller <marco.miller@ericsson.com>
3 years agoUpgrade maven-javadoc-plugin to 3.3.0 75/181075/1
Marco Miller [Wed, 26 May 2021 19:47:00 +0000 (15:47 -0400)]
Upgrade maven-javadoc-plugin to 3.3.0

Change-Id: I43fad374b6af1700c078b29f5ff45e2fd0b4cd00
Signed-off-by: Marco Miller <marco.miller@ericsson.com>
3 years agoUpdate maven-project-info-reports-plugin to 3.1.2 73/181073/2
Marco Miller [Wed, 26 May 2021 19:42:03 +0000 (15:42 -0400)]
Update maven-project-info-reports-plugin to 3.1.2

Change-Id: Ie531a253a37459ee55ddb7f5ed7bad414fe6b67e
Signed-off-by: Marco Miller <marco.miller@ericsson.com>
3 years agoUpdate spotbugs-maven-plugin to 4.2.3 71/181071/1
Marco Miller [Wed, 26 May 2021 19:38:33 +0000 (15:38 -0400)]
Update spotbugs-maven-plugin to 4.2.3

Change-Id: Id0dfcfd060e19fb84fd5ec0cb7bafc9d13153660
Signed-off-by: Marco Miller <marco.miller@ericsson.com>
3 years agoJGit v5.12.0.202105261145-m3 62/181062/1 v5.12.0.202105261145-m3
Matthias Sohn [Wed, 26 May 2021 15:43:55 +0000 (17:43 +0200)]
JGit v5.12.0.202105261145-m3

Change-Id: I3b1af2032227900e6e0c6189f47bace1df67f0ab
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years agoMerge branch 'master' into stable-5.12 58/181058/1
Matthias Sohn [Wed, 26 May 2021 15:21:02 +0000 (17:21 +0200)]
Merge branch 'master' into stable-5.12

* master:
  RepoCommand: Do not set 'branch' if the revision is a tag
  pgm: rewrite parents when --parents flag is passed
  ApplyCommand: fix "no newline at end" detection
  ApplyCommand: handle completely empty context lines in text patches
  ApplyCommand: use byte arrays for text patches, not strings
  ApplyCommand: support binary patches
  ApplyCommand: add a stream to apply a delta patch
  ApplyCommand: add streams to read/write binary patch hunks
  ApplyCommand: add a base-85 codec
  ApplyCommand: convert to git internal format before applying patch
  SSH config: fix whitespace handling
  SSH config: fix negated patterns
  Fix @since tag for introduction of PUBKEY_ACCEPTED_ALGORITHMS
  Prepare 5.11.2-SNAPSHOT builds
  JGit v5.11.1.202105131744-r
  Add a cgit interoperability test for LockFile
  Add TemporaryBuffer.toString(int limit)
  LockFile: create OutputStream only when needed
  Add git config for conflict style merge/diff3

Change-Id: If7751ff99079eaea31ed1fce811d141ecf209727
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years agoRepoCommand: Do not set 'branch' if the revision is a tag 53/180953/5
Ivan Frade [Tue, 25 May 2021 00:31:25 +0000 (17:31 -0700)]
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>
3 years agoMerge "Add git config for conflict style merge/diff3"
Matthias Sohn [Wed, 26 May 2021 12:30:41 +0000 (08:30 -0400)]
Merge "Add git config for conflict style merge/diff3"

3 years agoMerge changes from topic "apply"
Matthias Sohn [Wed, 26 May 2021 12:12:17 +0000 (08:12 -0400)]
Merge changes from topic "apply"

* changes:
  ApplyCommand: fix "no newline at end" detection
  ApplyCommand: handle completely empty context lines in text patches
  ApplyCommand: use byte arrays for text patches, not strings
  ApplyCommand: support binary patches
  ApplyCommand: add a stream to apply a delta patch
  ApplyCommand: add streams to read/write binary patch hunks
  ApplyCommand: add a base-85 codec
  ApplyCommand: convert to git internal format before applying patch

3 years agopgm: rewrite parents when --parents flag is passed 57/178557/5
kylezhao [Tue, 30 Mar 2021 03:04:12 +0000 (11:04 +0800)]
pgm: rewrite parents when --parents flag is passed

According to [1], we should rewrite parents in RevWalkTextBuiltin
when variable parents is true.
[1]
https://git-scm.com/docs/git-rev-list#Documentation/git-rev-list.txt---parents

Change-Id: If5dca3b280366969d0488fa895bc37253a797394
Signed-off-by: kylezhao <kylezhao@tencent.com>
3 years agoApplyCommand: fix "no newline at end" detection 98/177598/6
Thomas Wolf [Wed, 10 Mar 2021 18:26:39 +0000 (19:26 +0100)]
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>
3 years agoApplyCommand: handle completely empty context lines in text patches 97/177597/6
Thomas Wolf [Wed, 10 Mar 2021 17:04:25 +0000 (18:04 +0100)]
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>
3 years agoApplyCommand: use byte arrays for text patches, not strings 96/177596/6
Thomas Wolf [Wed, 10 Mar 2021 13:25:37 +0000 (14:25 +0100)]
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>
3 years agoApplyCommand: support binary patches 95/177595/5
Thomas Wolf [Sun, 7 Mar 2021 17:50:23 +0000 (18:50 +0100)]
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>
3 years agoApplyCommand: add a stream to apply a delta patch 94/177594/4
Thomas Wolf [Sun, 7 Mar 2021 17:49:01 +0000 (18:49 +0100)]
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>
3 years agoApplyCommand: add streams to read/write binary patch hunks 93/177593/4
Thomas Wolf [Fri, 5 Mar 2021 23:00:15 +0000 (00:00 +0100)]
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>
3 years agoApplyCommand: add a base-85 codec 92/177592/4
Thomas Wolf [Fri, 5 Mar 2021 22:55:18 +0000 (23:55 +0100)]
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>
3 years agoApplyCommand: convert to git internal format before applying patch 91/177591/3
Thomas Wolf [Tue, 2 Mar 2021 08:53:08 +0000 (09:53 +0100)]
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>
3 years agoSSH config: fix whitespace handling 33/180633/2
Thomas Wolf [Sat, 15 May 2021 16:25:52 +0000 (18:25 +0200)]
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>
3 years agoSSH config: fix negated patterns 32/180632/2
Thomas Wolf [Sat, 15 May 2021 16:13:04 +0000 (18:13 +0200)]
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>
3 years agoFix @since tag for introduction of PUBKEY_ACCEPTED_ALGORITHMS 93/180593/1
Matthias Sohn [Fri, 14 May 2021 07:02:46 +0000 (09:02 +0200)]
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>
3 years agoMerge branch 'stable-5.11' 91/180591/3
Matthias Sohn [Fri, 14 May 2021 06:39:14 +0000 (08:39 +0200)]
Merge branch 'stable-5.11'

* stable-5.11:
  Prepare 5.11.2-SNAPSHOT builds
  JGit v5.11.1.202105131744-r

Change-Id: I940216261e25d7bb24e912a8971655198762703a
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years agoPrepare 5.11.2-SNAPSHOT builds 90/180590/2
Matthias Sohn [Fri, 14 May 2021 06:25:09 +0000 (08:25 +0200)]
Prepare 5.11.2-SNAPSHOT builds

Change-Id: Idfd81bd3bbcd99034f69fffb1a562bf07b0f8209
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years agoJGit v5.11.1.202105131744-r 85/180585/1 v5.11.1.202105131744-r
Matthias Sohn [Thu, 13 May 2021 21:42:10 +0000 (23:42 +0200)]
JGit v5.11.1.202105131744-r

Change-Id: Id74eecbde63edbc58b6262ae01ef34d8bebc0f88
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years agoMerge branch 'stable-5.12' 01/180501/2
Matthias Sohn [Wed, 12 May 2021 06:58:09 +0000 (08:58 +0200)]
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

3 years agoMerge branch 'stable-5.11' into stable-5.12 00/180500/2
Matthias Sohn [Wed, 12 May 2021 06:57:20 +0000 (08:57 +0200)]
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

3 years agoMerge branch 'stable-5.10' into stable-5.11 12/180512/1
Matthias Sohn [Wed, 12 May 2021 06:56:27 +0000 (08:56 +0200)]
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

3 years agoMerge branch 'stable-5.9' into stable-5.10 98/180498/2
Matthias Sohn [Wed, 12 May 2021 06:55:17 +0000 (08:55 +0200)]
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

3 years agoMerge branch 'stable-5.8' into stable-5.9 97/180497/2
Matthias Sohn [Tue, 11 May 2021 22:03:00 +0000 (00:03 +0200)]
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

3 years agoMerge branch 'stable-5.7' into stable-5.8 96/180496/1
Matthias Sohn [Tue, 11 May 2021 21:34:30 +0000 (23:34 +0200)]
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

3 years agoMerge branch 'stable-5.6' into stable-5.7 95/180495/1
Matthias Sohn [Tue, 11 May 2021 21:32:22 +0000 (23:32 +0200)]
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

3 years agoRemove texts which were added by mistake in 00386272 87/180487/1
Matthias Sohn [Tue, 11 May 2021 16:37:37 +0000 (18:37 +0200)]
Remove texts which were added by mistake in 00386272

Change-Id: Iaed25dac0bc9af8f3fda6138a5f9fe553bff5d39
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years agoFix formatting which was broken in 00386272 86/180486/1
Matthias Sohn [Tue, 11 May 2021 16:36:05 +0000 (18:36 +0200)]
Fix formatting which was broken in 00386272

Change-Id: I10a3e2b117e790f64386a8e9e7663db8e59230d9
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years agoMerge branch 'stable-5.12' 40/180440/1
Matthias Sohn [Mon, 10 May 2021 23:00:31 +0000 (01:00 +0200)]
Merge branch 'stable-5.12'

* stable-5.12:
  LockFile: create OutputStream only when needed
  Remove ReftableNumbersNotIncreasingException

Change-Id: I9d85187d00771beef908f1136015d059024f4118

3 years agoMerge branch 'stable-5.11' into stable-5.12 39/180439/1
Matthias Sohn [Mon, 10 May 2021 22:59:10 +0000 (00:59 +0200)]
Merge branch 'stable-5.11' into stable-5.12

* stable-5.11:
  LockFile: create OutputStream only when needed
  Remove ReftableNumbersNotIncreasingException

Change-Id: I7adb5c4fc28e0043a985b5136424f3f756b2f84f

3 years agoMerge branch 'stable-5.10' into stable-5.11 38/180438/1
Matthias Sohn [Mon, 10 May 2021 22:57:46 +0000 (00:57 +0200)]
Merge branch 'stable-5.10' into stable-5.11

* stable-5.10:
  LockFile: create OutputStream only when needed
  Remove ReftableNumbersNotIncreasingException

Change-Id: Id6e0a78caf12c19a01a88d1ddb8a7df2b3590f98

3 years agoMerge branch 'stable-5.9' into stable-5.10 37/180437/1
Matthias Sohn [Mon, 10 May 2021 22:56:57 +0000 (00:56 +0200)]
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

3 years agoMerge branch 'stable-5.8' into stable-5.9 36/180436/1
Matthias Sohn [Mon, 10 May 2021 22:55:54 +0000 (00:55 +0200)]
Merge branch 'stable-5.8' into stable-5.9

* stable-5.8:
  LockFile: create OutputStream only when needed
  Remove ReftableNumbersNotIncreasingException

Change-Id: I3274c97cf560398c3c4c27d6759500452f315db0

3 years agoMerge branch 'stable-5.7' into stable-5.8 35/180435/1
Matthias Sohn [Mon, 10 May 2021 22:51:21 +0000 (00:51 +0200)]
Merge branch 'stable-5.7' into stable-5.8

* stable-5.7:
  LockFile: create OutputStream only when needed
  Remove ReftableNumbersNotIncreasingException

Change-Id: Ib3f280e0741f87a0ff615d857a5ea39b35527e74

3 years agoMerge branch 'stable-5.6' into stable-5.7 34/180434/1
Matthias Sohn [Mon, 10 May 2021 22:19:10 +0000 (00:19 +0200)]
Merge branch 'stable-5.6' into stable-5.7

* stable-5.6:
  LockFile: create OutputStream only when needed

Change-Id: I7c0e37d2cee0923662a7e39df5a802a84c017e4f

3 years agoLockFile: create OutputStream only when needed 32/180432/1
Thomas Wolf [Tue, 4 May 2021 21:48:56 +0000 (23:48 +0200)]
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>
3 years agoAdd a cgit interoperability test for LockFile 52/180352/5
Matthias Sohn [Fri, 7 May 2021 08:51:59 +0000 (10:51 +0200)]
Add a cgit interoperability test for LockFile

Change-Id: I30cacd1f50f8f4ff4dd91ad291bf279980e3c4b5
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years agoAdd TemporaryBuffer.toString(int limit) 51/180351/4
Matthias Sohn [Fri, 7 May 2021 08:50:58 +0000 (10:50 +0200)]
Add TemporaryBuffer.toString(int limit)

Change-Id: I8603fcdfd0244088b3b217f002a78e7a646ea205
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years agoLockFile: create OutputStream only when needed 98/180198/4
Thomas Wolf [Tue, 4 May 2021 21:48:56 +0000 (23:48 +0200)]
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>
3 years agoMerge branch 'stable-5.12' 83/180283/2
Matthias Sohn [Thu, 6 May 2021 07:55:52 +0000 (09:55 +0200)]
Merge branch 'stable-5.12'

* stable-5.12:
  Prepare 5.12.0-SNAPSHOT builds
  JGit v5.12.0.202105051250-m2

Change-Id: I88e0e3d341f375d6c85d532e4f010ac20f81c3d1
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years agoPrepare 5.12.0-SNAPSHOT builds 80/180280/2
Matthias Sohn [Thu, 6 May 2021 07:25:31 +0000 (09:25 +0200)]
Prepare 5.12.0-SNAPSHOT builds

Change-Id: I2fc5305e7eaaa4593d418fc3b31d20e4b6e1e585

3 years agoJGit v5.12.0.202105051250-m2 52/180252/1 v5.12.0.202105051250-m2
Matthias Sohn [Wed, 5 May 2021 15:50:19 +0000 (17:50 +0200)]
JGit v5.12.0.202105051250-m2

Change-Id: Ic7d86c91ec0ff9aa0678dcb971c197e62a4ca2dc
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years agoAdd git config for conflict style merge/diff3 18/180118/1
Thomas Wolf [Thu, 29 Apr 2021 10:58:23 +0000 (12:58 +0200)]
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>
3 years agoMerge "[releng] Update eclipse-jarsigner-plugin to 1.3.1"
Matthias Sohn [Mon, 26 Apr 2021 21:07:56 +0000 (17:07 -0400)]
Merge "[releng] Update eclipse-jarsigner-plugin to 1.3.1"

3 years agoUpdate jetty to 9.4.40.v20210413 33/179733/2
Matthias Sohn [Fri, 23 Apr 2021 13:58:59 +0000 (15:58 +0200)]
Update jetty to 9.4.40.v20210413

Change-Id: I5585b9a22bf20a49ad4bb9a24e053325792ec546
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years ago[releng] Update eclipse-jarsigner-plugin to 1.3.1 27/179527/1
Thomas Wolf [Mon, 19 Apr 2021 20:48:06 +0000 (22:48 +0200)]
[releng] Update eclipse-jarsigner-plugin to 1.3.1

Up from 1.1.7. See [1] for the reason.

[1] https://www.eclipse.org/lists/cbi-dev/msg02374.html

Change-Id: Ia7c1c9f443793ce476acd6ddfe521ea488a1a60b
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
3 years agoImplement ours/theirs content conflict resolution 34/179234/2
Thomas Wolf [Mon, 12 Apr 2021 21:50:54 +0000 (23:50 +0200)]
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>
3 years agossh: ensure list is modifiable before using Iterator.remove(). 13/179313/1
Thomas Wolf [Wed, 14 Apr 2021 15:47:38 +0000 (17:47 +0200)]
ssh: ensure list is modifiable before using Iterator.remove().

Bug: 572849
Change-Id: If6be0024d2069e2d85541d7e87c6b0371db4b3df
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
3 years agoUpdate orbit to S20210406213021 and add 4.20-staging target 48/179148/1
Matthias Sohn [Sat, 10 Apr 2021 20:36:33 +0000 (22:36 +0200)]
Update orbit to S20210406213021 and add 4.20-staging target

Change-Id: I465831b0edf359b504918009dd7fb03a77b06305
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years agoFix typo in test method name 87/179087/1
Thomas Wolf [Fri, 2 Apr 2021 18:33:42 +0000 (20:33 +0200)]
Fix typo in test method name

Change-Id: I34718829435daf8ded4ce596c824dd3cfbafbaf6
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
3 years agoMerge "Upgrade ecj to 3.25.0"
Matthias Sohn [Wed, 7 Apr 2021 23:08:19 +0000 (19:08 -0400)]
Merge "Upgrade ecj to 3.25.0"

3 years agoAllow file mode conflicts in virtual base commit on recursive merge. 30/178730/4
Marija Savtchouk [Thu, 1 Apr 2021 14:52:26 +0000 (15:52 +0100)]
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>
3 years agosshd: don't lock the known_hosts files on reading 44/178744/1
Thomas Wolf [Mon, 22 Mar 2021 11:20:52 +0000 (12:20 +0100)]
sshd: don't lock the known_hosts files on reading

Similar to git config file reading lock the file only when writing.
There may still be lock conflicts on writing, but those in the worst
case result in an entry not being added and thus being asked for later
again.

Because the OpenSshServerkeyDatabase and its HostKeyFiles may be (and
usually are) shared between different SSH sessions, we still need to
ensure in-process mutual exclusion.

Bug: 559548
Change-Id: I4af97628deff9eaac2520576917c856949f2680d
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
3 years agoAllow info messages in UsernamePasswordCredentialsProvider 43/178743/1
Thomas Wolf [Sat, 20 Mar 2021 17:54:17 +0000 (18:54 +0100)]
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>
3 years agossh config: do environment variable replacement 42/178742/1
Thomas Wolf [Sat, 20 Mar 2021 17:46:13 +0000 (18:46 +0100)]
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>
3 years agosshd: implement server-sig-algs SSH extension (client side) 41/178741/1
Thomas Wolf [Fri, 19 Mar 2021 20:48:04 +0000 (21:48 +0100)]
sshd: implement server-sig-algs SSH extension (client side)

Apache MINA sshd has an implementation of this, but it doesn't comply
to RFC 8308 [1] and it is buggy. (See SSHD-1141 [2].)

Add a simpler KexExtensionHandler and if the server sends extension
server-sig-algs, use its value to re-order the chosen signature
algorithms such that the algorithms the server announced as supported
are at the front.

If the server didn't tell us anything, don't do anything. RFC 8308
suggests for RSA to default to ssh-rsa, but says once rsa-sha2-* was
"widely enough" adopted, defaulting to that might be OK.

Currently we seem to be in a transition phase; Fedora 33 has already
disabled ssh-rsa by default, and openssh is about to do so. Whatever
we might do without info from the server, it'd be good for some servers
and bad for others. So don't do anything and let the user re-order via
ssh config PubkeyAcceptedAlgorithms on a case-by-case basis.

[1] https://tools.ietf.org/html/rfc8308
[2] https://issues.apache.org/jira/browse/SSHD-1141

Bug: 572056
Change-Id: I59aa691a030ffe0fae54289df00ca5c6e165817b
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
3 years agoUpgrade ecj to 3.25.0 95/178595/1
Marco Miller [Tue, 30 Mar 2021 17:56:34 +0000 (13:56 -0400)]
Upgrade ecj to 3.25.0

Change-Id: I09d018205564205b194de020941fd4152ae8b24e
Signed-off-by: Marco Miller <marco.miller@ericsson.com>
3 years agoBazel: Remove unused dependencies flagged by unused_deps 53/178453/1
David Ostrovsky [Sat, 27 Mar 2021 14:27:01 +0000 (15:27 +0100)]
Bazel: Remove unused dependencies flagged by unused_deps

Change-Id: I7fcb494fdce4bb3de203236fa51b188b099d842f
Signed-off-by: David Ostrovsky <david@ostrovsky.org>
3 years agoBazel: Format build file with buildifier 52/178452/1
David Ostrovsky [Sat, 27 Mar 2021 13:59:54 +0000 (14:59 +0100)]
Bazel: Format build file with buildifier

Change-Id: I4c0c7ffb04d7bed517faf1a4932d8c76738bff11
Signed-off-by: David Ostrovsky <david@ostrovsky.org>
3 years agoUpgrade wagon-ssh to 3.4.3 31/178331/2
Marco Miller [Wed, 24 Mar 2021 16:12:39 +0000 (12:12 -0400)]
Upgrade wagon-ssh to 3.4.3

Change-Id: Ibc3a9ea83e264920b4a995f6d22904fe3be97d5a
Signed-off-by: Marco Miller <marco.miller@ericsson.com>
3 years agoUpdate spring-boot-maven-plugin to 2.4.4 22/178422/1
Matthias Sohn [Fri, 26 Mar 2021 11:49:00 +0000 (12:49 +0100)]
Update spring-boot-maven-plugin to 2.4.4

Change-Id: I8ba1e544b2e80ad66aacd230c4a442bdc1d60375

3 years agoUpdate spotbugs-maven-plugin to 4.2.2 21/178421/1
Matthias Sohn [Fri, 26 Mar 2021 11:32:55 +0000 (12:32 +0100)]
Update spotbugs-maven-plugin to 4.2.2

Change-Id: Ib522b66249e5493c3fd191b5c56e87f8941569c2

3 years agoUpdate japicmp-maven-plugin to 0.15.3 20/178420/1
Matthias Sohn [Fri, 26 Mar 2021 11:28:13 +0000 (12:28 +0100)]
Update japicmp-maven-plugin to 0.15.3

Change-Id: I3b1b295e7f97182a5541b1912e0acbfffb981d71

3 years agoMerge branch 'stable-5.11' 01/178401/1
Matthias Sohn [Fri, 26 Mar 2021 08:55:58 +0000 (09:55 +0100)]
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>
3 years agoRefactor CommitCommand to improve readability 42/178142/2
Matthias Sohn [Sat, 20 Mar 2021 10:35:27 +0000 (11:35 +0100)]
Refactor CommitCommand to improve readability

Change-Id: Id3cac81cd32c07f677b7f669d58e32b5290e1790
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years agoCommitCommand: fix formatting 41/178141/2
Matthias Sohn [Sat, 20 Mar 2021 10:20:52 +0000 (11:20 +0100)]
CommitCommand: fix formatting

Change-Id: I5efd1ffee4ebb08b3b5c27e29162493615727840
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years agoCommitCommand: remove unncessary comment 40/178140/2
Matthias Sohn [Sat, 20 Mar 2021 10:19:07 +0000 (11:19 +0100)]
CommitCommand: remove unncessary comment

Let the code speak for itself.

Change-Id: I6a6d6c327ffac23fc607295a7f4fd3131b3d1e58
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years agoEnsure post-commit hook is called after index lock was released 38/178138/3
Matthias Sohn [Sat, 20 Mar 2021 10:15:20 +0000 (11:15 +0100)]
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>
3 years agosshd: try all configured signature algorithms for a key 43/178043/3
Thomas Wolf [Fri, 19 Mar 2021 08:35:34 +0000 (09:35 +0100)]
sshd: try all configured signature algorithms for a key

For RSA keys, there may be several configured signature algorithms:
rsa-sha2-512, rsa-sha2-256, and ssh-rsa. Upstream sshd has bug
SSHD-1105 [1] and always and unconditionally uses only the first
configured algorithm. With the default order, this means that it cannot
connect to a server that knows only ssh-rsa, like for instance Apache
MINA sshd servers older than 2.6.0.

This affects for instance bitbucket.org or also AWS Code Commit.

Re-introduce our own pubkey authenticator that fixes this.

Note that a server may impose a penalty (back-off delay) for subsequent
authentication attempts with signature algorithms unknown to the server.
In such cases, users can re-order the signature algorithm list via the
PubkeyAcceptedAlgorithms (formerly PubkeyAcceptedKeyTypes) ssh config.

[1] https://issues.apache.org/jira/browse/SSHD-1105

Bug: 572056
Change-Id: I7fb9c759ab6532e5f3b6524e9084085ddb2f30d6
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
3 years agosshd: modernize ssh config file parsing 42/178042/2
Thomas Wolf [Fri, 19 Mar 2021 08:24:31 +0000 (09:24 +0100)]
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>
3 years agosshd: implement ssh config PubkeyAcceptedAlgorithms 41/178041/2
Thomas Wolf [Thu, 18 Mar 2021 20:16:48 +0000 (21:16 +0100)]
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>
3 years agoOptimize RevWalkUtils.findBranchesReachableFrom() 54/176854/4
Adithya Chakilam [Tue, 23 Feb 2021 19:58:03 +0000 (13:58 -0600)]
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>
3 years agoIntroduce getMergedInto(RevCommit commit, Collection<Ref> refs) 39/176439/6
Adithya Chakilam [Thu, 18 Feb 2021 19:41:19 +0000 (13:41 -0600)]
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>
3 years agoSkip detecting content renames for large files 53/177553/5
Youssef Elghareeb [Thu, 11 Mar 2021 12:01:14 +0000 (13:01 +0100)]
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] https://git.eclipse.org/r/plugins/gitiles/jgit/jgit/+/232876421d067a1242e8afcaa33b9171342fee3e/org.eclipse.jgit/src/org/eclipse/jgit/diff/RawText.java#386

Change-Id: Idbc2c29bd381c6e387185204638f76fda47df41e
Signed-off-by: Youssef Elghareeb <ghareeb@google.com>
3 years agoRemove unused API problem filters 42/177642/4
Matthias Sohn [Thu, 11 Mar 2021 23:30:14 +0000 (00:30 +0100)]
Remove unused API problem filters

Change-Id: I34be8afa42971b94d86312ff8b672b133cd23d45
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years agoDocument http options supported by JGit 00/177700/1
Thomas Wolf [Sat, 13 Mar 2021 16:05:47 +0000 (17:05 +0100)]
Document http options supported by JGit

Change-Id: I0af4f9991fdb4f09de25f743d1e0dca67ceaa18b
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
3 years agoHTTP cookies: do tilde expansion on http.cookieFile 49/177649/1
Thomas Wolf [Tue, 9 Mar 2021 21:23:14 +0000 (22:23 +0100)]
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>
3 years agoPrepare 5.12.0-SNAPSHOT builds 19/177519/2
Matthias Sohn [Wed, 10 Mar 2021 15:06:00 +0000 (16:06 +0100)]
Prepare 5.12.0-SNAPSHOT builds

Change-Id: I736de7c3deb11da75777d459f47332df0b486443
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years agoMerge branch 'stable-5.11' 18/177518/1
Matthias Sohn [Wed, 10 Mar 2021 15:05:18 +0000 (16:05 +0100)]
Merge branch 'stable-5.11'

* stable-5.11:
  Update Orbit to R20210223232630
  Prepare 5.11.1-SNAPSHOT builds
  JGit v5.11.0.202103091610-r
  Prepare 5.11.0-SNAPSHOT builds
  JGit v5.11.0.202103031150-rc1

Change-Id: I808e53a3c54a49d0dd62c69818ea2f5672e16a91

3 years agoUpdate Orbit to R20210223232630 68/177468/1
Matthias Sohn [Tue, 9 Mar 2021 23:39:29 +0000 (00:39 +0100)]
Update Orbit to R20210223232630

Change-Id: I7577131b2c6e808b59f6c453233b261c64646d35
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>