]> source.dussan.org Git - jgit.git/log
jgit.git
22 months agoPull up additionalRefsNames from RefDirectory to RefDatabase 56/197556/6
Matthias Sohn [Sat, 9 Oct 2021 00:47:03 +0000 (02:47 +0200)]
Pull up additionalRefsNames from RefDirectory to RefDatabase

This enables to reuse this constant in all RefDatabase implementations.

Change-Id: I13d8fb780de24f71e005b698965fb5bcdbf3c728

22 months agoAdd TernarySearchTree 55/197555/6
Matthias Sohn [Tue, 5 Oct 2021 02:08:49 +0000 (04:08 +0200)]
Add TernarySearchTree

A ternary search tree is a type of tree where nodes are arranged in a
manner similar to a binary search tree, but with up to three children
rather than the binary tree's limit of two.

Each node of a ternary search tree stores a single character, a
reference to a value object and references to its three children named
equal kid, lo kid and hi kid. The lo kid pointer must point to a node
whose character value is less than the current node. The hi kid pointer
must point to a node whose character is greater than the current
node.[1] The equal kid points to the next character in the word. Each
node in a ternary search tree represents a prefix of the stored strings.
All strings in the middle subtree of a node start with that prefix.

Like other prefix trees, a ternary search tree can be used as an
associative map with the ability for incremental string search. Ternary
search trees are more space efficient compared to standard prefix trees,
at the cost of speed.

They allow efficient prefix search which is important to implement
searching refs by prefix in a RefDatabase.

Searching by prefix returns all keys if the prefix is an empty string.

Bug: 576165
Change-Id: If160df70151a8e1c1bd6716ee4968e4c45b2c7ac

22 months agoCommitGraph: teach ObjectReader to get commit-graph 29/197629/12
kylezhao [Mon, 12 Dec 2022 06:49:16 +0000 (14:49 +0800)]
CommitGraph: teach ObjectReader to get commit-graph

FileRepository's ObjectReader#getCommitGraph will return commit-graph
when it exists and core.commitGraph is true.

DfsRepository is not supported currently.

Change-Id: I992d43d104cf542797e6949470e95e56de025107
Signed-off-by: kylezhao <kylezhao@tencent.com>
22 months agoMerge "CommitGraph: add commit-graph for FileObjectDatabase"
Ivan Frade [Tue, 3 Jan 2023 19:56:53 +0000 (14:56 -0500)]
Merge "CommitGraph: add commit-graph for FileObjectDatabase"

22 months agoPatchApplier: fix handling of last newline in text patch 24/197724/7
Thomas Wolf [Fri, 16 Dec 2022 22:23:03 +0000 (23:23 +0100)]
PatchApplier: fix handling of last newline in text patch

If the last line came from the patch, use the patch to determine whether
or not there should be a trailing newline. Otherwise use the old text.

Add test cases for
- no newline at end, last line not in patch hunk
- no newline at end, last line in patch hunk
- patch removing the last newline
- patch adding a newline at the end of file not having one

all for core.autocrlf false, true, and input.

Add a test case where the "no newline" indicator line is not the last
line of the last hunk. This can happen if the patch ends with removals
at the file end.

Bug: 581234
Change-Id: I09d079b51479b89400ad300d0662c1dcb50deab6
Also-by: Yuriy Mitrofanov <a2terminator@mail.ru>
Signed-off-by: Thomas Wolf <twolf@apache.org>
23 months agoCommitGraph: add commit-graph for FileObjectDatabase 78/183078/43
kylezhao [Wed, 14 Jul 2021 02:52:10 +0000 (10:52 +0800)]
CommitGraph: add commit-graph for FileObjectDatabase

This change makes JGit can read .git/objects/info/commit-graph file
and then get CommitGraph.

Loading a new commit-graph into memory requires additional time. After
testing, loading a copy of the Linux's commit-graph(1039139 commits)
is under 50ms.

Bug: 574368
Change-Id: Iadfdd6ed437945d3cdfdbe988cf541198140a8bf
Signed-off-by: kylezhao <kylezhao@tencent.com>
23 months agoReformat PatchApplier and PatchApplierTest 23/197723/2
Thomas Wolf [Fri, 16 Dec 2022 22:40:42 +0000 (23:40 +0100)]
Reformat PatchApplier and PatchApplierTest

Some lines were too long, unnecessary fully qualified class names,
and an assertEquals(actual, expected) when it should have been
assertEquals(expected, actual).

Change-Id: I3b3c46c963afe2fb82a79c1e93970e73778877e5
Signed-off-by: Thomas Wolf <twolf@apache.org>
23 months agoPackWriter#prepareBitmapIndex: add clarifying comments 59/197759/2
Anna Papitto [Tue, 20 Dec 2022 00:20:14 +0000 (16:20 -0800)]
PackWriter#prepareBitmapIndex: add clarifying comments

New readers of #prepareBitmapIndex may be confused about the manual
memory management (hidden mutation and nulling out pointers).

Add two clarifying comments to help future readers.

Change-Id: I93cab1919066efda37e96c47667f6991f67e377e

23 months agoMerge "IO#readFully: provide overload that fills the full array"
Ivan Frade [Mon, 19 Dec 2022 18:50:08 +0000 (13:50 -0500)]
Merge "IO#readFully: provide overload that fills the full array"

23 months agoIO#readFully: provide overload that fills the full array 89/197589/14
Anna Papitto [Fri, 2 Dec 2022 23:56:56 +0000 (15:56 -0800)]
IO#readFully: provide overload that fills the full array

IO#readFully is often called with the intent to fill the destination
array from beginning to end. The redundant arguments for where to start
and stop filling are opportunities for bugs if specified incorrectly or
if not changed to match a changed array length.

Provide a overloaded method for filling the full destination array.

Change-Id: I964f18f4a061189cce1ca00ff0258669277ff499
Signed-off-by: Anna Papitto <annapapitto@google.com>
23 months agoFix API warnings for the new CommitGraph 25/197725/1
Thomas Wolf [Sat, 17 Dec 2022 09:36:50 +0000 (10:36 +0100)]
Fix API warnings for the new CommitGraph

Mark the internal package as internal, visible only to the test bundle.
Add an API filter for CoreConfig.DEFAULT_COMMIT_GRAPH_ENABLE.

Change-Id: Ib62a93b873c93daf638b6c57e62fd267e16801bb
Signed-off-by: Thomas Wolf <twolf@apache.org>
23 months agoPackReverseIndex#findPosition: fix typo in method name 86/197586/11
Anna Papitto [Wed, 30 Nov 2022 23:10:44 +0000 (15:10 -0800)]
PackReverseIndex#findPosition: fix typo in method name

