]> source.dussan.org Git - jgit.git/log
jgit.git
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 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>
3 years agoPrepare 5.11.1-SNAPSHOT builds 65/177465/1
Matthias Sohn [Tue, 9 Mar 2021 22:42:31 +0000 (23:42 +0100)]
Prepare 5.11.1-SNAPSHOT builds

Change-Id: I94628ccbb5099a65aa4345cfd28a141ff5555b68
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years agoJGit v5.11.0.202103091610-r 61/177461/1 v5.11.0.202103091610-r
Matthias Sohn [Tue, 9 Mar 2021 21:10:22 +0000 (22:10 +0100)]
JGit v5.11.0.202103091610-r

Change-Id: I8e6855eaf7228459f492036feb4e34ca085698a7
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years agoMerge branch 'master' into stable-5.11 44/177444/1
Matthias Sohn [Tue, 9 Mar 2021 17:00:55 +0000 (18:00 +0100)]
Merge branch 'master' into stable-5.11

* master:
  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
  Create a PackFile class for Pack filenames

Change-Id: I1d56517cb6a95e10aed22cdb9e5f3e504872d110

3 years agoManually set status of jmh dependencies 25/177325/2
Matthias Sohn [Sun, 7 Mar 2021 17:41:05 +0000 (18:41 +0100)]
Manually set status of jmh dependencies

The following jmh dependencies were approved as works-with:
- jmh-core/1.21 has GPL-2.0 license and was approved in CQ20517
- jmh-generator-annprocess/1.21 has GPL-2.0 license and was approved in
CQ20518

Change-Id: Ibbe28c6e8359c576b23f40281e74f2e0d4a0dee0

3 years agoUpdate DEPENDENCIES report for 5.11.0 24/177324/3
Matthias Sohn [Sun, 7 Mar 2021 16:44:05 +0000 (17:44 +0100)]
Update DEPENDENCIES report for 5.11.0

Computed by dash license-tool-plugin [1].

[1] https://github.com/eclipse/dash-licenses

Change-Id: I28727115914613cefdcf9a9f462c195b6af23156

3 years agoAdd dependency to dash-licenses 23/177323/2
Matthias Sohn [Wed, 27 Jan 2021 23:25:06 +0000 (00:25 +0100)]
Add dependency to dash-licenses

This is required to run the license check using the license tool [1]
required by the Eclipse project handbook [2]:

mvn org.eclipse.dash:license-tool-plugin:license-check -Ddash.summary=DEPENDENCIES

Note: the tool still requires Java 11 hence it needs to be run in a
separate build step and is not yet integrated in the build which runs
on Java 8.

[1] https://github.com/eclipse/dash-licenses
[2] https://www.eclipse.org/projects/handbook/#ip-license-tool

Change-Id: Ib41d54de246c3c9499cc3be9f026294c39fdfd99

3 years agoPackFile: Add id + ext based constructors 92/177192/3
Nasser Grainawi [Thu, 4 Mar 2021 21:14:43 +0000 (14:14 -0700)]
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>
3 years agoGC: deleteOrphans: Use PackFile 91/177191/1
Nasser Grainawi [Thu, 4 Mar 2021 00:05:21 +0000 (17:05 -0700)]
GC: deleteOrphans: Use PackFile

It's easier to follow the logic here when we can use our own objects
instead of Strings.

Change-Id: I6a166edcc67903fc1ca3544f458634c4cef8fde7
Signed-off-by: Nasser Grainawi <quic_nasserg@quicinc.com>
3 years agoPackExt: Convert to Enum 53/176953/3
Nasser Grainawi [Fri, 26 Feb 2021 22:49:06 +0000 (15:49 -0700)]
PackExt: Convert to Enum

This class already looked very much like an Enum, but wasn't one.

As an Enum, we can use PackExt in EnumMaps and EnumSets. Convert the
Map key usage in PackDirectory to an EnumMap.

Change-Id: Ice097fd468a05805f914e6862fbd1d96ec8c45d1
Signed-off-by: Nasser Grainawi <quic_nasserg@quicinc.com>
3 years agoRestore preserved packs during missing object seeks 88/122288/14
Martin Fick [Tue, 15 Dec 2020 21:20:44 +0000 (14:20 -0700)]
Restore preserved packs during missing object seeks

Provide a recovery path for objects being referenced during the pack
pruning race. Due to the pack pruning race, it is possible for objects
to become referenced after a pack has been deemed safe to prune, but
before it actually gets pruned. If this happened previously, the newly
referenced objects would be missing and potentially result in a
corrupted ref.

Add the ability to recover from this situation when an object is missing
but happens to still be available in a pack in the "preserved"
directory. This is likely only useful when used in conjunction with the
--preserve-old-packs GC option, which prunes packs by hard-linking to
the preserved directory. If an object is missing and found in a pack in
the preserved directory, immediately recover that pack and its
associated files (idx, bitmaps...) by moving them back to the original
pack directory, and then retry the operation that would have failed due
to the missing object. This retry can now succeed and the repository
may avoid corruption. This approach should drastically reduce the
chance of a corrupt repository during pack pruning at very little extra
cost. This extra cost should only be incurred when objects are missing
and a failure would normally occur.

