]> source.dussan.org Git - jgit.git/log
jgit.git
20 months agoMerge branch 'stable-6.3' into stable-6.4 87/199687/1
Matthias Sohn [Wed, 1 Feb 2023 00:12:06 +0000 (01:12 +0100)]
Merge branch 'stable-6.3' into stable-6.4

* stable-6.3:
  Shortcut during git fetch for avoiding looping through all local refs
  FetchCommand: fix fetchSubmodules to work on a Ref to a blob
  Silence API warnings introduced by I466dcde6
  Allow the exclusions of refs prefixes from bitmap
  PackWriterBitmapPreparer: do not include annotated tags in bitmap
  BatchingProgressMonitor: avoid int overflow when computing percentage
  Speedup GC listing objects referenced from reflogs
  FileSnapshotTest: Add more MISSING_FILE coverage

Change-Id: Iefcf5d832bd0087c1027876f2200689e1150abce

20 months agoMerge branch 'stable-6.2' into stable-6.3 86/199686/1
Matthias Sohn [Tue, 31 Jan 2023 23:59:32 +0000 (00:59 +0100)]
Merge branch 'stable-6.2' into stable-6.3

* stable-6.2:
  Shortcut during git fetch for avoiding looping through all local refs
  FetchCommand: fix fetchSubmodules to work on a Ref to a blob
  Silence API warnings introduced by I466dcde6
  Allow the exclusions of refs prefixes from bitmap
  PackWriterBitmapPreparer: do not include annotated tags in bitmap
  BatchingProgressMonitor: avoid int overflow when computing percentage
  Speedup GC listing objects referenced from reflogs
  FileSnapshotTest: Add more MISSING_FILE coverage

Change-Id: I2ff386d9a096277360e6c7bd5535b49984620fb3

20 months agoMerge branch 'stable-6.1' into stable-6.2 85/199685/1
Matthias Sohn [Tue, 31 Jan 2023 23:44:41 +0000 (00:44 +0100)]
Merge branch 'stable-6.1' into stable-6.2

* stable-6.1:
  Shortcut during git fetch for avoiding looping through all local refs
  FetchCommand: fix fetchSubmodules to work on a Ref to a blob
  Silence API warnings introduced by I466dcde6
  Allow the exclusions of refs prefixes from bitmap
  PackWriterBitmapPreparer: do not include annotated tags in bitmap
  BatchingProgressMonitor: avoid int overflow when computing percentage
  Speedup GC listing objects referenced from reflogs
  FileSnapshotTest: Add more MISSING_FILE coverage

Change-Id: Iff2fba026b49463016015b2fae1a42cf76ee2dbb

20 months agoMerge branch 'stable-6.0' into stable-6.1 84/199684/1
Matthias Sohn [Tue, 31 Jan 2023 23:38:52 +0000 (00:38 +0100)]
Merge branch 'stable-6.0' into stable-6.1

* stable-6.0:
  Shortcut during git fetch for avoiding looping through all local refs
  FetchCommand: fix fetchSubmodules to work on a Ref to a blob
  Silence API warnings introduced by I466dcde6
  Allow the exclusions of refs prefixes from bitmap
  PackWriterBitmapPreparer: do not include annotated tags in bitmap
  BatchingProgressMonitor: avoid int overflow when computing percentage
  Speedup GC listing objects referenced from reflogs
  FileSnapshotTest: Add more MISSING_FILE coverage

Change-Id: Ib5055f2f3b8a313c178d6f6c7c5630285ad5a726

20 months agoMerge branch 'stable-5.13' into stable-6.0 83/199683/1
Matthias Sohn [Tue, 31 Jan 2023 23:30:52 +0000 (00:30 +0100)]
Merge branch 'stable-5.13' into stable-6.0

* stable-5.13:
  Shortcut during git fetch for avoiding looping through all local refs
  FetchCommand: fix fetchSubmodules to work on a Ref to a blob
  Silence API warnings introduced by I466dcde6
  Allow the exclusions of refs prefixes from bitmap
  PackWriterBitmapPreparer: do not include annotated tags in bitmap
  BatchingProgressMonitor: avoid int overflow when computing percentage
  Speedup GC listing objects referenced from reflogs
  FileSnapshotTest: Add more MISSING_FILE coverage

Change-Id: I58ad4c210a5e7e5a1ba6b22315b04211c8909950

