Commit Graph

9748 Commits

Author SHA1 Message Date
Ivan Frade 13c8dacae5 CommitGraphWriter: throw exception on unknown chunk
CommitGraphWriter first defines the chunks and then writes them. If at
write time a chunk is unknown, it is ignored. This is brittle: if
somebody adds a chunk to the header but not to the actual writing, the
commit-graph is broken and there is no error reported anywhere.

Throw exception if at write time a chunk is unknown. This can only
happen by a coding error in the writer.

Change-Id: Iade677bb6ce368b6941b75a21c622917afa3b751
2023-09-01 11:39:40 -07:00
Matthias Sohn fb51a2234b Document commit-graph options supported by JGit
Change-Id: I0ab1b826232bbfcf28518d7a01ae5c5d82a08e04
2023-09-01 10:43:21 +02:00
Matthias Sohn a40abb0a19 Fix warning raised for local variable hiding DfsPackFile#index
Change-Id: I45cd3be942f798d51af1e024ceb3f4d26c7af324
2023-08-31 15:13:34 +02:00
Matthias Sohn 4f3db912ce Suppress boxing warnings in DfsPackFile
Change-Id: I4b5a0a7ffdeaf7d7839787aa8b98ea9c72f70850
2023-08-31 15:11:50 +02:00
Matthias Sohn 807cf678a0 Remove unused API problem filters
Change-Id: I96b73a948794ab5aaadaa558ae75b512f54d64fe
2023-08-31 14:46:38 +02:00
Matthias Sohn 02b45a844c Suppress boxing warnings in tests
Change-Id: I56731862b0955286f86b1c0699d75313eb192fdf
2023-08-31 14:45:36 +02:00
Matthias Sohn 35b5344c9e Fix warning about empty block
Change-Id: I569fb9bf39e851bca451e5a35539589766ba5c05
2023-08-31 14:43:28 +02:00
Matthias Sohn e51a0e51e5 Update mockito to 5.5.0
Change-Id: Ic62864aaf15388b8f20b2db8aa65d1dcf03465a6
2023-08-31 12:08:36 +02:00
Matthias Sohn 24c5d0120b Update byte-buddy to 1.14.7
Change-Id: Iee257eef4cdc3235db6172e19d8d271ff9988fa4
2023-08-31 10:56:32 +02:00
Matthias Sohn c5d8936c80 Prepare 6.7.0-SNAPSHOT builds
Change-Id: I49751232464e70b7d1dc3292a9f36b7a7015e44f
2023-08-30 17:46:26 +02:00
Matthias Sohn c54acc5822 JGit v6.7.0.202308301100-rc1
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Change-Id: I712a9f6830364ed404d03f3a145c055906273544
2023-08-30 16:57:25 +02:00
Matthias Sohn 2e2e58d59f Merge branch 'master' into stable-6.7
* master:
  Remove the cbi-snapshots Maven repository
  Update Orbit to orbit-aggregation/release/4.29.0
  Add target platform for Eclipse 2023-09 (4.29)
  Use release p2 repo for Eclipse 2023-06 (4.28)
  Update tycho to 4.0.2
  Update jmh to 1.37
  Update bouncycastle to 1.76
  Fix some tests in ConfigTest
  Handle global git config $XDG_CONFIG_HOME/git/config
  IO: use JDK convenience methods
  org.eclipse.jgit.junit.ssh/.settings/.api_filters: fix unclosed tags
  ReadChangedPathFilter: fix Non-externalized string literal warning
  Introduce core.packedIndexGitUseStrongRefs config key
  DfsReader: Make PackLoadListener interface visible to subclasses
  DfsGarbageCollector: provide commit graph stats
  DfsGarbageCollector: put only GC commits into the commit graph
  DfsReader: Expose when indices are loaded

Change-Id: Idd78a0a1bc3cd3db5edb475e235c13354d9087a9
2023-08-30 16:43:08 +02:00
Matthias Sohn 2be8bf2b37 Remove the cbi-snapshots Maven repository
since it's not used anymore.

Change-Id: I884c5e5854d6a1f5b104d8d3bb0419e860fa34ca
2023-08-30 14:28:36 +02:00
Matthias Sohn 8995a64295 Update Orbit to orbit-aggregation/release/4.29.0
Switch to bundle dependencies for hamcrest 1.3 to avoid issues with
split packages in that version.

Don't allow hamcrest 2.x yet since junit 4.13.2 still requires hamcrest
1.3.

See Orbit restructuring in
https://github.com/orgs/eclipse-orbit/discussions/49