The package-private findPostion method has a type in it. The typo will
become more widespread when a file-based implementation class is
introduced.

Correct the spelling to findPosition before the file-based
implementation is introduced.

Change-Id: Ib285f5a3f9a333ace1782dae9b5d425505eb962a
Signed-off-by: Anna Papitto <annapapitto@google.com>
23 months agoGC: Write commit-graph files when gc 76/182976/40
kylezhao [Mon, 12 Jul 2021 09:07:13 +0000 (17:07 +0800)]
GC: Write commit-graph files when gc

If 'core.commitGraph' and 'gc.writeCommitGraph' are both true, then gc
will rewrite the commit-graph file when 'git gc' is run. Defaults to
false while the commit-graph feature matures.

Bug: 574368
Change-Id: Ic94cd69034c524285c938414610f2e152198e06e
Signed-off-by: kylezhao <kylezhao@tencent.com>
23 months agoCommitGraph: add core.commitGraph config 28/197628/5
kylezhao [Mon, 12 Dec 2022 02:22:04 +0000 (10:22 +0800)]
CommitGraph: add core.commitGraph config

Change-Id: I3b5e735ebafba09ca18fd83da479c7950fa3ea8d
Signed-off-by: kylezhao <kylezhao@tencent.com>
23 months agoMerge "Gc#deleteOrphans: avoid dependence on PackExt alphabetical ordering"
Ivan Frade [Fri, 16 Dec 2022 13:20:24 +0000 (08:20 -0500)]
Merge "Gc#deleteOrphans: avoid dependence on PackExt alphabetical ordering"

23 months agoCommitGraph: implement commit-graph read 92/182892/38
kylezhao [Thu, 8 Jul 2021 12:19:13 +0000 (20:19 +0800)]
CommitGraph: implement commit-graph read

Git introduced a new file storing the topology and some metadata of
the commits in the repo (commitGraph). With this data, git can browse
commit history without parsing the pack, speeding up e.g.
reachability checks.

This change teaches JGit to read commit-graph-format file, following
the upstream format([1]).

JGit can read a commit-graph file from a buffered stream, which means
that we can provide this feature for both FileRepository and
DfsRepository.

[1] https://git-scm.com/docs/commit-graph-format/2.21.0

Bug: 574368
Change-Id: Ib5c0d6678cb242870a0f5841bd413ad3885e95f6
Signed-off-by: kylezhao <kylezhao@tencent.com>
23 months agoGc#deleteOrphans: avoid dependence on PackExt alphabetical ordering 84/197584/8
Anna Papitto [Thu, 10 Nov 2022 22:48:22 +0000 (14:48 -0800)]
Gc#deleteOrphans: avoid dependence on PackExt alphabetical ordering

Deleting orphan files depends on .pack and .keep being reverse-sorted
to before the corresponding index files that could be orphans. The new
reverse index file extension (.rev) will break that frail dependency.

Rewrite Gc#deleteOrphans to avoid that dependence by tracking which pack
names have a .pack or .keep file and then deleting any index files that
without a corresponding one. This approach takes linear time instead of
the O(n logn) time needed for sorting.

Change-Id: If83c378ea070b8871d4b01ae008e7bf8270de763
Signed-off-by: Anna Papitto <annapapitto@google.com>
23 months agoWalkPushConnection: Sanitize paths given to transports 93/197493/3
Jeremy T. Braun [Tue, 6 Dec 2022 02:38:43 +0000 (20:38 -0600)]
WalkPushConnection: Sanitize paths given to transports

These paths are given to the underlying URI-based transports (s3, sftp,
http), all of which expect forward-slash as the path separator
character.

Change-Id: I3cbb5928c9531a4da4691411bd8ac248fdf47ef2

23 months agoMerge changes Iad832fe1,Icef9658c
Matthias Sohn [Wed, 14 Dec 2022 09:50:54 +0000 (04:50 -0500)]
Merge changes Iad832fe1,Icef9658c

* changes:
  CommitGraphWriter: fix UnusedException errorprone error
  Update jetty to 10.0.13

23 months agoGraphCommits: Remove unused getter by position 85/197685/2
Ivan Frade [Tue, 6 Dec 2022 23:59:03 +0000 (15:59 -0800)]
GraphCommits: Remove unused getter by position

CommitGraphWriter uses the GraphCommits in for-each loops and doesn't
need the access by position anymore. This was a left-over from
https://git.eclipse.org/r/c/jgit/jgit/+/182832

Remove the unused method.

Change-Id: I39df9bfab2601d581705ddf4cea3c04ed4765ff9

23 months agoCommitGraphWriter: fix UnusedException errorprone error 70/197670/1
Matthias Sohn [Tue, 13 Dec 2022 14:04:45 +0000 (15:04 +0100)]
CommitGraphWriter: fix UnusedException errorprone error

Errorprone run in the bazel build raised this exception:

org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/commitgraph/CommitGraphWriter.java:105:
error: [UnusedException] This catch block catches an exception and
re-throws another, but swallows the caught exception rather than setting
it as a cause. This can make debugging harder.
} catch (InterruptedIOException e) {
  ^
    (see https://errorprone.info/bugpattern/UnusedException)
  Did you mean 'throw new
IOException(JGitText.get().commitGraphWritingCancelled, e);'?

Change-Id: Iad832fe17955fc1e60e6a4902bc50fd9dca76b9d

23 months agoUpdate jetty to 10.0.13 69/197669/1
Matthias Sohn [Tue, 13 Dec 2022 13:40:27 +0000 (14:40 +0100)]
Update jetty to 10.0.13

Since Oomph's p2 repo for jetty 10.0.13 doesn't have source bundles, we
remove them. Eclipse platform doesn't create p2 repos for jetty anymore
and we aren't yet ready to use maven dependencies like the platform
does.

Change-Id: Icef9658ce441be43931e32d931adf717e2fa222c

23 months agoPackExt: Add a commit graph extension. 19/197619/4
Xing Huang [Fri, 9 Dec 2022 22:15:50 +0000 (16:15 -0600)]
PackExt: Add a commit graph extension.

There is no commit graph PackExt because the non-DFS stack is not writing using PackExt mechanism. The extension is needed in DFS to determine the stream to write the commit-graph.

Add a commit graph extension that matches the one in cgit
(https://git-scm.com/docs/commit-graph#_file_layout)
in preparation for adding DFS support for reading and writing commit graphs.

Change-Id: Id14eda9f116a319124981e0bcbc533928b1b5e8c
Signed-off-by: Xing Huang <xingkhuang@google.com>
23 months agoMerge "commitgraph package: fix exports/imports, add @since tag for new API"
Matthias Sohn [Thu, 8 Dec 2022 19:10:23 +0000 (14:10 -0500)]
Merge "commitgraph package: fix exports/imports, add @since tag for new API"

23 months agoBatchRefUpdate: Consistent switch branches in ref update 36/197536/3
Sergey [Wed, 7 Dec 2022 11:49:47 +0000 (15:49 +0400)]
BatchRefUpdate: Consistent switch branches in ref update

The expression RefUpdate ru = newUpdate(cmd) is eagerly evaluated before the switch statement.
But it is not used in some switch cases and thus is calculated uselessly.

Move expression evaluation to the switch case where it is actually used.
After such a move, several cases became identical and thus were squashed.

Change-Id: Ifd1976f1c28378e092fb24d7ca9c415cba49f07f

23 months agoRefWriter#writePackedRefs: Remove a redundant "if" check 67/197567/2
Sergey [Wed, 7 Dec 2022 11:49:47 +0000 (15:49 +0400)]
RefWriter#writePackedRefs: Remove a redundant "if" check

After checking the variable, the same variable was checked again inside
the "if" block, and after the first check, this variable does not
change. Remove the second unnecessary check.

Change-Id: I6a38e67073f7f93105575b8f415ad32d350af602

23 months agocommitgraph package: fix exports/imports, add @since tag for new API 54/197554/1
Matthias Sohn [Thu, 8 Dec 2022 00:16:46 +0000 (01:16 +0100)]
commitgraph package: fix exports/imports, add @since tag for new API

Change-Id: I9175b1d796f91f5ba4e21d3418550ae451c054b0

23 months agoMerge "CommitGraph: implement commit-graph writer"
Ivan Frade [Tue, 6 Dec 2022 17:53:52 +0000 (12:53 -0500)]
Merge "CommitGraph: implement commit-graph writer"

23 months agoCommitGraph: implement commit-graph writer 32/182832/32
kylezhao [Tue, 6 Jul 2021 12:20:14 +0000 (20:20 +0800)]
CommitGraph: implement commit-graph writer

Teach JGit to write a commit-graph formatted file by walking commit
graph from specified commit objects.

See: https://git-scm.com/docs/commit-graph-format/2.21.0

Bug: 574368
Change-Id: I34f9f28f8729080c275f86215ebf30b2d05af41d
Signed-off-by: kylezhao <kylezhao@tencent.com>
23 months ago[releng] bump japicmp base version 28/197428/1
Thomas Wolf [Wed, 30 Nov 2022 23:03:50 +0000 (00:03 +0100)]
[releng] bump japicmp base version

Bump the japicmp base version to 6.4.0.202211300538-r. (Up from 6.2.0.
We forgot to bump in the 6.4.0 release cycle.)

Change-Id: Ied39865563fb57f5ee9059241449e5e101e75d86
Signed-off-by: Thomas Wolf <twolf@apache.org>
23 months agoMerge branch 'stable-6.4' 10/197410/1
Matthias Sohn [Wed, 30 Nov 2022 17:15:52 +0000 (18:15 +0100)]
Merge branch 'stable-6.4'

* stable-6.4:
  Prepare 6.4.1-SNAPSHOT builds
  JGit v6.4.0.202211300538-r
  Fix crashes on rare combination of file names

Change-Id: I9b5c5f408d1d45868c138c15675346a6693ab998

23 months agoPrepare 6.4.1-SNAPSHOT builds 03/197403/1
Matthias Sohn [Wed, 30 Nov 2022 14:41:41 +0000 (15:41 +0100)]
Prepare 6.4.1-SNAPSHOT builds

Change-Id: I860bfde113c05015c41304c4a77c44c224bd0923

23 months agoJGit v6.4.0.202211300538-r 93/197393/1 v6.4.0.202211300538-r
Matthias Sohn [Wed, 30 Nov 2022 10:38:12 +0000 (11:38 +0100)]
JGit v6.4.0.202211300538-r

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

23 months agoFix crashes on rare combination of file names 60/197360/1
Dmitrii Filippov [Mon, 27 Jun 2022 18:03:53 +0000 (20:03 +0200)]
Fix crashes on rare combination of file names

The NameConflictTreeWalk class is used in merge for iterating over
entries in commits. The class uses a separate iterator for each
commit's tree. In rare cases it can incorrectly report the same entry
twice. As a result, duplicated entries are added to the merge result
and later jgit throws an exception when it tries to process merge
result.

The problem appears only when there is a directory-file conflict for
the last item in trees. Example from the bug:
Commit 1:
* subtree - file
* subtree-0 - file
Commit 2:
* subtree - directory
* subtree-0 - file
Here the names are ordered like this:
"subtree" file <"subtree-0" file < "subtree" directory.

The NameConflictTreeWalk handles similar cases correctly if there are
other files after subtree... in commits - this is processed in the
AbstractTreeIterator.min function. Existing code has a special
optimization for the case, when all trees are pointed to the same
entry name - it skips additional checks. However, this optimization
incorrectly skips checks if one of trees reached the end.

The fix processes a situation when some trees reached the end, while
others are still point to an entry.

bug: 535919
Change-Id: I62fde3dd89779fac282479c093400448b4ac5c86

23 months agoMerge "Fix crashes on rare combination of file names"
Han-Wen NIenhuys [Mon, 28 Nov 2022 14:34:46 +0000 (09:34 -0500)]
Merge "Fix crashes on rare combination of file names"

23 months agoPrepare 6.5.0-SNAPSHOT builds 67/197267/1
Matthias Sohn [Wed, 23 Nov 2022 18:09:33 +0000 (19:09 +0100)]
Prepare 6.5.0-SNAPSHOT builds

Change-Id: I4238b6181e96e22e540cf34802a332f868cb6dfb

23 months agoMerge branch 'stable-6.4' 66/197266/1
Matthias Sohn [Wed, 23 Nov 2022 18:08:58 +0000 (19:08 +0100)]
Merge branch 'stable-6.4'

* stable-6.4:
  Prepare 6.4.0-SNAPSHOT build
  JGit v6.4.0.202211231055-rc1

Change-Id: I5bf49cb31d8c401e8f8f12a69d96ac8b42ff3605

23 months agoPrepare 6.4.0-SNAPSHOT build 55/197255/1
Matthias Sohn [Wed, 23 Nov 2022 16:10:33 +0000 (17:10 +0100)]
Prepare 6.4.0-SNAPSHOT build

Change-Id: I41c4f73472bb47d8f9d2d117d17e11bba4802928

23 months agoJGit v6.4.0.202211231055-rc1 53/197253/1 v6.4.0.202211231055-rc1
Matthias Sohn [Wed, 23 Nov 2022 15:56:09 +0000 (16:56 +0100)]
JGit v6.4.0.202211231055-rc1

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

23 months agoMerge branch 'master' into stable-6.4 52/197252/1
Matthias Sohn [Wed, 23 Nov 2022 15:54:34 +0000 (16:54 +0100)]
Merge branch 'master' into stable-6.4

* master:
  [pgm] Add options --name-only, --name-status to diff, log, show
  Update Orbit to R20221123021534 for 2022-12
  RBE: Update toolchain with bazel-toolchains 5.1.2 release
  SshTestGitServer: : ensure UploadPack is closed to fix resource leak
  UploadPackTest: ensure UploadPack is closed to fix resource leak
  [pgm] Ensure UploadPack is closed to fix resource leak
  UploadPackServlet#doPost use try-with-resource to ensure up is closed
  Fix warnings in PatchApplierTest
  Fix boxing warnings in TransportTest
  Silence warnings about unclosed BasePackPushConnection
  Fix warning about non-externalized String
  Remove unused imports
  Suppress non-externalized String warnings
  Remove unused API problem filters
  Silence API errors
  Silence API errors
  Silence API warnings
  Add 4.26 target platform
  Use "releases" repository for 4.25 target platform
  Update Apache Mina SSHD to 2.9.2
  Update Orbit to S20221118032057
  DfsBlockCache: Report IndexEventConsumer metrics for reverse indexes.
  DfsStreamKey: Replace ForReverseIndex to separate metrics.
  RawText.isBinary(): handle complete buffer correctly
  PackExt: Add a reverse index extension.

Change-Id: Ia41a2b0662bdb174e05a1adba6502191ef5ce4c5

23 months ago[pgm] Add options --name-only, --name-status to diff, log, show 16/197116/6
alerthak [Sat, 19 Nov 2022 02:56:02 +0000 (05:56 +0300)]
[pgm] Add options --name-only, --name-status to diff, log, show

Change-Id: Ib218bd2ccbd7990feca4c35d8c8dc34d4a8291e6

23 months agoUpdate Orbit to R20221123021534 for 2022-12 37/197237/1
Matthias Sohn [Wed, 23 Nov 2022 09:32:51 +0000 (10:32 +0100)]
Update Orbit to R20221123021534 for 2022-12

Change-Id: I9de11cc198ce3926d5233c4e30dc74f36674d3b5

2 years agoRBE: Update toolchain with bazel-toolchains 5.1.2 release 77/196877/2
David Ostrovsky [Fri, 11 Nov 2022 10:18:38 +0000 (11:18 +0100)]
RBE: Update toolchain with bazel-toolchains 5.1.2 release

Due to this platform style migration: [1] the RBE toolchain needs to be
updated to use the latest rbe_config_gen from bazel-toolchains (at least
version 5.1.2 so that it contains: [2]).

This change makes RBE build forwards compatible so that Bazel could be
updated to the upcoming major 6.0 release.

[1] https://github.com/bazelbuild/bazel/issues/8622
[2] https://github.com/bazelbuild/bazel-toolchains/commit/8c717f8258cd5f6c7a45b97d974292755852b658

Change-Id: Ia3a108fa05b1d52cd2018ba901ffd4c9e55ae8ab

2 years agoSshTestGitServer: : ensure UploadPack is closed to fix resource leak 54/197154/2
Matthias Sohn [Sun, 20 Nov 2022 20:33:17 +0000 (21:33 +0100)]
SshTestGitServer: : ensure UploadPack is closed to fix resource leak

Change-Id: Ib766f1d56b3ca7940c593ebfe0ac68fc5028a11c

2 years agoUploadPackTest: ensure UploadPack is closed to fix resource leak 53/197153/2
Matthias Sohn [Sun, 20 Nov 2022 20:24:00 +0000 (21:24 +0100)]
UploadPackTest: ensure UploadPack is closed to fix resource leak

Change-Id: I4c8cf6041b4011934d338138d4531d190fdd6abb

2 years ago[pgm] Ensure UploadPack is closed to fix resource leak 52/197152/2
Matthias Sohn [Sun, 20 Nov 2022 20:21:26 +0000 (21:21 +0100)]
[pgm] Ensure UploadPack is closed to fix resource leak

Change-Id: I40da4b331012dd1c6f4b497e46c973fd776b737f

2 years agoUploadPackServlet#doPost use try-with-resource to ensure up is closed 51/197151/2
Matthias Sohn [Sun, 20 Nov 2022 20:13:50 +0000 (21:13 +0100)]
UploadPackServlet#doPost use try-with-resource to ensure up is closed

Change-Id: Iadbf81f183bb94f3b00b9940f065586b13e85c95

2 years agoFix warnings in PatchApplierTest 50/197150/1
Matthias Sohn [Sun, 20 Nov 2022 19:41:20 +0000 (20:41 +0100)]
Fix warnings in PatchApplierTest

- don't use final for method parameters
- fix hiding member warnigns

Change-Id: I73c386f669918d3291ee3380024c018483aa3c97

2 years agoFix boxing warnings in TransportTest 49/197149/1
Matthias Sohn [Sun, 20 Nov 2022 19:34:57 +0000 (20:34 +0100)]
Fix boxing warnings in TransportTest

Change-Id: I7e6dc845b89899cff262fab77c3977dbef5eea02

2 years agoSilence warnings about unclosed BasePackPushConnection 48/197148/1
Matthias Sohn [Sun, 20 Nov 2022 19:32:37 +0000 (20:32 +0100)]
Silence warnings about unclosed BasePackPushConnection

Change-Id: If52e8462e6222dd58d1004dd5ac174a27d96d098

2 years agoFix warning about non-externalized String 47/197147/1
Matthias Sohn [Sun, 20 Nov 2022 19:30:45 +0000 (20:30 +0100)]
Fix warning about non-externalized String

Change-Id: I00b2132eac6d6ad2701d3f8151eb8c80ad6d679d

2 years agoMerge branch 'stable-6.3' 46/197146/1
Matthias Sohn [Sun, 20 Nov 2022 19:24:14 +0000 (20:24 +0100)]
Merge branch 'stable-6.3'

* stable-6.3:
  Remove unused imports
  Suppress non-externalized String warnings
  Remove unused API problem filters
  Silence API errors
  Silence API errors
  Silence API warnings

Change-Id: I6778c8266bc7e918c943dcabf23aa230f4e998d5

2 years agoMerge branch 'stable-6.2' into stable-6.3 43/197143/1
Matthias Sohn [Sun, 20 Nov 2022 19:22:24 +0000 (20:22 +0100)]
Merge branch 'stable-6.2' into stable-6.3

* stable-6.2:
  Remove unused imports
  Suppress non-externalized String warnings
  Remove unused API problem filters
  Silence API errors
  Silence API errors
  Silence API warnings

Change-Id: I71aa9f890c5eb05849ad16a00b9974da5e51171e

2 years agoRemove unused imports 42/197142/1
Matthias Sohn [Sun, 20 Nov 2022 19:18:01 +0000 (20:18 +0100)]
Remove unused imports

Change-Id: I57a3ae0a8608a517d9cc5cc27cee136f9faeb810

2 years agoSuppress non-externalized String warnings 41/197141/1
Matthias Sohn [Sun, 20 Nov 2022 19:16:28 +0000 (20:16 +0100)]
Suppress non-externalized String warnings

Change-Id: I95c61bd906bd3f7cdea9581e0ffa92ec607c6140

2 years agoRemove unused API problem filters 40/197140/1
Matthias Sohn [Sun, 20 Nov 2022 19:14:20 +0000 (20:14 +0100)]
Remove unused API problem filters

Change-Id: I890716bc052dcce2ce136040035b442247c08332

2 years agoMerge branch 'stable-6.1' into stable-6.2 39/197139/1
Matthias Sohn [Sun, 20 Nov 2022 19:10:37 +0000 (20:10 +0100)]
Merge branch 'stable-6.1' into stable-6.2

* stable-6.1:
  Silence API errors
  Silence API errors
  Silence API warnings

Change-Id: Id3efa1b32710661cde63e93c5b8832785a805415

2 years agoSilence API errors 38/197138/1
Matthias Sohn [Sun, 20 Nov 2022 19:09:02 +0000 (20:09 +0100)]
Silence API errors

Change-Id: I07c42fe9417edb0570dd475a7e935112a878a93b

2 years agoMerge branch 'stable-6.0' into stable-6.1 37/197137/1
Matthias Sohn [Sun, 20 Nov 2022 19:08:42 +0000 (20:08 +0100)]
Merge branch 'stable-6.0' into stable-6.1

* stable-6.0:
  Silence API errors
  Silence API warnings

Change-Id: I2b8336652e60dec97666582cf9331c8505729473

2 years agoSilence API errors 36/197136/1
Matthias Sohn [Sun, 20 Nov 2022 18:55:22 +0000 (19:55 +0100)]
Silence API errors

Change-Id: Ie112b2099ea2125bc85863524e56f09ba4907373

2 years agoMerge branch 'stable-5.13' into stable-6.0 35/197135/1
Matthias Sohn [Sun, 20 Nov 2022 18:54:44 +0000 (19:54 +0100)]
Merge branch 'stable-5.13' into stable-6.0

* stable-5.13:
  Silence API warnings

Change-Id: If5ab988a0e177c37b125e0b10625e506eeb2a74f

2 years agoSilence API warnings 34/197134/1
Matthias Sohn [Sun, 20 Nov 2022 18:45:54 +0000 (19:45 +0100)]
Silence API warnings

introduced by
- addition of configurable SHA1 implementation in 5.13.2
- 3-digit @since 5.9.1 annotations on GitServlet methods

Change-Id: If19853fcc5e3677e5b18e8e3fbbcd2773378dffc

2 years agoAdd 4.26 target platform 45/197145/1
Matthias Sohn [Sun, 20 Nov 2022 17:15:21 +0000 (18:15 +0100)]
Add 4.26 target platform

Change-Id: I569d0b432b5da175da091e37feecadc321d686a9

2 years agoUse "releases" repository for 4.25 target platform 44/197144/1
Matthias Sohn [Sun, 20 Nov 2022 17:15:09 +0000 (18:15 +0100)]
Use "releases" repository for 4.25 target platform

Change-Id: Ib8d33714c67de949b9574b4ec29c1ae99f75d419

2 years agoUpdate Apache Mina SSHD to 2.9.2 85/192885/4
Thomas Wolf [Mon, 25 Apr 2022 05:52:25 +0000 (07:52 +0200)]
Update Apache Mina SSHD to 2.9.2

Release notes for 2.9.2:
https://github.com/apache/mina-sshd/blob/master/docs/changes/2.9.2.md

Change-Id: I7809bcba1d45b76ab9dcc031f86beb2f69da3788
Signed-off-by: Thomas Wolf <twolf@apache.org>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2 years agoMerge branch 'stable-6.4' 15/197115/1
Matthias Sohn [Fri, 18 Nov 2022 21:25:56 +0000 (22:25 +0100)]
Merge branch 'stable-6.4'

* stable-6.4:
  Prepare 6.4.0-SNAPSHOT builds
  JGit v6.4.0.202211160543-m3

Change-Id: I6a98ffb40d93422dc128328b8427ea740731b960

2 years agoUpdate Orbit to S20221118032057 14/197114/1
Matthias Sohn [Fri, 18 Nov 2022 21:09:04 +0000 (22:09 +0100)]
Update Orbit to S20221118032057

update
- com.jcraft.jsch to 0.1.55.v20221112-0806
- net.bytebuddy.byte-buddy to 1.12.18.v20221114-2102
- net.bytebuddy.byte-buddy-agent to 1.12.18.v20221114-2102
- org.apache.commons.codec to 1.14.0.v20221112-0806
- org.apache.httpcomponents.httpclient to 4.5.13.v20221112-0806
- org.slf4j.api to 1.7.30.v20221112-0806
- org.slf4j.binding.simple to 1.7.30.v20221112-0806

Change-Id: I4f29994c8a4374f6ace5c640397245c3c2ff4f53

2 years agoDfsBlockCache: Report IndexEventConsumer metrics for reverse indexes. 90/196890/3
Anna Papitto [Thu, 10 Nov 2022 22:49:27 +0000 (14:49 -0800)]
DfsBlockCache: Report IndexEventConsumer metrics for reverse indexes.

IndexEventConsumer metrics are reported per index PackExt and reverse
indexes did not have one, so they were not included.

Now that there is a REVERSE_INDEX PackExt, enable reporting
IndexEventConsumer metrics for reverse indexes.

Change-Id: Ia6a752f6eb8932a5b4ba45cc15cbc7e0786fd247
Signed-off-by: Anna Papitto <annapapitto@google.com>
2 years agoDfsStreamKey: Replace ForReverseIndex to separate metrics. 89/196889/3
Anna Papitto [Fri, 11 Nov 2022 18:44:37 +0000 (10:44 -0800)]
DfsStreamKey: Replace ForReverseIndex to separate metrics.

Keys used for identifying reverse indexes in the DfsBlockCache use a
custom subclass ForReverseIndex because there was no PackExt for them.
This conflates BlockCacheMetrics for reverse indexes with those for
packs, since the key falls back onto 0 when there is no extension.

Replace the custom ForReverseIndex with a DfsStreamKey usage to bring
keys for the new REVERSE_INDEX extension in line with INDEX and BITMAP
and separate reverse index and pack BlockCacheMetrics.

Change-Id: I305e2c16d2a8cb2a824855ea92e0c9a9b188fce5
Signed-off-by: Anna Papitto <annapapitto@google.com>
2 years agoMerge "PackExt: Add a reverse index extension."
Ivan Frade [Thu, 17 Nov 2022 17:38:10 +0000 (12:38 -0500)]
Merge "PackExt: Add a reverse index extension."

2 years agoPrepare 6.4.0-SNAPSHOT builds 66/197066/1
Matthias Sohn [Wed, 16 Nov 2022 23:06:09 +0000 (00:06 +0100)]
Prepare 6.4.0-SNAPSHOT builds

Change-Id: I0e915a1d32ff948e355f17181f4e5ed78ead42db

2 years agoRawText.isBinary(): handle complete buffer correctly 57/196557/2
Thomas Wolf [Mon, 31 Oct 2022 21:44:50 +0000 (22:44 +0100)]
RawText.isBinary(): handle complete buffer correctly

Make sure we always get consistent results, whether or not we have the
full data in the buffer.

Change-Id: Ieb379a0c375ad3dd352e63ac2f23bda6ef16c215
Signed-off-by: Thomas Wolf <twolf@apache.org>
2 years agoJGit v6.4.0.202211160543-m3 12/197012/1 v6.4.0.202211160543-m3
Matthias Sohn [Wed, 16 Nov 2022 10:43:19 +0000 (11:43 +0100)]
JGit v6.4.0.202211160543-m3

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

2 years agoMerge branch 'master' into stable-6.4 11/197011/1
Matthias Sohn [Wed, 16 Nov 2022 10:29:24 +0000 (11:29 +0100)]
Merge branch 'master' into stable-6.4

* master:
  [benchmarks] Remove profiler configuration
  Add SHA1 benchmark
  [benchmarks] Set version of maven-compiler-plugin to 3.8.1
  Fix running JMH benchmarks
  Add option to allow using JDK's SHA1 implementation
  Fix API breakage caused by extracting WorkTreeUpdater
  Update Orbit to S20221109014815
  Use replace instead of replaceAll in toCleanString
  Extract Exception -> HTTP status code mapping for reuse
  Don't handle internal git errors as an HTTP error
  Fix the path for JSchText.properties
  Fix Maven SHA1 for Bazel build
  UploadPack: Receive and parse client session-id
  TransferConfig: Move reading advertisesid setting into TransferConfig
  FirstWant: Parse client session-id if received.
  ReceivePack: Receive and parse client session-id.
  Ignore IllegalStateException if JVM is already shutting down
  Allow to perform PackedBatchRefUpdate without locking loose refs

Change-Id: Ib38376bb8fa4a64af93bf1ffb5883711eaa432d7

2 years agoMerge branch 'stable-6.3' 10/197010/1
Matthias Sohn [Wed, 16 Nov 2022 09:15:30 +0000 (10:15 +0100)]
Merge branch 'stable-6.3'

* stable-6.3:
  [benchmarks] Remove profiler configuration
  Add SHA1 benchmark
  [benchmarks] Set version of maven-compiler-plugin to 3.8.1
  Fix running JMH benchmarks
  Add option to allow using JDK's SHA1 implementation
  Fix API breakage caused by extracting WorkTreeUpdater
  Extract Exception -> HTTP status code mapping for reuse
  Don't handle internal git errors as an HTTP error
  Ignore IllegalStateException if JVM is already shutting down
  Allow to perform PackedBatchRefUpdate without locking loose refs

Change-Id: Ib58879be292c54a2a7f4936ac0986997985c822b

2 years agoMerge branch 'stable-6.2' into stable-6.3 08/197008/1
Matthias Sohn [Wed, 16 Nov 2022 09:14:13 +0000 (10:14 +0100)]
Merge branch 'stable-6.2' into stable-6.3

* stable-6.2:
  Extract Exception -> HTTP status code mapping for reuse
  Don't handle internal git errors as an HTTP error
  Allow to perform PackedBatchRefUpdate without locking loose refs

Change-Id: I562be0802efa231023c5f10e6461339b2d7fbacf

2 years agoMerge branch 'stable-6.1' into stable-6.2 07/197007/1
Matthias Sohn [Wed, 16 Nov 2022 09:13:20 +0000 (10:13 +0100)]
Merge branch 'stable-6.1' into stable-6.2

* stable-6.1:
  Extract Exception -> HTTP status code mapping for reuse
  Don't handle internal git errors as an HTTP error
  Allow to perform PackedBatchRefUpdate without locking loose refs

Change-Id: Icb321779184d20f3871e236fda1a3acba605a6da

2 years agoMerge "Merge branch 'stable-6.0' into stable-6.1" into stable-6.1
Matthias Sohn [Wed, 16 Nov 2022 09:10:43 +0000 (04:10 -0500)]
Merge "Merge branch 'stable-6.0' into stable-6.1" into stable-6.1

2 years agoMerge branch 'stable-6.2' into stable-6.3 04/197004/1
Matthias Sohn [Wed, 16 Nov 2022 08:56:08 +0000 (09:56 +0100)]
Merge branch 'stable-6.2' into stable-6.3

* stable-6.2:
  [benchmarks] Remove profiler configuration
  Add SHA1 benchmark
  [benchmarks] Set version of maven-compiler-plugin to 3.8.1
  Fix running JMH benchmarks
  Add option to allow using JDK's SHA1 implementation
  Ignore IllegalStateException if JVM is already shutting down

Change-Id: I9c1576011c11b4ff8f453d18d9e786cee59860fa

2 years agoMerge branch 'stable-6.1' into stable-6.2 03/197003/1
Matthias Sohn [Wed, 16 Nov 2022 08:55:22 +0000 (09:55 +0100)]
Merge branch 'stable-6.1' into stable-6.2

* stable-6.1:
  [benchmarks] Remove profiler configuration
  Add SHA1 benchmark
  [benchmarks] Set version of maven-compiler-plugin to 3.8.1
  Fix running JMH benchmarks
  Add option to allow using JDK's SHA1 implementation
  Ignore IllegalStateException if JVM is already shutting down

Change-Id: Ie433c46a01a0f33848d54ecf99b30a44ca01e286

2 years agoMerge branch 'stable-6.0' into stable-6.1 02/197002/1
Matthias Sohn [Wed, 16 Nov 2022 08:54:28 +0000 (09:54 +0100)]
Merge branch 'stable-6.0' into stable-6.1

* stable-6.0:
  [benchmarks] Remove profiler configuration
  Add SHA1 benchmark
  [benchmarks] Set version of maven-compiler-plugin to 3.8.1
  Fix running JMH benchmarks
  Add option to allow using JDK's SHA1 implementation
  Ignore IllegalStateException if JVM is already shutting down

Change-Id: I176419026c3f4fdd8ebd34c61468c1ec3482ff45

2 years agoPackExt: Add a reverse index extension. 88/196888/2
Anna Papitto [Thu, 10 Nov 2022 22:45:46 +0000 (14:45 -0800)]
PackExt: Add a reverse index extension.

There is no reverse index PackExt because the reverse index is not currently
written to a file. This prevents fine-grained performance reporting for reverse
indexes, which will be useful when introducing a reverse index file and
observing performance changes.

Add a reverse index extension that matches the one in cgit
(https://github.com/git/git/blob/9bf691b78cf906751e65d65ba0c6ffdcd9a5a12c/Documentation/gitformat-pack.txt#L302)
in preparation for adding a reverse index file while observing
performance before and after.

Change-Id: Iee53f1e01cf645a3c468892fcf97c8444f9a784a
Signed-off-by: Anna Papitto <annapapitto@google.com>
2 years agoMerge branch 'stable-5.13' into stable-6.0 01/197001/1
Matthias Sohn [Tue, 15 Nov 2022 23:15:17 +0000 (00:15 +0100)]
Merge branch 'stable-5.13' into stable-6.0

* stable-5.13:
  [benchmarks] Remove profiler configuration
  Add SHA1 benchmark
  [benchmarks] Set version of maven-compiler-plugin to 3.8.1
  Fix running JMH benchmarks
  Add option to allow using JDK's SHA1 implementation
  Ignore IllegalStateException if JVM is already shutting down

Change-Id: I40105336f0b9e593a8a2c242a9557f854c274fdc

2 years ago[benchmarks] Remove profiler configuration 42/196942/7
Matthias Sohn [Mon, 14 Nov 2022 22:23:55 +0000 (23:23 +0100)]
[benchmarks] Remove profiler configuration

Profiler configuration can be added when required. It was commented out
in most benchmarks.

Change-Id: I725f98757f7d4d2ba2589658e34e2fd6fbbbedee

2 years agoAdd SHA1 benchmark 06/196906/13
Matthias Sohn [Tue, 15 Nov 2022 12:22:12 +0000 (13:22 +0100)]
Add SHA1 benchmark

Results on a Mac M1 max:

    size     SHA1Native SHA1Java    SHA1Java
                        without     with
                        collision   collision
                        detection   detection
    [kB]     [us/op]    [us/op]     [us/op]
---------------------------------------------
      1       3.662       4.200       4.707
      2       7.053       7.868       8.928
      4      13.883      15.149      17.608
      8      27.225      30.049      35.237
     16      54.014      59.655      70.867
     32     106.457     118.022     140.403
     64     212.712     237.702     281.522
   1024    3469.519    3868.883    4637.287
 131072  445011.724  501751.992  604061.308
1048576 3581702.104 4008087.854 4831023.563

The last 3 sizes (1, 128, 1024 MB) weren't committed
here to limit the total runtime.

Bug: 580310
Change-Id: I7d0382fd4aa4c4734806b12e96b671bee37d26e3

2 years ago[benchmarks] Set version of maven-compiler-plugin to 3.8.1 41/196941/6
Matthias Sohn [Mon, 14 Nov 2022 21:25:40 +0000 (22:25 +0100)]
[benchmarks] Set version of maven-compiler-plugin to 3.8.1

Change-Id: Ib14db133c76a55358ea79663ef38d9fb47a67f45

2 years agoFix running JMH benchmarks 25/196225/9
Matthias Sohn [Tue, 4 Oct 2022 13:45:01 +0000 (15:45 +0200)]
Fix running JMH benchmarks

Without this I sometimes hit the error:

$ java -jar target/benchmarks.jar
Exception in thread "main" java.lang.RuntimeException: ERROR: Unable to
find the resource: /META-INF/BenchmarkList
at org.openjdk.jmh.runner.AbstractResourceReader.getReaders(AbstractResourceReader.java:98)
at org.openjdk.jmh.runner.BenchmarkList.find(BenchmarkList.java:124)
at org.openjdk.jmh.runner.Runner.internalRun(Runner.java:253)
at org.openjdk.jmh.runner.Runner.run(Runner.java:209)
at org.openjdk.jmh.Main.main(Main.java:71)

Change-Id: Iea9431d5f332f799d55a8a2d178c79a2ef0da22b

2 years agoAdd option to allow using JDK's SHA1 implementation 05/196905/9
Matthias Sohn [Fri, 11 Nov 2022 16:54:06 +0000 (17:54 +0100)]
Add option to allow using JDK's SHA1 implementation

The change If6da9833 moved the computation of SHA1 from the JVM's
JCE to a pure Java implementation with collision detection.
The extra security for public sites comes with a cost of slower
SHA1 processing compared to the native implementation in the JDK.

When JGit is used internally and not exposed to any traffic from
external or untrusted users, the extra cost of the pure Java SHA1
implementation can be avoided, falling back to the previous
native MessageDigest implementation.

Bug: 580310
Change-Id: Ic24c0ba1cb0fb6282b8ca3025ffbffa84035565e

2 years agoFix API breakage caused by extracting WorkTreeUpdater 10/196910/2
Matthias Sohn [Mon, 14 Nov 2022 09:45:58 +0000 (10:45 +0100)]
Fix API breakage caused by extracting WorkTreeUpdater

448052dc2e made WorkTreeUpdater package visible which breaks API for
subclasses of ResolveMerger since they cannot access WorkTreeUpdater.

Fix this by moving WorkTreeUpdater into ResolveMerger as a nested class
and mark it protected so that subclasses can use it.

Bug: 581049
Change-Id: I5a2c4953f8514dc0a1b8041c8e069d28370bb2eb

2 years agoUpdate Orbit to S20221109014815 20/196920/1
Matthias Sohn [Mon, 14 Nov 2022 13:34:30 +0000 (14:34 +0100)]
Update Orbit to S20221109014815

and update
- com.sun.jna to 5.12.1.v20221103-2317
- com.sun.jna.platform to 5.12.1.v20221103-2317
- org.bouncycastle.bcpg to 1.72.0.v20221013-1810
- org.bouncycastle.bcpkix to 1.72.0.v20221013-1810
- org.bouncycastle.bcprov to 1.72.0.v20221013-1810
- org.bouncycastle.bcutil to 1.72.0.v20221013-1810
- org.mockito.mockito-core to 4.8.1.v20221103-2317
- org.objenesis to 3.3.0.v20221103-2317

Change-Id: If00094d23e51d5f66928f83c1334aa6b18b98dfe

2 years agoUse replace instead of replaceAll in toCleanString 59/196659/2
Eryk Szymanski [Tue, 8 Nov 2022 17:22:50 +0000 (18:22 +0100)]
Use replace instead of replaceAll in toCleanString

This is from SonarLint (rule.java:S4348)
Regex patterns should not be created needlessly:

When String::replaceAll is used, the first argument should be a real
regular expression. If it’s not the case, String::replace does exactly
the same thing as String::replaceAll without the performance drawback of
the regex.

Change-Id: I00ba967ff4a27eeeb6fccf9373f6df2c94ecd823

2 years agoExtract Exception -> HTTP status code mapping for reuse 52/196852/3
Sven Selberg [Wed, 9 Nov 2022 17:28:45 +0000 (18:28 +0100)]
Extract Exception -> HTTP status code mapping for reuse

Extract private static method UploadPackServlet#statusCodeForThrowable
to a public static method in the UploadPackErrorHandler interface so
that implementers of this interface can reuse the default mapping.

Change-Id: Ie4a0a006b0148d5b828d610c55d19ce407aab055

2 years agoDon't handle internal git errors as an HTTP error 49/196849/4
Sven Selberg [Wed, 9 Nov 2022 15:58:17 +0000 (16:58 +0100)]
Don't handle internal git errors as an HTTP error

The fix that fixed the propagation of error-codes:
  8984e1f66 HTTP Smart: set correct HTTP status on error [1]
made some faulty assumptions.

"Wants not valid", can be an intermittent git error and the HTTP
response should be 200 and not 400 since the request isn't necessary
faulty.

[1] https://git.eclipse.org/r/c/jgit/jgit/+/192677

Bug: 579676
Change-Id: I461bc78ff6e450636811ece50d21c57a2a7f2ae3

2 years agoFix the path for JSchText.properties 58/196558/2
Sebastian Schuberth [Wed, 26 Oct 2022 20:28:46 +0000 (22:28 +0200)]
Fix the path for JSchText.properties

The paths needs to include "ssh" to match the class's package name. This
resolves

Caused by: TransportException: ssh://git@git.xx.com/xx/xx.git: remote hung up unexpectedly
    Caused by: TranslationBundleLoadingException: Loading of translation bundle failed for [org.eclipse.jgit.internal.transport.ssh.jsch.JSchText, en_US]
        Caused by: MissingResourceException: Can't find bundle for base name org.eclipse.jgit.internal.transport.ssh.jsch.JSchText, locale en_US

Also see [1] for reference.

[1]: https://github.com/oss-review-toolkit/ort/issues/5894#issuecomment-1292100687

Change-Id: Ie27b9fc1cdd1d83f8123821be42e65da59ecf49d
Signed-off-by: Sebastian Schuberth <opensource@schuberth.dev>
2 years agoMerge "UploadPack: Receive and parse client session-id"
Ivan Frade [Fri, 4 Nov 2022 21:56:15 +0000 (17:56 -0400)]
Merge "UploadPack: Receive and parse client session-id"

2 years agoMerge "TransferConfig: Move reading advertisesid setting into TransferConfig"
Ivan Frade [Thu, 3 Nov 2022 20:24:26 +0000 (16:24 -0400)]
Merge "TransferConfig: Move reading advertisesid setting into TransferConfig"

2 years agoMerge "FirstWant: Parse client session-id if received."
Ivan Frade [Thu, 3 Nov 2022 20:23:34 +0000 (16:23 -0400)]
Merge "FirstWant: Parse client session-id if received."

2 years agoFix crashes on rare combination of file names 11/194411/31
Dmitrii Filippov [Mon, 27 Jun 2022 18:03:53 +0000 (20:03 +0200)]
Fix crashes on rare combination of file names

The NameConflictTreeWalk class is used in merge for iterating over
entries in commits. The class uses a separate iterator for each
commit's tree. In rare cases it can incorrectly report the same entry
twice. As a result, duplicated entries are added to the merge result
and later jgit throws an exception when it tries to process merge
result.

The problem appears only when there is a directory-file conflict for
the last item in trees. Example from the bug:
Commit 1:
* subtree - file
* subtree-0 - file
Commit 2:
* subtree - directory
* subtree-0 - file
Here the names are ordered like this:
"subtree" file <"subtree-0" file < "subtree" directory.

The NameConflictTreeWalk handles similar cases correctly if there are
other files after subtree... in commits - this is processed in the
AbstractTreeIterator.min function. Existing code has a special
optimization for the case, when all trees are pointed to the same
entry name - it skips additional checks. However, this optimization
incorrectly skips checks if one of trees reached the end.

The fix processes a situation when some trees reached the end, while
others are still point to an entry.

bug: 535919
Change-Id: I62fde3dd89779fac282479c093400448b4ac5c86

2 years agoFix Maven SHA1 for Bazel build 95/196595/4
Patrick Hiesel [Thu, 3 Nov 2022 11:59:37 +0000 (12:59 +0100)]
Fix Maven SHA1 for Bazel build

The httpcore SHA was wrong resulting in a build breakage.

With this change, `bazelisk build all` succeeds.

Change-Id: I111ab450db2db2328e7d4fe849e29f55e4897543

2 years agoUploadPack: Receive and parse client session-id 97/196497/12
Josh Brown [Tue, 1 Nov 2022 20:51:48 +0000 (20:51 +0000)]
UploadPack: Receive and parse client session-id

Before this change JGit did not support the session-id capability
implemented by native Git in UploadPack. This change implements
advertising the capability from the server and parsing the session-id
received from the client during an UploadPack operation.

Enable the transfer.advertisesid config setting to advertise the
capability from the server. The client may send a session-id capability
in response. If received, the value from this is parsed and available
via the getClientSID method on the UploadPack object.

This change does not add the capability to send a session-id from the
JGit client.

https://git-scm.com/docs/gitprotocol-capabilities#_session_idsession_id

Change-Id: Ib1b6929ff1b3a4528e767925b5e5c44b5d18182f
Signed-off-by: Josh Brown <sjoshbrown@google.com>