20 months agoShortcut during git fetch for avoiding looping through all local refs 64/193464/12
Luca Milanesio [Wed, 18 May 2022 12:31:30 +0000 (13:31 +0100)]
Shortcut during git fetch for avoiding looping through all local refs

The FetchProcess needs to verify that all the refs received point
to objects that are reachable from the local refs, which could be
very expensive but is needed to avoid missing objects exceptions
because of broken chains.

When the local repository has a lot of refs (e.g. millions) and the
client is fetching a non-commit object (e.g. refs/sequences/changes in
Gerrit) the reachability check on all local refs can be very expensive
compared to the time to fetch the remote ref.

Example for a 2M refs repository:
- fetching a single non-commit object: 50ms
- checking the reachability of local refs: 30s

A ref pointing to a non-commit object doesn't have any parent or
successor objects, hence would never need to have a reachability check
done. Skipping the askForIsComplete() altogether would save the 30s
time spent in an unnecessary phase.

Signed-off-by: Luca Milanesio <luca.milanesio@gmail.com>
Change-Id: I09ac66ded45cede199ba30f9e71cc1055f00941b

20 months agoFetchCommand: fix fetchSubmodules to work on a Ref to a blob 23/196223/2
Matthias Sohn [Tue, 4 Oct 2022 13:42:25 +0000 (15:42 +0200)]
FetchCommand: fix fetchSubmodules to work on a Ref to a blob

FetchCommand#fetchSubmodules assumed that FETCH_HEAD can always be
parsed as a tree. This isn't true if it refers to a Ref referring to a
BLOB. This is e.g. used in Gerrit for Refs like refs/sequences/changes
which are used to implement sequences stored in git.

Change-Id: I414f5b7d9f2184b2d7d53af1dfcd68cccb725ca4

20 months agoSilence API warnings introduced by I466dcde6 80/199680/1
Matthias Sohn [Tue, 31 Jan 2023 22:45:07 +0000 (23:45 +0100)]
Silence API warnings introduced by I466dcde6

Change-Id: I510510da34d33757c2f83af8cd1e26f6206a486a

20 months agoAllow the exclusions of refs prefixes from bitmap 76/197776/28
Luca Milanesio [Tue, 20 Dec 2022 21:50:19 +0000 (21:50 +0000)]
Allow the exclusions of refs prefixes from bitmap

When running a GC.repack() against a repository with over one
thousands of refs/heads and tens of millions of ObjectIds,
the calculation of all bitmaps associated with all the refs
would result in an unreasonable big file that would take up to
several hours to compute.

Test scenario: repo with 2500 heads / 10M obj Intel Xeon E5-2680 2.5GHz
Before this change: 20 mins
After this change and 2300 heads excluded: 10 mins (90s for bitmap)

Having such a large bitmap file is also slow in the runtime
processing and have negligible or even negative benefits, because
the time lost in reading and decompressing the bitmap in memory
would not be compensated by the time saved by using it.

It is key to preserve the bitmaps for those refs that are mostly
used in clone/fetch and give the ability to exlude some refs
prefixes that are known to be less frequently accessed, even
though they may actually be actively written.

Example: Gerrit sandbox branches may even be actively
used and selected automatically because its commits are very
recent, however, they may bloat the bitmap, making it ineffective.

A mono-repo with tens of thousands of developers may have
a relatively small number of active branches where the
CI/CD jobs are continuously fetching/cloning the code. However,
because Gerrit allows the use of sandbox branches, the
total number of refs/heads may be even tens to hundred
thousands.

Change-Id: I466dcde69fa008e7f7785735c977f6e150e3b644
Signed-off-by: Luca Milanesio <luca.milanesio@gmail.com>
20 months agoPackWriterBitmapPreparer: do not include annotated tags in bitmap 51/197851/16
Luca Milanesio [Wed, 28 Dec 2022 01:09:52 +0000 (01:09 +0000)]
PackWriterBitmapPreparer: do not include annotated tags in bitmap

The annotated tags should be excluded from the bitmap associated
with the heads-only packfile. However, this was not happening
because of the check of exclusion of the peeled object instead
of the objectId to be excluded from the bitmap.

Sample use-case:

refs/heads/main
  ^
  |
 commit1 <-- commit2 <- annotated-tag1 <- tag1
  ^
  |
 commit0

When creating a bitmap for the above commit graph, before this
change all the commits are included (3 bitmaps), which is
incorrect, because all commits reachable from annotated tags
should not be included.

