aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Merge changes I343cc3cf,I9dedf61bMatthias Sohn2023-02-014-11/+11
|\ | | | | | | | | | | * changes: Avoid error-prone warning Fix unused exception error-prone warning
| * Avoid error-prone warningHan-Wen Nienhuys2023-02-013-10/+10
| | | | | | | | | | | | | | GC.gc() returns a Future, which should not be discarded. See also https://errorprone.info/bugpattern/FutureReturnValueIgnored Change-Id: I343cc3cfe74a564ad7f8d53f0fe9d96a23aaed00
| * Fix unused exception error-prone warningHan-Wen Nienhuys2023-02-011-1/+1
| | | | | | | | | | | | Ignoring the exception seems intended in this case. Change-Id: I9dedf61b9cb5a6ff39fb141dd5da19143f4f6978
* | UploadPack: advertise object-info command if enabledHan-Wen Nienhuys2023-02-011-0/+3
|/ | | | Change-Id: Iad8e5b5f4fdd84bd275eb19ee0d01eb6986d79f2
* Merge "Move MemRefDatabase creation in a separate method."Han-Wen NIenhuys2023-02-011-1/+10
|\
| * Move MemRefDatabase creation in a separate method.Dmitrii Filippov2023-01-311-1/+10
| | | | | | | | | | | | | | The InMemoryRepository is used in tests (e.g. in gerrit tests) and it can be useful to create a custom MemRefDatabase for some tests. Change-Id: I6fbbbfe04400ea1edc988c8788c8eeb06ca8480a
* | Merge branch 'stable-6.4'Matthias Sohn2023-02-0114-16/+300
|\ \ | |/ |/| | | | | | | | | | | | | | | | | | | | | | | * stable-6.4: 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: Id0ebfbd85eb815716383b9495eb7dd1f54cf4d74
| * Merge branch 'stable-6.3' into stable-6.4Matthias Sohn2023-02-0113-16/+260
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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
| | * Merge branch 'stable-6.2' into stable-6.3Matthias Sohn2023-02-0114-16/+300
| | |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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
| | | * Merge branch 'stable-6.1' into stable-6.2Matthias Sohn2023-02-0114-16/+300
| | | |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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
| | | | * Merge branch 'stable-6.0' into stable-6.1Matthias Sohn2023-02-0114-16/+300
| | | | |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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
| | | | | * Merge branch 'stable-5.13' into stable-6.0Matthias Sohn2023-02-0115-146/+260
| | | | | |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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
| | | | | | * Shortcut during git fetch for avoiding looping through all local refsLuca Milanesio2023-02-011-5/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| | | | | | * FetchCommand: fix fetchSubmodules to work on a Ref to a blobMatthias Sohn2023-01-311-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| | | | | | * Silence API warnings introduced by I466dcde6Matthias Sohn2023-01-312-5/+60
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Change-Id: I510510da34d33757c2f83af8cd1e26f6206a486a
| | | | | | * Allow the exclusions of refs prefixes from bitmapLuca Milanesio2023-01-315-4/+82
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| | | | | | * PackWriterBitmapPreparer: do not include annotated tags in bitmapLuca Milanesio2023-01-312-0/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| | | | | | * BatchingProgressMonitor: avoid int overflow when computing percentageMatthias Sohn2023-01-312-3/+86
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When cloning huge repositories I observed percentage of object counts turning negative. This happened if lastWork * 100 exceeded Integer.MAX_VALUE. Change-Id: Ic5f5cf5a911a91338267aace4daba4b873ab3900
| | | | | | * Speedup GC listing objects referenced from reflogsMatthias Sohn2023-01-235-41/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| | | | | | * FileSnapshotTest: Add more MISSING_FILE coverageNasser Grainawi2023-01-061-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | | | | | | [pgm] Fetch-CLI: add support for shallowHarald Weiner2023-01-247-0/+251
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds support for shallow cloning. The CloneCommand and the FetchCommand now have the new options --depth, --shallow-since and --shallow-exclude to tell the server that the client doesn't want to download the complete history. Bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=475615 Change-Id: I8f113bed25dd6df64f2f95de6a59d4675ab8a903
* | | | | | | Re-add servlet-api 4.0 to the target platformMatthias Sohn2023-01-1611-10/+65
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This was removed from the JGit target platform by mistake in 6ca3d219. Change-Id: Iedae0586fb96651255b67ed6dbb9ff7702c0ea54
* | | | | | | Upgrade maven pluginsMichael Keppler2023-01-133-31/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove tycho-extras-version, because Tycho and Tycho Extras are meanwhile in a single repository and maintained together. Update - build-helper-maven-plugin to 3.3.0 - eclipse-jarsigner-plugin to 1.3.5 - jacoco-maven-plugin to 0.8.8 - japicmp to 0.17.1 - maven-antrun-plugin to 3.1.0 - maven-clean-plugin to 3.2.0 - maven-compiler-plugin to 3.10.1 - maven-dependency-plugin to 3.5.0 - maven-deploy-plugin to 3.0.0 - maven-enforcer-plugin to 3.1.0 - maven-install-plugin to 3.1.0 - maven-jar-plugin to 3.3.0 - maven-javadoc-plugin to 3.4.1 - maven-jxr-plugin to 3.3.0 - maven-pmd-plugin to 3.20.0 - maven-project-info-reports-plugin to 3.4.2 - maven-resources-plugin to 3.3.0 - maven-shade-plugin to 3.4.1 - maven-site-plugin to 4.0.0-M4 - maven-surefire-plugin to 3.0.0-M8 - spotbugs-maven-plugin to 4.7.3.0 - spring-boot-maven-plugin to 2.7.7 Change-Id: I14d9ff06d2f509d782eb63adfa6b5733649f11f1
* | | | | | | Merge branch 'stable-6.5'Matthias Sohn2023-01-130-0/+0
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-6.5: Prepare 6.5.0-SNAPSHOT builds JGit v6.5.0.202301111425-m1 Change-Id: Ic37f47cb1a7d975918ee9d416576ea9e30aa62db
| * | | | | | | Prepare 6.5.0-SNAPSHOT buildsMatthias Sohn2023-01-1191-125/+125
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Change-Id: I6fbda9ad8e054a664cb79c3a32baded12ad6802f
| * | | | | | | JGit v6.5.0.202301111425-m1v6.5.0.202301111425-m1Matthias Sohn2023-01-1191-125/+125
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Signed-off-by: Matthias Sohn <matthias.sohn@sap.com> Change-Id: I4e81d5c61d66f748e0c5bc86d95f579b5990e9f4
* | | | | | | | Merge branch 'stable-6.4'Matthias Sohn2023-01-135-32/+87
|\ \ \ \ \ \ \ \ | |/ / / / / / / |/| / / / / / / | |/ / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-6.4: Cache trustFolderStat/trustPackedRefsStat value per-instance Refresh 'objects' dir and retry if a loose object is not found Change-Id: Iea8038dfde29ab988501469f86ee829e578a2fe8
| * | | | | | Merge branch 'stable-6.3' into stable-6.4Matthias Sohn2023-01-135-32/+87
| |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-6.3: Cache trustFolderStat/trustPackedRefsStat value per-instance Refresh 'objects' dir and retry if a loose object is not found Change-Id: I1db2b51ae8101f345d08235d4f3dc416bfcb42d5
| | * | | | | Merge branch 'stable-6.2' into stable-6.3Matthias Sohn2023-01-135-32/+87
| | |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-6.2: Cache trustFolderStat/trustPackedRefsStat value per-instance Refresh 'objects' dir and retry if a loose object is not found Change-Id: Ibc9bffab8c9ef9c39384b53c142d99878f7f3f98
| | | * | | | Merge branch 'stable-6.1' into stable-6.2Matthias Sohn2023-01-135-32/+87
| | | |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-6.1: Cache trustFolderStat/trustPackedRefsStat value per-instance Refresh 'objects' dir and retry if a loose object is not found Change-Id: I9e876f72f735f58bf02c7862a3d8e657fc46a7b9
| | | | * | | Cache trustFolderStat/trustPackedRefsStat value per-instanceNasser Grainawi2023-01-132-23/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| | | | * | | Refresh 'objects' dir and retry if a loose object is not foundKaushik Lingarkar2023-01-133-9/+66
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | | | | | | Update Orbit to S20230101190934Matthias Sohn2023-01-1124-124/+193
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | and update - com.google.gson to 2.10.0.v20221207-1049" - org.apache.commons.compress to 1.22.0.v20221207-1049 - org.apache.httpcomponents.httpclient to 4.5.14.v20221207-1049 - org.apache.httpcomponents.httpcore to 4.4.16.v20221207-1049 Change-Id: I8da9be68162636ca2530ea042b069c533c7d975a
* | | | | | | Update to releases p2 repo for 4.26 simultaneous releaseMatthias Sohn2023-01-112-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Change-Id: I31690aeba1f4a5e9111de184ba81c4f971c756e0
* | | | | | | RevWalk: integrate commit-graph with commit parsingkylezhao2023-01-105-1/+514
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | RevWalk#createCommit() will inspect the commit-graph file to find the specified object's graph position and then return a new RevCommitCG instance. RevCommitGC is a RevCommit with an additional "pointer" (the position) to the commit-graph, so it can load the headers and metadata from there instead of the pack. This saves IO access in walks where the body is not needed (i.e. #isRetainBody is false and #parseBody is not invoked). RevWalk uses automatically the commit-graph if available, no action needed from callers. The commit-graph is fetched on first access from the reader (that internally can keep it loaded and reuse it between walks). The startup cost of reading the entire commit graph is small. After testing, reading a commit-graph with 1 million commits takes less than 50ms. If we use RepositoryCache, it will not be initialized util the commit-graph is rewritten. Bug: 574368 Change-Id: I90d0f64af24f3acc3eae6da984eae302d338f5ee Signed-off-by: kylezhao <kylezhao@tencent.com>
* | | | | | | Merge branch 'stable-6.4'Matthias Sohn2023-01-065-3/+78
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-6.4: Introduce core.trustPackedRefsStat config Fix documentation for core.trustFolderStat Change-Id: I93ad0c49b70113134026364c9f647de89d948693
| * | | | | | Merge branch 'stable-6.3' into stable-6.4Matthias Sohn2023-01-054-3/+61
| |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-6.3: Introduce core.trustPackedRefsStat config Fix documentation for core.trustFolderStat Change-Id: I18d9fc89c9ac1ef069dcefa7d7f992a28539ccf3
| | * | | | | Merge branch 'stable-6.2' into stable-6.3Matthias Sohn2023-01-056-3/+247
| | |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-6.2: Introduce core.trustPackedRefsStat config Fix documentation for core.trustFolderStat Change-Id: I48b6c095ac62dc859829d6fef45325accbb0a144
| | | * | | | Merge branch 'stable-6.1' into stable-6.2Matthias Sohn2023-01-055-3/+75
| | | |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-6.1: Introduce core.trustPackedRefsStat config Fix documentation for core.trustFolderStat Change-Id: Ic78630f74c72624932a384eed52ef79ae1eff3e5
| | | | * | | Introduce core.trustPackedRefsStat configKaushik Lingarkar2023-01-055-2/+73
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| | | | * | | Fix documentation for core.trustFolderStatKaushik Lingarkar2022-12-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | | | | | | GC: disable writing commit-graph for shallow reposkylezhao2023-01-062-0/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In shallow repos, GC writes to the commit-graph that shallow commits do not have parents. This won't be true after a "git fetch --unshallow" (and before another GC). Do not write the commit-graph from shallow clones of a repo. The commit-graph must have the real metadata of commits and that is not available in a shallow view of the repo. Change-Id: Ic9f2358ddaa607c74f4dbf289c9bf2a2f0af9ce0 Signed-off-by: kylezhao <kylezhao@tencent.com>
* | | | | | | RefDatabase: fix javadoc formattingMatthias Sohn2023-01-041-29/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Change-Id: I547819ac380a0e6a88d05206ff171b69f46a8549
* | | | | | | Pull up additionalRefsNames from RefDirectory to RefDatabaseMatthias Sohn2023-01-043-5/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This enables to reuse this constant in all RefDatabase implementations. Change-Id: I13d8fb780de24f71e005b698965fb5bcdbf3c728
* | | | | | | Add TernarySearchTreeMatthias Sohn2023-01-046-0/+934
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | | | | | | CommitGraph: teach ObjectReader to get commit-graphkylezhao2023-01-044-1/+57
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | | | | | | Merge "CommitGraph: add commit-graph for FileObjectDatabase"Ivan Frade2023-01-037-0/+207
|\ \ \ \ \ \ \
| * | | | | | | CommitGraph: add commit-graph for FileObjectDatabasekylezhao2022-12-237-0/+207
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | | | | | | | PatchApplier: fix handling of last newline in text patchThomas Wolf2022-12-2638-18/+1358
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | | | | | | | Reformat PatchApplier and PatchApplierTestThomas Wolf2022-12-222-59/+65
|/ / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>