Change-Id: I8faf519b8f2c4e4a6bd255d694d1aa28017acd85
2023-08-30 14:28:33 +02:00
Matthias Sohn 2a64412e94 Add target platform for Eclipse 2023-09 (4.29)
Change-Id: I62f9bacebf0a2a2cba6ffde7936572e3f05a629c
2023-08-30 14:19:54 +02:00
Matthias Sohn 9fd44e0985 Use release p2 repo for Eclipse 2023-06 (4.28)
Change-Id: I3b8794bdb43db12c2eacda1de27651686c41abf5
2023-08-30 00:11:54 +02:00
Matthias Sohn 2d0a5fa643 Update tycho to 4.0.2
Change-Id: Ib619bc09bf79c0f9e7526c0303606f314e8c1209
2023-08-29 23:22:57 +02:00
Matthias Sohn b6b0d323a7 Update jmh to 1.37
Change-Id: I39e3dda1c13268c44055295398eab36c5ff7eb3e
2023-08-29 23:17:50 +02:00
Matthias Sohn 46264ba489 Update bouncycastle to 1.76
Change-Id: Ic569f348106e917001fbaa25a302fc20cca56244
2023-08-29 22:12:53 +02:00
Matthias Sohn e29834a77d Fix some tests in ConfigTest
Some of the ConfigTest tests created a FileRepositoryBuilder but didn't
use it to actually create a FileRepository.

Change-Id: I1a4b27891daee1b235a71e7bbf2a7588b9d11a53
2023-08-29 21:26:34 +02:00
Thomas Wolf a2f326b762 Handle global git config $XDG_CONFIG_HOME/git/config
C git uses this alternate fallback location if the file exists and
~/.gitconfig does not. Implement this also for JGit.

If both files exist, reading behavior is as if the XDG config was
inserted between the HOME config and the system config. Writing
behaviour is different: all changes will be applied only in the HOME
config. Updates will occur in the XDG config only if the HOME config
does not exist.

This is consistent with the behavior of C git; compare [1], especially
the sections on FILES and SCOPES, and the description of the --global
option.

[1] https://git-scm.com/docs/git-config

Bug: 581875
Change-Id: I2460b9aa963fd2811ed8a5b77b05107d916f2b44
Signed-off-by: Thomas Wolf <twolf@apache.org>
2023-08-28 22:05:47 +02:00
Jörg Kubitz 0d5e017612 IO: use JDK convenience methods
The benefit is that certain InputStreams can override the default
implementation for performance reasons.

Change-Id: I4c924157ec0f0ec63b0eca7cdbdc9325af24cab6
2023-08-28 21:50:14 +02:00
Jörg Kubitz 055a7c20e0 org.eclipse.jgit.junit.ssh/.settings/.api_filters: fix unclosed tags
error was introduced with I0fb77bb9b498d48d5da88a93486b99bf8121e3bd

Change-Id: I60af78cf0213a07356cb39b5f756679c58daee56
2023-08-28 14:11:41 -04:00
Jörg Kubitz a56930723f ReadChangedPathFilter: fix Non-externalized string literal warning
Change-Id: I78161a2dbc08918267bc59a1ed267c5108f5c391
2023-08-28 14:10:08 -04:00
Martin Fick e7a09e316d Introduce core.packedIndexGitUseStrongRefs config key
Introduce a core.packedIndexGitUseStrongRefs configuration key, which
defaults to true so that the current behavior does not change. However,
setting it to false allows soft references to be used for Pack indices
instead of strong references so that they can be garbage collected when
there is memory pressure.

Pack objects can be large when associated with pack files with large
object counts, and this memory is not really accounted for or tracked by
the WindowCache and it can be very substantial at times, especially with
many large object count projects. A particularly problematic use case is
Gerrit's ls-projects command which loads very little data in the
WindowCache via ByteWindows, but ends up loading and holding many entire
indices in memory, sometimes even after the ByteWindows for their Pack
objects have already been garbage collected since they won't get cleared
until after a new ByteWindow is loaded. By using SoftReferences, single
use indices can get cleared when there is memory pressure and OOMs can
be easily avoided, drastically reducing the amount of memory required to
perform an ls-projects on large sites with many projects and large
object counts.

On one of our test sites, an ls-projects command with strong index
references requires more than 66GB of heap to complete successfully,
with soft index references it requires less than 23GB.

Change-Id: I3cb3df52f4ce1b8c554d378807218f199077d80b
Signed-off-by: Martin Fick <quic_mfick@quicinc.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2023-08-26 16:16:43 +02:00
Jonathan Tan f8f5979aa2 Merge "DfsGarbageCollector: provide commit graph stats" 2023-08-21 13:07:51 -04:00
Ivan Frade 9919a9faaf DfsReader: Make PackLoadListener interface visible to subclasses
A subclass cannot implement a listener with the default access.

Make the interface protected. Not public because so far only
subclasses are interested in this interface. We can widen the
visibility later if needed.