The heads-only bitmap should include only commit0 and commit1
but because PackWriterBitPreparer was checking for the peeled
pointer of tag1 to be excluded (commit2) which was not found in
the list of tags to exclude (annotated-tag1), the commit2 was
included, even if it wasn't reachable only from the head.

Add an additional check for exclusion of the original objectId
for allowing the exclusion of annotated tags and their pointed
commits. Add one specific test associated with an annotated tag
for making sure that this use-case is covered also.

Example repository benchmark for measuring the improvement:
# refs: 400k (2k heads, 88k tags, 310k changes)
# objects: 11M (88k of them are annotate tags)
# packfiles: 2.7G

Before this change:
GC time: 5h
clone --bare time: 7 mins

After this change:
GC time: 20 mins
clone --bare time: 3 mins

Bug: 581267
Signed-off-by: Luca Milanesio <luca.milanesio@gmail.com>
Change-Id: Iff2bfc6587153001837220189a120ead9ac649dc

20 months agoBatchingProgressMonitor: avoid int overflow when computing percentage 35/199435/4
Matthias Sohn [Mon, 16 Jan 2023 20:58:56 +0000 (21:58 +0100)]
BatchingProgressMonitor: avoid int overflow when computing percentage

When cloning huge repositories I observed percentage of object counts
turning negative. This happened if lastWork * 100 exceeded
Integer.MAX_VALUE.

Change-Id: Ic5f5cf5a911a91338267aace4daba4b873ab3900

20 months agoSpeedup GC listing objects referenced from reflogs 68/199468/3
Matthias Sohn [Wed, 18 Jan 2023 16:39:19 +0000 (17:39 +0100)]
Speedup GC listing objects referenced from reflogs

GC needs to get a ReflogReader for all existing refs to list all objects
referenced from reflogs. The existing Repository#getReflogReader method
accepts the ref name and then resolves the Ref to create a ReflogReader.
GC calling that for a huge number of Refs one by one is very slow. GC
first gets all Refs in bulk and then calls getReflogReader for each of
them.

Fix this by adding another getReflogReader method to Repository which
accepts a Ref directly.

This speeds up running JGit gc on a mirror clone of the Gerrit
repository from 15:36 min to 1:08 min. The repository used in this test
had 45k refs, 275k commits and 1.2m git objects.

Change-Id: I474897fdc6652923e35d461c065a29f54d9949f4

21 months agoMerge branch 'stable-6.3' into stable-6.4 04/199404/1
Matthias Sohn [Fri, 13 Jan 2023 18:32:56 +0000 (19:32 +0100)]
Merge branch 'stable-6.3' into stable-6.4

* stable-6.3:
  Cache trustFolderStat/trustPackedRefsStat value per-instance
  Refresh 'objects' dir and retry if a loose object is not found

Change-Id: I1db2b51ae8101f345d08235d4f3dc416bfcb42d5

21 months agoMerge branch 'stable-6.2' into stable-6.3 03/199403/1
Matthias Sohn [Fri, 13 Jan 2023 18:32:06 +0000 (19:32 +0100)]
Merge branch 'stable-6.2' into stable-6.3

* stable-6.2:
  Cache trustFolderStat/trustPackedRefsStat value per-instance
  Refresh 'objects' dir and retry if a loose object is not found

Change-Id: Ibc9bffab8c9ef9c39384b53c142d99878f7f3f98

21 months agoMerge branch 'stable-6.1' into stable-6.2 02/199402/1
Matthias Sohn [Fri, 13 Jan 2023 18:31:18 +0000 (19:31 +0100)]
Merge branch 'stable-6.1' into stable-6.2

* stable-6.1:
  Cache trustFolderStat/trustPackedRefsStat value per-instance
  Refresh 'objects' dir and retry if a loose object is not found

Change-Id: I9e876f72f735f58bf02c7862a3d8e657fc46a7b9

21 months agoCache trustFolderStat/trustPackedRefsStat value per-instance 25/199325/3
Nasser Grainawi [Tue, 10 Jan 2023 23:15:42 +0000 (16:15 -0700)]
Cache trustFolderStat/trustPackedRefsStat value per-instance

Instead of re-reading the config every time the methods using these
values were called, cache the config value at the time of instance
construction. Caching the values improves performance for each of the
method calls. These configs are set based on the filesystem storing the
repository and unlikely to change while an application is running.