Change-Id: I2a704e3276b88cc892159d9bfe2455c6eec64252
Signed-off-by: Martin Fick <quic_mfick@quicinc.com>
Signed-off-by: Nasser Grainawi <quic_nasserg@quicinc.com>
3 years agoPack: Replace extensions bitset with bitmapIdx PackFile 29/175129/8
Nasser Grainawi [Thu, 11 Feb 2021 06:26:17 +0000 (23:26 -0700)]
Pack: Replace extensions bitset with bitmapIdx PackFile

The only extension that was ever consulted from the bitmap was the
bitmap index. We can simplify the Pack code as well as the code of
all the callers if we focus on just that usage.

Change-Id: I799ddfdee93142af67ce5081d14a430d36aa4c15
Signed-off-by: Nasser Grainawi <quic_nasserg@quicinc.com>
3 years agoPackDirectory: Use PackFile to ensure we find preserved packs 30/175130/11
Nasser Grainawi [Thu, 11 Feb 2021 06:33:43 +0000 (23:33 -0700)]
PackDirectory: Use PackFile to ensure we find preserved packs

Update scanPacksImpl and listPackDirectory (renamed to
getPackFilesByExtById) to use the new PackFile functionality to
validate file names and complete pack file sets (.pack, .idx, etc).

Most importantly, this allows a later change to rely on scanPacks() to
complete a packList that contains packs with the 'old-' prefix in their
extension.

This also eliminates duplication of logic for how to identify and
construct pack files.

Change-Id: I7175e5fefb187a29e0a7cf53c392aee922314f31
Signed-off-by: Nasser Grainawi <quic_nasserg@quicinc.com>
3 years agoGC: Use PackFile to de-dup logic 33/176533/4
Nasser Grainawi [Fri, 19 Feb 2021 00:36:49 +0000 (17:36 -0700)]
GC: Use PackFile to de-dup logic

GC has several places where it tries to build files names for packs that
we can use the PackFile class for instead.

Change-Id: I99e5ceff9050f8583368fca35279251955e4644d
Signed-off-by: Nasser Grainawi <quic_nasserg@quicinc.com>
3 years agoCreate a PackFile class for Pack filenames 45/176145/5
Nasser Grainawi [Thu, 11 Feb 2021 05:51:05 +0000 (22:51 -0700)]
Create a PackFile class for Pack filenames

The PackFile class is intended to be a central place to do all
common pack filename manipulation and parsing to help reduce repeated
code and bugs. Use the PackFile class in the Pack class and in many
tests to ensure it works well in a variety of situations. Later changes
will expand use of PackFiles to even more areas.

Change-Id: I921b30f865759162bae46ddd2c6d669de06add4a
Signed-off-by: Nasser Grainawi <quic_nasserg@quicinc.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years agoPrepare 5.11.0-SNAPSHOT builds 63/177163/1
Matthias Sohn [Thu, 4 Mar 2021 15:27:51 +0000 (16:27 +0100)]
Prepare 5.11.0-SNAPSHOT builds

Change-Id: I89ed49a6acc53dd75d16f40c99e1140e0c18f646
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years agoJGit v5.11.0.202103031150-rc1 07/177107/1 v5.11.0.202103031150-rc1
Matthias Sohn [Wed, 3 Mar 2021 16:48:00 +0000 (17:48 +0100)]
JGit v5.11.0.202103031150-rc1

Change-Id: I0a86fa59645888f9f36ea6938c9121e095f02fc6
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 years agoMerge branch 'master' into stable-5.11 03/177103/1
Matthias Sohn [Wed, 3 Mar 2021 16:44:20 +0000 (17:44 +0100)]
Merge branch 'master' into stable-5.11

* master:
  HTTP: cookie file stores expiration in seconds
  Update Orbit to S20210223232630
  LFS: handle invalid pointers better
  Fix errorprone configuration for maven-compiler-plugin with javac

Change-Id: Ib76e754bd36789de0a3c6b85a4814aa1fe9cb401

3 years agoHTTP: cookie file stores expiration in seconds 83/176983/3
Thomas Wolf [Mon, 1 Mar 2021 07:30:09 +0000 (08:30 +0100)]
HTTP: cookie file stores expiration in seconds

A cookie file stores the expiration in seconds since the Linux Epoch,
not in milliseconds. Correct reading and writing cookie files; with
a backwards-compatibility hack to read files that contain a millisecond
timestamp.

Add a test, and fix tests not to rely on the actual current time so
that they will also run successfully after 2030-01-01 noon.

Bug: 571574
Change-Id: If3ba68391e574520701cdee119544eedc42a1ff2
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
3 years agoMerge "Update Orbit to S20210223232630"
Matthias Sohn [Tue, 2 Mar 2021 16:07:49 +0000 (11:07 -0500)]
Merge "Update Orbit to S20210223232630"