aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'stable-7.1'Matthias Sohn7 days1-6/+6
|\ | | | | | | | | | | | | | | | | | | | | | | * stable-7.1: FileSnapshot: fix warnings Optionally.Hard: avoid Optional creation on every use, Pack: fix threading bug getting idx Fix potential NPE in TreeWalk#getFilterCommandDefinition Advertise "agent" capability when using protocol v2 FileSnapshot: silence "Stale file handle" exceptions Change-Id: I772dd3b3ce7f27e33c1879ce21ec024cc2f9c52a
| * Merge branch 'stable-7.0' into stable-7.1Matthias Sohn7 days1-6/+6
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-7.0: FileSnapshot: fix warnings Optionally.Hard: avoid Optional creation on every use, Pack: fix threading bug getting idx Fix potential NPE in TreeWalk#getFilterCommandDefinition Advertise "agent" capability when using protocol v2 FileSnapshot: silence "Stale file handle" exceptions Change-Id: I4fdea7450f27eebfa7ae08002fd51e67b58bf6bb
| | * Advertise "agent" capability when using protocol v2Antonio Barone13 days1-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The "agent" capability was not advertised by the server when executing git-upload-pack over protocol v2. This, in turn, prevented the clients from advertising its client agent too, as documented [1]: "The client may optionally send its own agent string by including the agent capability with a value Y (in the form agent=Y) in its request to the server (but it MUST NOT do so if the server did not advertise the agent capability)." When using jgit with Gerrit this had the effect of preventing the logging of the git client agent in the sshd_log. [1] https://git-scm.com/docs/protocol-v2#_agent Bug: jgit-118 Change-Id: Ifb6ea65fde020425920338f7dd9cc683fed6a4a4
| | * Test advertised capabilities with protocol V0 and allow*Sha1InWantpszlazak2024-11-211-0/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The advertised capabilities with protocol V0 were untested leading to potential regressions when advertising what SHA1 should or should not be on the list of capabilities. Verify that allow-tip-sha1-in-want and allow-reachable-sha1-in-want are properly advertised with the allow*Sha1InWant is set in jgit.config. Change-Id: Id48af2bc19280f2dcb26aa8e8765cde8f2ce7a06 (cherry picked from commit 5583f6a10eafc8c2627e0fb4833cb8ffe422f69a)
* | | PushCertificateIdentTest: Add test for the timezone parsingIvan Frade10 days1-0/+45
|/ / | | | | | | | | | | | | | | | | | | | | | | PushCertificateIdent translates the hhmm in the certificate ident to minutes and then back to hhmm when a timezone is needed. This accepts invalid timezones like +0061 (which becomes +0101 (!)). Add test covering these peculiar timezone translations. This will help when porting the PushCertificateIdent to the new java.time API Change-Id: I008648d4e0c977eb3b3135e548d577680cf5f39c
* | UploadPackTest: fix unclosed resource warningMatthias Sohn2024-11-191-4/+4
| | | | | | | | Change-Id: I4efccd72bd567d42e739ee330e26c6b04d5c5c01
* | Test advertised capabilities with protocol V0 and allow*Sha1InWantLuca Milanesio2024-10-121-0/+42
|/ | | | | | | | | | | | The advertised capabilities with protocol V0 were untested leading to potential regressions when advertising what SHA1 should or should not be on the list of capabilities. Verify that allow-tip-sha1-in-want and allow-reachable-sha1-in-want are properly advertised with the allow*Sha1InWant is set in jgit.config. Change-Id: I99d062a5a630b02ca3d1fe83bf6cdf3c284ae941
* Fix warning "Redundant specification of type arguments <Object>"Matthias Sohn2024-05-142-26/+6
| | | | | | Use a lambda to fix this and make the code easier to read. Change-Id: I082ffb2073f86d21deb4b51a24e53de9371b765e
* Fix warning about using raw typeMatthias Sohn2024-04-291-1/+1
| | | | | | | | | | This fixes the warning in UploadPackHandleDeletedPackFileTest. line 116: "Type safety: The method register(Object, Repository) belongs to the raw type TestProtocol. References to generic type TestProtocol<C> should be parameterized." Change-Id: I5a74269f1af7369dd397dd0f1c3cd807c0351367
* [errorprone] Fix pattern FutureReturnValueIgnoredMatthias Sohn2024-04-291-2/+2
| | | | | | See https://errorprone.info/bugpattern/FutureReturnValueIgnored Change-Id: I7225fd6388ce70ed5eea9e61b29bd10e1a927acb
* [errorprone] Fix pattern BadImportMatthias Sohn2024-04-291-2/+2
| | | | | | See https://errorprone.info/bugpattern/BadImport Change-Id: I24e5a7a4a64d8b3cf2cc3d394090ce90e849f9f9
* [errorprone] Fix pattern CatchFailMatthias Sohn2024-04-291-3/+3
| | | | | | See https://errorprone.info/bugpattern/CatchFail Change-Id: If1c637a420c4e669a5bdbe4abcefc5c3a2b3a43b
* [errorprone] Fix pattern LongLiteralLowerCaseSuffixMatthias Sohn2024-04-291-2/+2
| | | | | | See https://errorprone.info/bugpattern/LongLiteralLowerCaseSuffix Change-Id: I139eadef5d66dfed2952ba9e1c91b3fe83259e97
* [errorprone] Fix error pattern JdkObsoleteMatthias Sohn2024-04-291-2/+2
| | | | | | See https://errorprone.info/bugpattern/JdkObsolete Change-Id: Id105e2695eb64523bd217f507bf95f909bc6b348
* [errorprone] Fix UnnecessaryParentheses errorsMatthias Sohn2024-04-283-36/+39
| | | | | | See https://errorprone.info/bugpattern/UnnecessaryParentheses Change-Id: I783fd24286ec1bd55efbf21d05758465f4af87ee
* Fix handling of missing pack index fileDariusz Luksza2024-01-281-2/+0
| | | | | | | | | | | | | | | | | | | | As demonstrated in `UploadPackHandleDeletedPackFile.testV2IdxFileRemovedDuringUploadPack` the fetch operation will fail when the pack index file is removed. This is due to a wrapping of `FileNotFoundException` (which is a subclass of `IOExeption`) in an `IOException` at PackIndex L#68. This is then changing the behaviour of error handling in `Pack.file.getBitmapIndex()` where the `FileNotFoundException` is swallowed and allows the fetch process to continue. With FNFE being wrapped in IOE, this blows up and breaks the fetch operation. Simply rethrowing `FileNotFoundException` from `PackFile.open()` fixes the broken fetch operation. This will also mark the whole pack as invalid in the `IOException` handler in `Pack.idx()` method. Change-Id: Ibe321aa1af21d26500e1cb2eb3464cc99a6dbc62 Signed-off-by: Dariusz Luksza <dariusz.luksza@gmail.com>
* Add tests for handling pack files removal during fetchDariusz Luksza2024-01-181-0/+148
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Although this could sound like a corner case, it really can occur out there in the real world. Especially in the Gerrit world where the repositories could be GC'ed on a separate process or system. The `FileNotFoundException` seems to be handled correctly in `PackFile#doOpen` (line 671) and it will mark the pack as invalid. But triggering that code path was not an easy task. First of all, we need to add a new commit to the `master` branch of the test repository after `UploadPack` object is created. Secondly, in the refspec for fetch, commit id instead of "regular" refspec must be used. With both in place, we can see a warning log statement about deleted pack file. And the fetch succeeds! Also, tests for the removal of *.idx and *.bitmap files were added. This unveiled a corner for the *.idx file deletion while fetching, as the test will fail with "Unreachable pack index" IOException only when the HEAD commit is empty. Change-Id: If26c83f9b12993d1ab7d6bad6bd863c29520b062 Signed-off-by: Dariusz Luksza <dariusz.luksza@gmail.com>
* Adjust javadoc to pass errorprone checksIvan Frade2023-11-171-1/+17
| | | | | | | | | | | bazel build //org.eclipse.jgit.test:all doesn't build due to errorprone errors. This leds to disabling the checks and find the errors later in the jenkins builder. Fix javadoc errors reported by errorprone. This doesn't fix completely the build but it is a step towards it. Change-Id: Ic4ec93a2d71d4628bf3a05277c60157881156393
* Use try-with-resource to ensure UploadPack is closedMatthias Sohn2023-11-091-5/+6
| | | | Change-Id: I0d10aeac959a49b3bf2e83b0c104699d1d21f5e9
* Fix hiding field warningMatthias Sohn2023-11-091-4/+4
| | | | Change-Id: I9aced1b711901918667555a4cfff76992024e59c
* UploadPackTest: Cover using wanted-refs as advertised setIvan Frade2023-10-271-0/+62
| | | | | | | | | | | | | Parent change introduced using "wanted-refs" as advertised set during fetchV2, but it tested only a request without wantIds (only wanted-refs). Add a second where the request has wanted-refs AND wantId (which disables the optimization). Change the test to measure the amount of refs considered advertised, instead of relying in calls to the refdb. Change-Id: Id64ec933fd737bae1bfd429c7b8cc05b51a83870
* UploadPack: use want-refs as advertised set in fetch v2Patrick Hiesel2023-10-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Protocol v2 introduced refs-in-wants and ls-remote with prefixes. UploadPack already uses prefixes provided by the client during a v2 ref advertisement (ls-refs). However, when the client consequently sends another request to fetch a previously advertised ref (with want-ref lines), the server uses the whole set of advertised refs to compute reachability. In repos with many refs, this slows down the reachability checks setting up and walking through unnecessary refs. For gerrit it can also break valid requests because in gerrit "all" means "recent" and the wanted-ref could fall out of the "recent" range when reloading all refs at fetch time. Treat wanted-refs like a ref-prefix when calculating the advertised refs on v2 fetch command. Less refs means a faster setup and less walk for the reachability checks. Note that wanted-refs filters only over the refs visible to the user, so this doesn't give any extra visibility to the caller. If the request contains also "want <oid>" lines, we cannot use this optimization. Those objects could be reachable from any visible branch, not necessarily in the wanted-refs. Google-Bug: b/122888978 Change-Id: I2a4ae171d4fc5d4cb30b020cb073ad23dd5a66c4
* BasePackFetchConnection: Avoid full clone with useNegotiationTipRonald Bhuleskar2023-10-251-2/+65
| | | | | | | | With the useNegotiationTip flag (introduced in change 738dacb), the client sends to the server only the tips of the wanted refs for the negotiation. Some wanted refs may not exist in the client (yet) and our implementation ignores them. So when only non-existing refs are wanted, jgit doesn't send any tips and the server understands it is a full clone. In useNegotiationTip, send ALL_REFS if any of the wanted refs does not exists locally. Change-Id: Ide04c5df785b9212abcd9d3cba194515e0af166f
* Remove redundant specification of type argumentsMatthias Sohn2023-07-161-1/+1
| | | | Change-Id: I8289e0a6ca9154d6411993d250176a35df7cb905
* PackParserTest: Extract pack-writing helper code to its own classIvan Frade2023-07-142-104/+153
| | | | | | | | | PackParserTest has code to create a small pack in memory. We can use it to test also the DfsPackParser. Extract the helper functions to a new class (InMemoryPack). Change-Id: I6dea4d6ea2cac2da8201702df92fd09a687e90a6
* Fix all Javadoc warnings and fail on themAntoine Musso2023-06-161-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes all the javadoc warnings, stops ignoring doclint 'missing' category and fails the build on javadoc warnings for public and protected classes and class members. Since javadoc doesn't allow access specifiers when specifying doclint configuration we cannot set `-Xdoclint:all,-missing/private` hence there is no simple way to skip private elements from doclint. Therefore we check javadoc using the Eclipse Java compiler (which is used by default) and javadoc configuration in `.settings/org.eclipse.jdt.core.prefs` files. This allows more fine grained configuration. We can reconsider this when javadoc starts supporting access specifiers in the doclint configuration. Below are detailled explanations for most modifications. @inheritDoc =========== doclint complains about explicits `{@inheritDoc}` when the parent does not have any documentation. As far as I can tell, javadoc defaults to inherit comments and should only be used when one wants to append extra documentation from the parent. Given the parent has no documentation, remove those usages which doclint complains about. In some case I have moved up the documentation from the concrete class up to the abstract class. Remove `{@inheritDoc}` on overriden methods which don't add additional documentation since javadoc defaults to inherit javadoc of overridden methods. @value to @link =============== In PackConfig, DEFAULT_SEARCH_FOR_REUSE_TIMEOUT and similar are forged from Integer.MAX_VALUE and are thus not considered constants (I guess cause the value would depends on the platform). Replace it with a link to `Integer.MAX_VALUE`. In `StringUtils.toBoolean`, @value was used to refer to the `stringValue` parameter. I have replaced it with `{@code stringValue}`. {@link <url>} to <a> ==================== @link does not support being given an external URL. Replaces them with HTML `<a>`. @since: being invalid ===================== org.eclipse.jgit/src/org/eclipse/jgit/util/Equality.java has an invalid tag `@since: ` due to the extra `:`. Javadoc does not complain about it with version 11.0.18+10 but does with 11.0.19.7. It is invalid regardless. invalid HTML syntax =================== - javadoc doesn't allow <br/>, <p/> and </p> anymore, use <br> and <p> instead - replace <tt>code</tt> by {@code code} - <table> tags don't allow summary attribute, specify caption as <caption>caption</caption> to fix this doclint visibility issue ======================== In the private abstract classes `BaseDirCacheEditor` and `BasePackConnection` links to other methods in the abstract class are inherited in the public subclasses but doclint gets confused and considers them unreachable. The HTML documentation for the sub classes shows the relative links in the sub classes, so it is all correct. It must be a bug somewhere in javadoc. Mute those warnings with: @SuppressWarnings("doclint:missing") Misc ==== Replace `<` and `>` with HTML encoded entities (`&lt; and `&gt;`). In `SshConstants` I went enclosing a serie of -> arrows in @literal. Additional tags =============== Configure maven-javad0c-plugin to allow the following additional tags defined in https://openjdk.org/jeps/8068562: - apiNote - implSpec - implNote Missing javadoc =============== Add missing @params and descriptions Change-Id: I840056389aa59135cfb360da0d5e40463ce35bd0 Also-By: Matthias Sohn <matthias.sohn@sap.com>
* Merge branch 'stable-6.5'Matthias Sohn2023-04-281-0/+69
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-6.5: [bazel] Move ToolTestCase to src folder (6.2) GcConcurrentTest: @Ignore flaky testInterruptGc Fix CommitTemplateConfigTest Fix after_open config and Snapshotting RefDir tests to work with bazel [bazel] Skip ConfigTest#testCommitTemplatePathInHomeDirecory Demote severity of some error prone bug patterns to warnings Parse pull.rebase=preserve as alias for pull.rebase=merges UploadPack: Fix NPE when traversing a tag chain Change-Id: I16e8553d187a8ef541f578291f47fc39c3da4ac0
| * Merge branch 'stable-6.4' into stable-6.5Matthias Sohn2023-04-271-0/+69
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-6.4: [bazel] Move ToolTestCase to src folder (6.2) GcConcurrentTest: @Ignore flaky testInterruptGc Fix CommitTemplateConfigTest Fix after_open config and Snapshotting RefDir tests to work with bazel [bazel] Skip ConfigTest#testCommitTemplatePathInHomeDirecory Demote severity of some error prone bug patterns to warnings UploadPack: Fix NPE when traversing a tag chain Change-Id: I6d20fea3a417e4361b61e81756253343668eb5de
| | * Merge branch 'stable-6.3' into stable-6.4Matthias Sohn2023-04-271-0/+69
| | |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-6.3: [bazel] Move ToolTestCase to src folder (6.2) GcConcurrentTest: @Ignore flaky testInterruptGc Fix CommitTemplateConfigTest Fix after_open config and Snapshotting RefDir tests to work with bazel [bazel] Skip ConfigTest#testCommitTemplatePathInHomeDirecory Demote severity of some error prone bug patterns to warnings UploadPack: Fix NPE when traversing a tag chain Change-Id: I463f8528e623316add204848d551c44d44d04858
| | | * Merge branch 'stable-6.2' into stable-6.3Matthias Sohn2023-04-271-0/+69
| | | |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-6.2: [bazel] Move ToolTestCase to src folder (6.2) GcConcurrentTest: @Ignore flaky testInterruptGc Fix CommitTemplateConfigTest Fix after_open config and Snapshotting RefDir tests to work with bazel [bazel] Skip ConfigTest#testCommitTemplatePathInHomeDirecory Demote severity of some error prone bug patterns to warnings UploadPack: Fix NPE when traversing a tag chain Change-Id: I736c7d0ed9c6e9718fa98976c3dc5a25ab8cda85
| | | | * Merge branch 'stable-6.1' into stable-6.2Matthias Sohn2023-04-271-0/+69
| | | | |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-6.1: GcConcurrentTest: @Ignore flaky testInterruptGc Fix CommitTemplateConfigTest Fix after_open config and Snapshotting RefDir tests to work with bazel [bazel] Skip ConfigTest#testCommitTemplatePathInHomeDirecory Demote severity of some error prone bug patterns to warnings UploadPack: Fix NPE when traversing a tag chain Change-Id: I9863cbce95d845efc891724898954b0b2f8dbf7b
| | | | | * Merge branch 'stable-6.0' into stable-6.1Matthias Sohn2023-04-261-0/+69
| | | | | |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-6.0: [bazel] Skip ConfigTest#testCommitTemplatePathInHomeDirecory Demote severity of some error prone bug patterns to warnings UploadPack: Fix NPE when traversing a tag chain Change-Id: I5e13d5b5414aef97e518898166bfa166c692e60f
| | | | | | * UploadPack: Fix NPE when traversing a tag chainKaushik Lingarkar2023-04-211-0/+69
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Always parse RevTags including their body before getting their object to ensure that non-cached objects are handled correctly when traversing a tag chain. An NPE in UploadPack#addTagChain will occur on a depth=1 fetch of a branch containing a tag chain and the ref to one of the middle tags in the chain is deleted. Change-Id: Ifd8fe868869070b365df926fec5dcd8e64d4f521 Signed-off-by: Kaushik Lingarkar <quic_kaushikl@quicinc.com>
* | | | | | | BasePackFetchConnection: support negotiationTip featureRonald Bhuleskar2023-03-281-0/+232
|/ / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | By default, Git will report, to the server, commits reachable from all local refs to find common commits in an attempt to reduce the size of the to-be-received packfile. If specified with negotiation tip, Git will only report commits reachable from the given tips. This is useful to speed up fetches when the user knows which local ref is likely to have commits in common with the upstream ref being fetched. When negotation-tip is on, use the wanted refs instead of all refs as source of the "have" list to send. This is controlled by the `fetch.usenegotationtip` flag, false by default. This works only for programmatic fetches and there is no support for it yet in the CLI. Change-Id: I19f8fe48889bfe0ece7cdf78019b678ede5c6a32
* | | | | | UploadPack: use allow-any-sha1-in-want configurationkylezhao2023-02-211-0/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | C git 2.11 supports setting the equivalent of RequestPolicy.ANY with uploadpack.allowAnySHA1InWant[1]. Parse this into TransportConfig and use it from UploadPack. Add additional tests for [2] and this change. We can execute "git clone --filter=blob:none --no-checkout" successfully with config uploadPack.allowFilter is true. But when we checkout, the git will fetch other missing objects required by the checkout(this is why we need this config). When both uploadPack.allowFilter and uploadPack.allowAnySHA1InWant are true, jgit will support partial clone. If you are using an extremely large monorepo, this feature can help. It allows users to work on an incomplete repo which reduces disk usage. [1] https://github.com/git/git/commit/f8edeaa05d8623a9f6dad408237496c51101aad8 [2] change Id39771a6e42d8082099acde11249306828a053c0 Bug: 573390 Change-Id: I8fe75f03bf1fea7c11e0d67c8637bd05dd1f9b89 Signed-off-by: kylezhao <kylezhao@tencent.com>
* | | | | | UploadPack: consume delimiter in object-info commandHan-Wen Nienhuys2023-02-021-1/+3
|/ / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The 'size' packet line is an argument, so it must be preceeded by a 0001 delimiter. See also git's t5701-git-serve.sh test, https://github.com/git/git/blob/8b8d9a2/t/t5701-git-serve.sh#L329 Without this fix, the server will choke on the delimiter line, saying PackProtocolException: unexpected <empty string> To test, I ran Gerrit locally with this fix $ curl -X POST -H 'git-protocol: version=2' -H 'content-type: application/x-git-upload-pack-request' -H 'accept: application/x-git-upload-pack-result' --data $'0018command=object-info\n00010009size\n0031oid d38b1b92bdb2893eb4505667375563f2d6d4086b\n0000' http://localhost:8080/git.git/git-upload-pack => 0008size0032d38b1b92bdb2893eb4505667375563f2d6d4086b 268590000 The same command completes identically on Gitlab (which supports the object-info command) $ curl -X POST -H 'git-protocol: version=2' -H 'content-type: application/x-git-upload-pack-request' -H 'accept: application/x-git-upload-pack-result' --data $'0018command=object-info\n00010009size\n0031oid d38b1b92bdb2893eb4505667375563f2d6d4086b\n0000' https://gitlab.com/gitlab-org/git.git/git-upload-pack => 0008size0032d38b1b92bdb2893eb4505667375563f2d6d4086b 268590000 In this case, the blob is for the COPYING file in the Git source tree, which is 26859 bytes long. Change-Id: Ief4ce1eb9303a3b2479547d7950ef01c7c28f472
* | | | | UploadPackTest: ensure UploadPack is closed to fix resource leakMatthias Sohn2022-11-211-37/+43
| | | | | | | | | | | | | | | | | | | | Change-Id: I4c8cf6041b4011934d338138d4531d190fdd6abb
* | | | | Fix boxing warnings in TransportTestMatthias Sohn2022-11-201-3/+3
| | | | | | | | | | | | | | | | | | | | Change-Id: I7e6dc845b89899cff262fab77c3977dbef5eea02
* | | | | Silence warnings about unclosed BasePackPushConnectionMatthias Sohn2022-11-201-0/+3
| | | | | | | | | | | | | | | | | | | | Change-Id: If52e8462e6222dd58d1004dd5ac174a27d96d098
* | | | | UploadPack: Receive and parse client session-idJosh Brown2022-11-023-0/+85
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | | | | TransferConfig: Move reading advertisesid setting into TransferConfigJosh Brown2022-11-021-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | | | | PushCommand: allow users to disable use of bitmaps for pushkylezhao2022-10-211-0/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | | | | PackParser: populate full size of the PackedObjectInfosIvan Frade2022-10-181-0/+118
|/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* / / / Fetch: add support for shallowRobin Müller2022-07-312-4/+41
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds support for shallow cloning. The CloneCommand and the FetchCommand now have the new methods setDepth, setShallowSince and addShallowExclude to tell the server that the client doesn't want to download the complete history. Bug: 475615 Change-Id: Ic80fb6efb5474543ae59be590ebe385bec21cc0d
* | | Fetch: Introduce negative refspecs.yunjieli2022-04-131-0/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Implement negative refspecs in JGit fetch, following C Git. Git supports negative refspecs in source only while this change supports them in both source and destination. If one branch is equal to any branch or matches any pattern in the negative refspecs collection, the branch will not be fetched even if it's in the toFetch collection. With this feature, users can express more complex patterns during fetch. Change-Id: Iaa1cd4de5c08c273e198b72e12e3dadae7be709f Sign-off-by: Yunjie Li<yunjieli@google.com>
* | | [sideband] Ensure last bit of progress channel is writtenThomas Wolf2022-03-191-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | If the last sideband progress message didn't end in \r or \n, there may still be a buffered message at the end of a fetch or push. Ensure that message gets written, too, even if it may be only partial. Bug: 575629 Change-Id: I38edccb5cffb89e00e468480b43c7d951fb63e8e Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* | | Add tests for SideBandInputStreamThomas Wolf2022-03-191-0/+212
|/ / | | | | | | | | Bug: 575629 Change-Id: I4591a64a2c07c7841417ec7a5c7883134ffda1be Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* | [push] support the "matching" RefSpecs ":" and "+:"Thomas Wolf2022-03-061-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The implementation of push.default=matching was not correct. It used the RefSpec "refs/heads/*:refs/heads/*", which would push _all_ local branches. But "matching" must push only those local branches for which a remote branch with the same name already exists at the remote. This RefSpec can be expanded only once the advertisement from the remote has been received. Enhance RefSpec so that ":" and "+:" can be represented. Introduce a special RemoteRefUpdate for such a RefSpec; it must carry through the fetch RefSpecs to be able to fill in the remote tracking updates as needed. Implement the expansion in PushProcess. Bug: 353405 Change-Id: I54a4bfbb0a6a7d77b9128bf4a9c951d6586c3df4 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* | [push] Call the pre-push hook later in the push processThomas Wolf2022-03-061-7/+64
| | | | | | | | | | | | | | | | | | | | Call the pre-push hook only after having received the remote advertisement and having determined rejections, like C git does. Also similar to C git, don't pass rejected or up-to-date updates to the pre-push hook. Bug: 578852 Change-Id: I51d379ea7bd8234ec815f8f4a9fa325816f476cf Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* | Support for git config push.defaultThomas Wolf2022-02-091-1/+59
| | | | | | | | | | | | | | | | Enhance the (unused!?) PushConfig; include a PushDefault enumeration. Add simple tests for this PushConfig. Bug: 351314 Change-Id: Ibc5656a2a1fccf70d00c5e15de8ed3dd8add6337 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>