Change-Id: I1cae26dad672dd28b766ac532a871671475652df
Signed-off-by: Nasser Grainawi <quic_nasserg@quicinc.com>
21 months agoRefresh 'objects' dir and retry if a loose object is not found 14/197714/6
Kaushik Lingarkar [Thu, 12 Jan 2023 05:25:30 +0000 (21:25 -0800)]
Refresh 'objects' dir and retry if a loose object is not found

A new loose object may not be immediately visible on a NFS
client if it was created on another client. Refreshing the
'objects' dir and trying again can help work around the NFS
behavior.

Here's an E2E problem that this change can help fix. Consider
a Gerrit multi-primary setup with repositories based on NFS.
Add a new patch-set to an existing change and then immediately
fetch the new patch-set of that change. If the fetch is handled
by a Gerrit primary different that the one which created the
patch-set, then we sometimes run into a MissingObjectException
that causes the fetch to fail.

Bug: 581317
Change-Id: Iccc6676c68ef13a1e8b2ff52b3eeca790a89a13d
Signed-off-by: Kaushik Lingarkar <quic_kaushikl@quicinc.com>
21 months agoFileSnapshotTest: Add more MISSING_FILE coverage 72/199272/1
Nasser Grainawi [Fri, 6 Jan 2023 21:14:48 +0000 (14:14 -0700)]
FileSnapshotTest: Add more MISSING_FILE coverage

Add a couple tests that confirm what the docs say about isModified() and
equals(MISSING_FILE) behavior.

Change-Id: I6093040ba3594934c3270331405a44b2634b97c5
Signed-off-by: Nasser Grainawi <quic_nasserg@quicinc.com>
21 months agoMerge branch 'stable-6.3' into stable-6.4 51/199251/1
Matthias Sohn [Thu, 5 Jan 2023 15:06:17 +0000 (16:06 +0100)]
Merge branch 'stable-6.3' into stable-6.4

* stable-6.3:
  Introduce core.trustPackedRefsStat config
  Fix documentation for core.trustFolderStat

Change-Id: I18d9fc89c9ac1ef069dcefa7d7f992a28539ccf3

21 months agoMerge branch 'stable-6.2' into stable-6.3 50/199250/1
Matthias Sohn [Thu, 5 Jan 2023 14:56:42 +0000 (15:56 +0100)]
Merge branch 'stable-6.2' into stable-6.3

* stable-6.2:
  Introduce core.trustPackedRefsStat config
  Fix documentation for core.trustFolderStat

Change-Id: I48b6c095ac62dc859829d6fef45325accbb0a144

21 months agoMerge branch 'stable-6.1' into stable-6.2 49/199249/1
Matthias Sohn [Thu, 5 Jan 2023 14:53:34 +0000 (15:53 +0100)]
Merge branch 'stable-6.1' into stable-6.2

* stable-6.1:
  Introduce core.trustPackedRefsStat config
  Fix documentation for core.trustFolderStat

Change-Id: Ic78630f74c72624932a384eed52ef79ae1eff3e5

21 months agoIntroduce core.trustPackedRefsStat config 26/197526/7
Kaushik Lingarkar [Fri, 2 Dec 2022 21:21:02 +0000 (13:21 -0800)]
Introduce core.trustPackedRefsStat config

Currently, we always read packed-refs file when 'trustFolderStat'
is false. Introduce a new config 'trustPackedRefsStat' which takes
precedence over 'trustFolderStat' when reading packed refs. Possible
values for this new config are:

* always: Trust packed-refs file attributes
* after_open: Same as 'always', but refresh the file attributes of
              packed-refs before trusting it
* never: Always read the packed-refs file
* unset: Fallback to 'trustFolderStat' to determine if the file
  attributes of packed-refs can be trusted

Folks whose repositories are on NFS and have traditionally been
setting 'trustFolderStat=false' can now get some performance improvement
with 'trustPackedRefsStat=after_open' as it refreshes the file
attributes of packed-refs (at least on some NFS clients) before
considering it.

For example, consider a repository on NFS with ~500k packed-refs. Here
are some stats which illustrate the improvement with this new config
when reading packed refs on NFS:

trustFolderStat=true trustPackedRefsStat=unset: 0.2ms
trustFolderStat=false trustPackedRefsStat=unset: 155ms
trustFolderStat=false trustPackedRefsStat=after_open: 1.5ms