Change-Id: I54e5c0ef1312dfe2fa660bc8fb54e2be35c0f6df
2023-08-18 11:43:10 -07:00
Jonathan Tan 551ca93cc6 DfsGarbageCollector: provide commit graph stats
Provide commit graph stats in the same way that we provide reftable
stats.

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Change-Id: Ib80c892a26f9b552bc90f3cbe7da83b02ffebdfd
2023-08-17 15:41:02 -07:00
Ivan Frade 6f73336939 DfsGarbageCollector: put only GC commits into the commit graph
GC puts all commits reachable from heads and tags into the GC pack,
and commits reachable only from other refs (e.g. refs/changes) into
GC_REST. The commit-graph contains all commits in GC and GC_REST. This
produces too big commit graphs in some repos, beating the purpose of
loading the index.

Limit the commit graph to commits reachable from heads and tags
(i.e. commits in the GC pack).

Change-Id: I4962faea5a726d2ea3e548af0aeae370a6cc8588
2023-08-16 13:31:55 -07:00
Ivan Frade b4b8f05eea DfsReader: Expose when indices are loaded
We want to measure the data used to serve a request. As a first step,
we want to know how many indices are accessed during the request and
their sizes.

Expose an interface in DfsReader to announce when an index is loaded
into the reader, i.e. when its reference is set.

The interface is more flexible to implementors (what/how to collect)
than the existing DfsReaderIOStats object.

Change-Id: I56f7658fde1758efaf869fa779d11b533a81a0a7
2023-08-03 23:53:13 +02:00
Matthias Sohn ab6540c66b Merge branch 'stable-6.7'
* stable-6.7:
  Update to Tycho 4.0.1
  Prepare 6.7.0-SNAPSHOT builds
  JGit v6.7.0.202308011830-m2
  Add verification in GcKeepFilesTest that bitmaps are generated
  Express the explicit intention of creating bitmaps in GC
  GC: prune all packfiles after the loosen phase
  Prepare 5.13.3-SNAPSHOT builds
  JGit v5.13.2.202306221912-r

Change-Id: I197d6116a4b5badc58b57d309982d2f6b3e45825
2023-08-03 10:19:05 +02:00
Matthias Sohn abe155ea94 Merge branch 'stable-6.6' into stable-6.7
* stable-6.6:
  Update to Tycho 4.0.1
  Add verification in GcKeepFilesTest that bitmaps are generated
  Express the explicit intention of creating bitmaps in GC
  GC: prune all packfiles after the loosen phase
  Prepare 5.13.3-SNAPSHOT builds
  JGit v5.13.2.202306221912-r

Change-Id: I7294c21748897eb3f94eeffbda944b62e3206c0d
2023-08-03 10:17:22 +02:00
Matthias Sohn b4c3a5da0d Merge branch 'stable-6.5' into stable-6.6
* stable-6.5:
  Add verification in GcKeepFilesTest that bitmaps are generated
  Express the explicit intention of creating bitmaps in GC
  GC: prune all packfiles after the loosen phase
  Prepare 5.13.3-SNAPSHOT builds
  JGit v5.13.2.202306221912-r

Change-Id: Id2e49252a9dc268210c9439848e77604885371aa
2023-08-03 10:14:45 +02:00
Matthias Sohn c64dfe5b49 Update to Tycho 4.0.1
Tycho 4.0.0-SNAPSHOT is no longer available and it's a bad practice to
depend on any snapshot version (we had to since this was the only way
to get gpg signing to work in time for releasing 6.6.0).

Change-Id: I1d4af5f69965b4cad50b379fd81f6f442b38c8d0
2023-08-03 10:12:57 +02:00
Matthias Sohn 82e277c813 Merge branch 'stable-6.4' into stable-6.5
* stable-6.4:
  Add verification in GcKeepFilesTest that bitmaps are generated
  Express the explicit intention of creating bitmaps in GC
  GC: prune all packfiles after the loosen phase
  Prepare 5.13.3-SNAPSHOT builds
  JGit v5.13.2.202306221912-r

Change-Id: Idb6dd6160e023673e3650653a15f6b1c540de96e
2023-08-03 01:55:12 +02:00
Matthias Sohn 76dfbb2ccd Merge branch 'stable-6.3' into stable-6.4
* stable-6.3:
  Add verification in GcKeepFilesTest that bitmaps are generated
  Express the explicit intention of creating bitmaps in GC
  GC: prune all packfiles after the loosen phase
  Prepare 5.13.3-SNAPSHOT builds
  JGit v5.13.2.202306221912-r

Change-Id: I0bccc36d9cc9a36f1be9b1562df35ce3a0e95eee
2023-08-03 01:51:36 +02:00
Matthias Sohn 05ded4ee62 Merge branch 'stable-6.2' into stable-6.3
* stable-6.2:
  Add verification in GcKeepFilesTest that bitmaps are generated
  Express the explicit intention of creating bitmaps in GC
  GC: prune all packfiles after the loosen phase
  Prepare 5.13.3-SNAPSHOT builds
  JGit v5.13.2.202306221912-r

Change-Id: I589ed444b5cbfc5b073cac91323e2cc97ab98087
2023-08-03 01:37:43 +02:00
Matthias Sohn 6483c7d209 Merge branch 'stable-6.1' into stable-6.2
* stable-6.1:
  Add verification in GcKeepFilesTest that bitmaps are generated
  Express the explicit intention of creating bitmaps in GC
  GC: prune all packfiles after the loosen phase
  Prepare 5.13.3-SNAPSHOT builds
  JGit v5.13.2.202306221912-r

Change-Id: I5b16c3b613a95b7f28c8f6ac0b20c4c593759cea
2023-08-03 01:28:07 +02:00
Matthias Sohn 55ff4ed9de Merge branch 'stable-6.0' into stable-6.1
* stable-6.0:
  Add verification in GcKeepFilesTest that bitmaps are generated
  Express the explicit intention of creating bitmaps in GC
  GC: prune all packfiles after the loosen phase
  Prepare 5.13.3-SNAPSHOT builds
  JGit v5.13.2.202306221912-r

Change-Id: Ib08037f6055dac1776e38cfb4ff8c88a50ad3e60
2023-08-03 01:19:21 +02:00
Matthias Sohn c7849fbb19 Merge branch 'stable-5.13' into stable-6.0
* stable-5.13:
  Add verification in GcKeepFilesTest that bitmaps are generated
  Express the explicit intention of creating bitmaps in GC
  GC: prune all packfiles after the loosen phase
  Prepare 5.13.3-SNAPSHOT builds
  JGit v5.13.2.202306221912-r

Change-Id: I1f50995d9d9c592ec0e02a04e0e409440b49f9f3
2023-08-03 01:17:17 +02:00
Matthias Sohn de7b5b7b26 Prepare 6.7.0-SNAPSHOT builds
Change-Id: I936d2d9106a1e3b7a98ec89fec8ae8a92ec765f2
2023-08-03 00:05:50 +02:00
Matthias Sohn 1d26471c16 JGit v6.7.0.202308011830-m2
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Change-Id: I255a979e9f48f60a251ef7b74ced3f720f012706
2023-08-02 00:30:01 +02:00
Matthias Sohn 24b6a35d30 Add missing @since tags
This was missed in c353645a09

Change-Id: I4ae5b13bd7bfd09c113d91ece727a26706660826
2023-08-02 00:19:02 +02:00
Han-Wen NIenhuys d96a91e77e Merge "Merge: Add diff3 style merge conflict formatter." 2023-08-01 13:08:34 -04:00
Han-Wen Nienhuys ba8f3cb1f2 Fix errorprone warning about precedence
The condition looks suspicious, as in case of

  (hasElement==null && hasNext())

the check will generate a NPE

Change-Id: I267f9df6746393d72f5102bd5271441422550968
2023-08-01 14:48:51 +02:00
Nitzan Gur-Furman c353645a09 Move footer-line parsing methods from RevCommit to FooterLine
This allows extracting footers from a messages not associated with a
commit.

The public API of RevCommit is kept intact.

Change-Id: I5809c23df7b7d49641a4be3a26d6f987d3d57c9b
Bug: Google b/287891316
2023-08-01 10:37:24 +02:00
Haamed Gheibi 462c57ec8d Merge: Add diff3 style merge conflict formatter.
Add base section to the merge conflict hunks.

Bug: 442284
Change-Id: I977b43e7dd8119d6b72d11f09c4e8ec241750383
2023-07-31 11:57:28 -07:00
Jonathan Tan ec11129b1d Merge changes I8c60d970,I09bdd4b8,I87ff3933
* changes:
  Pack: open reverse index from file if present
  PackReverseIndex: open file if present otherwise compute
  PackReverseIndex: verify checksums
2023-07-26 16:39:13 -04:00
Ivan Frade c8f5a3f99d RevCommitCG: Read changed-path-filters directly from commit graph
RevCommit and RevCommitCG were designed like "pointers" to data that
load the content on demand, not on construction. This saves memory.

Make the loading of changed-path-filter follow the same pattern. The
ChangedPathFilters are only pointers to locations in the commit-graph
(not the actual data), so the memory saving is not that big, but this
is more consistent with the rest of the API.

As 6.7 is not released, we can still change the RevWalk API.

Change-Id: Id4186ea744b8a2418d0329facae69f785108d356
2023-07-26 12:22:01 +02:00
Matthias Sohn eecd93714b Update commons-codec to 1.16.0
Change-Id: I64617b17a168da1966b93c283c150d549477f3e1
2023-07-25 23:22:46 +02:00