Change-Id: I00da88e4cceebbcf3475be0fc0011ff65767c111
Signed-off-by: Kaushik Lingarkar <quic_kaushikl@quicinc.com>
22 months agoFix documentation for core.trustFolderStat 92/197492/5
Kaushik Lingarkar [Mon, 5 Dec 2022 22:58:00 +0000 (14:58 -0800)]
Fix documentation for core.trustFolderStat

Update documentation for core.trustFolderStat to highlight that it is
also used when reading the packed-refs file.

Change-Id: I3eac377c3a7f48493abc8ae6d0889ee70a05d24d
Signed-off-by: Kaushik Lingarkar <quic_kaushikl@quicinc.com>
22 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

22 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

22 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

22 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

22 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

22 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

22 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

22 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

22 months 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

22 months 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

22 months 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

22 months 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

22 months 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

22 months 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

22 months 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

22 months 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

22 months 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

22 months 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

22 months 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

22 months 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

22 months 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

22 months 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

22 months 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

22 months 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

22 months 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

22 months 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

22 months 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

22 months 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

22 months 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

22 months 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

22 months 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>
22 months 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

22 months 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

22 months 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>
22 months 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>
22 months 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."

22 months 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

23 months 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>
23 months 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

23 months 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

23 months 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

23 months 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

23 months 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

23 months 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

23 months 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

23 months 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

23 months 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

23 months 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>
23 months 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

23 months 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

23 months 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

23 months 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

23 months 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

23 months 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

23 months 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

23 months 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

23 months 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

23 months 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

23 months 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

23 months 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>
23 months 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"

23 months 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"

23 months 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."

23 months 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

23 months 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>
23 months agoTransferConfig: Move reading advertisesid setting into TransferConfig 66/196566/6
Josh Brown [Tue, 1 Nov 2022 19:00:07 +0000 (19:00 +0000)]
TransferConfig: Move reading advertisesid setting into TransferConfig

The config setting to enable advertising the session-id capability is
currently read in the ReceivePack class. This change moves it to a
common location in the TransferConfig class so that it can be reused
in other places like UploadPack. TransferConfig is also a more logical
place for the setting as it resides in the `transfer` config section.

Set the transfer.advertisesid setting to true to send the session-id
capability to the client.

Change-Id: If68ecb5e68b59f5c452a7992d02e3688b0a86747
Signed-off-by: Josh Brown <sjoshbrown@google.com>
23 months agoFirstWant: Parse client session-id if received. 65/196565/7
Josh Brown [Tue, 1 Nov 2022 18:16:44 +0000 (18:16 +0000)]
FirstWant: Parse client session-id if received.

In protocol V0 the client capabilities are appended to the first line.
Parsing session-id is currently only supported during a ReceivePack
operation. This change will parse the client session-id capability if
it has been sent by the client.

If the server sends the session-id capability to the client. The client
may respond with a session ID of its own. FirstWant.fromLine will now
parse the ID and make it available via the getClientSID method.

This change does not add support to send the session-id capability from
the server. The change is necessary to support session-id in UploadPack.

Change-Id: Id3fe44fdf9a72984ee3de9cf40cc4e71d434df4a
Signed-off-by: Josh Brown <sjoshbrown@google.com>
23 months agoMerge branch 'stable-6.4' 46/196546/1
Matthias Sohn [Thu, 27 Oct 2022 21:42:01 +0000 (23:42 +0200)]
Merge branch 'stable-6.4'

* stable-6.4:
  Prepare 6.4.0-SNAPSHOT builds
  JGit v6.4.0.202210260700-m2

Change-Id: I3839c8b57912f7678e1a9f9f06349bee321ff175

23 months agoReceivePack: Receive and parse client session-id. 23/196323/14
Josh Brown [Tue, 11 Oct 2022 21:56:09 +0000 (14:56 -0700)]
ReceivePack: Receive and parse client session-id.

Before this change JGit did not support the session-id capability
implemented by native Git. This change implements advertising the
capability from the server and parsing the session-id received from
the client during a ReceivePack 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 ReceivePack object. All capabilities
in the form `capability=value` are now split into key value pairs at the
first `=` character. This change replaces specific handling for the
agent capability.

This change does not add advertisement or parsing to UploadPack. This
change also does not add the ability to send a session ID from the JGit
client.

https://git-scm.com/docs/protocol-v2/2.33.0#_session_idsession_id

Change-Id: I56fb115e843b11b27e128c4ac427b05d5ec129d0
Signed-off-by: Josh Brown <sjoshbrown@google.com>
23 months agoIgnore IllegalStateException if JVM is already shutting down 40/196540/1
Matthias Sohn [Thu, 27 Oct 2022 18:31:31 +0000 (20:31 +0200)]
Ignore IllegalStateException if JVM is already shutting down

Trying to register/unregister a shutdown hook when the JVM is already in
shutdown throws an IllegalStateException. Ignore this exception since we
can't do anything about it.

Bug: 580953
Change-Id: I8fc6fdd5585837c81ad0ebd6944430856556d90e

23 months agoPrepare 6.4.0-SNAPSHOT builds 17/196517/1
Matthias Sohn [Wed, 26 Oct 2022 15:42:04 +0000 (17:42 +0200)]
Prepare 6.4.0-SNAPSHOT builds

Change-Id: If4da93f775bcbe923e400ebb9315a34485646b40

23 months agoAllow to perform PackedBatchRefUpdate without locking loose refs 10/196510/3
Saša Živkov [Fri, 21 Oct 2022 14:32:03 +0000 (16:32 +0200)]
Allow to perform PackedBatchRefUpdate without locking loose refs

Add another newBatchUpdate method in the RefDirectory where we can
control if the created PackedBatchRefUpdate will lock the loose refs or
not.

This can be useful in cases when we run programs which have exclusive
access to a Git repository and we know that locking loose refs is
unnecessary and just a performance loss.

Change-Id: I7d0932eb1598a3871a2281b1a049021380234df9

23 months agoJGit v6.4.0.202210260700-m2 09/196509/1 v6.4.0.202210260700-m2
Matthias Sohn [Wed, 26 Oct 2022 11:01:14 +0000 (13:01 +0200)]
JGit v6.4.0.202210260700-m2

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

23 months agoPushCommand: allow users to disable use of bitmaps for push 05/194705/3
kylezhao [Thu, 14 Jul 2022 03:23:03 +0000 (11:23 +0800)]
PushCommand: allow users to disable use of bitmaps for push

Reachability bitmaps are designed to speed up the "counting objects"
phase of generating a pack during a clone or fetch. They are not
optimized for Git clients sending a small topic branch via "git push".
In some cases (see [1]), using reachability bitmaps during "git push"
can cause significant performance regressions.

Add PushCommand#setUseBitmaps(boolean) to allow users to tell "git push"
not to use bitmaps.

[1]: https://lore.kernel.org/git/87zhoz8b9o.fsf@evledraar.gmail.com/

Change-Id: I7fb7d26084ec63ddfa7249cf58abb85929b30e56
Signed-off-by: kylezhao <kylezhao@tencent.com>
23 months agoI/O redirection for the pre-push hook 52/196452/2
Thomas Wolf [Thu, 20 Oct 2022 21:25:38 +0000 (23:25 +0200)]
I/O redirection for the pre-push hook

Fix and complete the implementation of calling the pre-push hook.
Add the missing error stream redirect, and add the missing setters
in Transport and in PushCommand. In Transport, delay setting up a
PrePushHook such that it happens only on a push. Previously, the
hook was set up also for fetches.

Bug: 549246
Change-Id: I64a576dfc6b139426f05d9ea6654027ab805734e
Signed-off-by: Thomas Wolf <twolf@apache.org>
23 months agoPackParser: populate full size of the PackedObjectInfos 82/191082/7
Ivan Frade [Thu, 16 Dec 2021 21:08:33 +0000 (13:08 -0800)]
PackParser: populate full size of the PackedObjectInfos

We need the full size of the objects to populate the object-size index
of a pack. This size is not always the one encoded in the object header
in the pack (e.g. for deltas).

Populate the full size of PackedObjectInfos in the PackParser, which is
invoked when receiving a pack e.g. in a push.

Change-Id: I102c20901aefb5e85047e2e526c0d733f82ff74b

23 months agoPackedObjectInfo: add the full size to the description 81/191081/7
Ivan Frade [Wed, 15 Dec 2021 00:24:26 +0000 (16:24 -0800)]
PackedObjectInfo: add the full size to the description

So we can create a size index later.

Change-Id: I9db47ced929fbf045fc37bead6449bbf5484d308