aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* [test] Fix closing of test repositoriesNail Samatov2022-01-3021-14/+65
| | | | | | | | | | | | | | | | Fix tests failing on Windows because Repository instance is created but not closed on tear down. Fix repositories closed twice, except in tests that test this behavior explicitly. Name the temporary directories the tests run in after the test method; that makes it easier to figure out in which tests repositories are closed twice if it should occur again in the future. Bug: 550111 Change-Id: I9398b58f0f36d2c29236d2a9a8599117d9083980 Signed-off-by: Nail Samatov <sanail@yandex.ru> Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* [test] DirCacheCheckoutTest: fix test expectation for eol=nativeThomas Wolf2022-01-301-5/+6
| | | | | | | | | With eol=native, we expect LF on Unixes, and CR-LF on Windows. One test didn't account for this and always expected LF, and thus failed on Windows. Bug: 550111 Change-Id: I69354ac691c464d1b6003812ddb4510c5ab5e77a Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* ObjectWalk: close ObjectReader on close() if neededThomas Wolf2022-01-302-4/+8
| | | | | | | | | | If the walk is created via ObjectWalk(Repository), it creates a new ObjectReader. This reader was closed only on dispose(). If such an ObjectWalk was used in a try-with-resource statement the reader might not get closed. Bug: 578458 Change-Id: I1be31829dc466530f23006a53c29b657fd5fb410 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* [test] Fix a Windows-only test in CheckoutCommandTestThomas Wolf2022-01-301-1/+1
| | | | | | | | Test.txt should not be in the "removed" list if it can't be deleted but only in the "not deleted" list. The test was wrong. Bug: 550111 Change-Id: I3ecede4278014c15015c8c24089647fa3db3742f Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* [test] Fix ApplyCommandTest for WindowsThomas Wolf2022-01-301-3/+11
| | | | | | | | | | | Some tests checked whether or not a file is executable via java.io.File.canExecute(). But that always returns true on Windows. Use FS.DETECTED.canExecute() instead, and guard all such assertions to run only of file systems that do support the "execute" flag. Bug: 550111 Change-Id: Iacb9e414b612359fcecb61312c3dfb830801cd36 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* [test] Fix OpenSshConfigFileTest for WindowsThomas Wolf2022-01-301-21/+28
| | | | | | | | | | | | | | The tests assumed that a path like "/tmp" was an absolute path, and also compared against strings with forward slashes. On Windows, "/tmp" is not an absolute path and thus resolved against the current directory, and the separator is a backslash. Change the tests to use ~/ notation, and test paths resolved against the (mocked) user home directory. That way, the tests are independent of the file system used. Bug: 550111 Change-Id: I1c31608ca83c8d8586256d1586a792e4a33cfaa4 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* BinaryHunkInputStream: accept CR-LFThomas Wolf2022-01-301-2/+6
| | | | | | | | Let's be lenient and accept hunk lines terminated by CR-LF, too, not just lines terminated by LF. Bug: 550111 Change-Id: I7f796df666300ab56cc6c07f22eda45fbf4c941e Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* sshd: Add README.md for SSH agentsThomas Wolf2022-01-302-0/+129
| | | | | | | | Explain SSH agent protocols, what transports are available and how to choose them in ~/.ssh/config. For Windows, add some information on which commonly used SSH agents can be used. Change-Id: I0b08a95654fd76643512606edb1ed74d9980aa85 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* sshd: support the ConnectTimeout ssh configThomas Wolf2022-01-302-1/+15
| | | | | | Parse the value from the ssh config and if set use it when connecting. Change-Id: I85b44c9468a5027602375706612c46ea7a99b2bd Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* sshd: Skip unknown keys from the SSH agentThomas Wolf2022-01-304-6/+57
| | | | | | | | | | | | An SSH agent might contain keys that Apache MINA sshd cannot handle. Pageant for instance can contain ed448 keys, which are not implemented in OpenSSH or in Apache MINA sshd. When an agent delivers such keys, simply skip (and log) them. That way, we can work with the remaining keys. Otherwise a single unknown key in the agent would break pubkey authentication. Change-Id: I3945d932c7e64b628465004cfbaf10f4dc05f3e4 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* sshd: support the AddKeysToAgent ssh configThomas Wolf2022-01-308-22/+542
| | | | | | | | | | Add parsing of the config. Implement the SSH agent protocol for adding a key. In the pubkey authentication, add keys to the agent as soon as they've been loaded successfully, before even attempting to use them for authentication. OpenSSH does the same. Bug: 577052 Change-Id: Id1c08d9676a74652256b22281c2f8fa0b6508fa6 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* sshd: handle "IdentityAgent SSH_AUTH_SOCK" in ssh configThomas Wolf2022-01-305-11/+24
| | | | | | | | | OpenSSH has (for legacy reasons?) the option of specifying the default environment variable directly, instead of using ${SSH_AUTH_SOCK}. Make sure the plain variable name is not taken as a relative path name. Bug: 577053 Change-Id: If8f550dffc43887254f71aa0b487c50fa14d0627 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* sshd: Connector for the Win32-OpenSSH SSH agentThomas Wolf2022-01-306-5/+259
| | | | | | | | | Win32-OpenSSH uses a named Windows pipe for communication. Implement a connector for this mechanism using JNA. Choose the appropriate connector based on the setting of the 'identityAgent' parameter. Bug: 577053 Change-Id: I205f07fb33654aa18ca5db92706e65544ce38641 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* sshd: handle IdentitiesOnly with an SSH agentThomas Wolf2022-01-303-32/+138
| | | | | | | | | | | | | | | | | If an SSH agent is used but "IdentitiesOnly yes" is set, only those keys from the agent that correspond to one of the keys explicitly given via an IdentityFile directive are to be used. Implement this by filtering the list of keys obtained from the agent against the list of IdentityFiles, each entry suffixed with ".pub". Load the public keys from these files, and ignore all other keys from the agent. Keys without ".pub" file are also ignored. Apache MINA sshd has no operation to load only the public key from a private key file, so we have to rely on *.pub files. Bug: 577053 Change-Id: I75c2c0b3ce35781c933ec2944bd6da1b94f4caf9 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* sshd: support IdentityAgent configThomas Wolf2022-01-304-9/+28
| | | | | | | | | Handle the 'none' value, and change the value to select Pageant to something that looks like an absolute UNC path name to avoid it's handled as an relative path name. Bug: 577053 Change-Id: I4ccf047abbc1def50e2782319e4fa7c744069401 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* LFS: Fix error occurring during delete branchNail Samatov2022-01-272-0/+19
| | | | | | | | | | | | | | | | | Fix TransportException occurring when deleting a branch and push that change to remote repository if BuiltinLFS is used to work with repository. When finding LFS pointers in RemoteRepUpdate, LfsPrePushHook fails to open ObjectReader with new object id equal to ObjectId.zeroId(). If update is a deleting update (new object id is zero id), we can assume that this update doesn't contain LFS Pointer and we can skip step with extracting LFS pointer for that RemoteRefUpdate. Bug: 578313 Change-Id: Ic4367978338b8234d39d9af0d9674490f79fc22d Signed-off-by: Nail Samatov <sanail@yandex.ru>
* Merge "PackOutputStream: Extract cancellation and digest to superclass"Ivan Frade2022-01-273-72/+229
|\
| * PackOutputStream: Extract cancellation and digest to superclasskylezhao2022-01-273-72/+229
| | | | | | | | | | | | | | | | | | | | Checking the cancelled status and keeping a digest of the written data is useful for other output streams. e.g. to write commit-graphs. Pull up that functionality to a superclass, so it can be reused. Change-Id: I177b50be09c4ea631e7a144cc6127085ec2ca411 Signed-off-by: kylezhao <kylezhao@tencent.com>
* | Bazel: Include bazel resource configuration file for RBE buildDavid Ostrovsky2022-01-221-0/+2
| | | | | | | | | | | | | | In I988f61e34 tools/remote-bazelrc was added, but this resource file wasn't imported from main resource file workspace/.bazelrc. Change-Id: Ie0c2f128fbccaa6f9e99ad29a3a76ac294f3cd29
* | Merge "DFS block cache: report index load and evict stats"Ivan Frade2022-01-213-4/+279
|\ \
| * | DFS block cache: report index load and evict statsAlina Djamankulova2022-01-213-4/+279
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Enhance cache performance monitoring for large data such as pack and bitmap indexes. Provide details about what is loaded and evicted from cache like total number of cache hits, time in cache before eviction. Add a custom consumer to report loading events and eviction events when enabled. Signed-off-by: Alina Djamankulova <adjama@google.com> Change-Id: I5739325db7ff7ec370e4defd8f7e46f1c3f5d2dd
* | | Bazel: Add RBE supportDavid Ostrovsky2022-01-203-0/+89
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The Bazel build can be used with Google's Remote Build Execution. This needs the following setup steps: $ gcloud auth application-default login $ gcloud services enable remotebuildexecution.googleapis.com --project=${PROJECT} Create a worker pool. The instances should have at least 4 CPUs each for adequate performance. $ gcloud alpha remote-build-execution worker-pools create default \ --project=${PROJECT} \ --instance=default_instance \ --worker-count=50 \ --machine-type=e2-standard-4 \ --disk-size=200 To use RBE, execute $ bazel test --config=remote \ --remote_instance_name=projects/${PROJECT}/instances/default_instance \ //... Change-Id: I988f61e342dab2136d8752ace945a4ed91a4189a
* | | Bazel: Switch to using toolchain resolution for java rulesDavid Ostrovsky2022-01-204-4/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Bump Bazel version to release 5.0.0. In this new Bazel release, --incompatible_use_toolchain_resolution_for_java_rules is flipped, that means that the build must be adapted to toolchain resolution. Specification toolchain resolution for java rules is here: [1]. Main tracking Bazel issue is here: [2]. Given that new Bazel release also added support for remote JDK 17, add experimental support for building with remote JDK 17 to produce major byte code version 61. Test Plan: To build with remote JDK 11 run: $ bazel build :all To build with remote JDK 17 run: $ bazel build --config java17 :all [1] https://docs.google.com/document/d/1MVbBxbKVKRJJY7DnkptHpvz7ROhyAYy4a-TZ-n7Q0r4/edit?usp=sharing [2] https://github.com/bazelbuild/bazel/issues/7849 Change-Id: I8d26dff722c6677ea7642913b61e416b23ea9041
* | | Bazel: Simplify java 11 toolchain definitionDavid Ostrovsky2022-01-201-20/+2
| | | | | | | | | | | | | | | | | | Also remove unused JDK9_JVM_OPTS constant. Change-Id: I0f45ca8312a2a8c3aee3855e3ef3afa95808b4ad
* | | Bazel: Format build files with buildifierDavid Ostrovsky2022-01-203-4/+4
| | | | | | | | | | | | Change-Id: I1ff38237058d11a3f61acc881c504382ff4b7e08
* | | Bazel: Remove JDK 15 toolchain definitionDavid Ostrovsky2022-01-201-28/+0
| | | | | | | | | | | | | | | | | | | | | Java 15 is outdated and the recent Bazel releases added support to JDK 17. Change-Id: I68c1f5b5132d844f07bfefc22f81ecf0a19df910
* | | Bazel: Remove version checkDavid Ostrovsky2022-01-202-32/+0
| | | | | | | | | | | | | | | | | | | | | Recent Bazel releases perform Bazel version check, based on .bazelversion file. Change-Id: I92d5daaef8ecbd011517d314564c0f5492c8ea75
* | | ExternalToolTest: Rename class name to usual name for test casesDavid Ostrovsky2022-01-203-3/+3
| | | | | | | | | | | | Change-Id: I00e4a5e73f530b7ac671d09b9b447bb24d6419fa
* | | Bazel: Add missing java packages to error_prone package groupDavid Ostrovsky2022-01-201-3/+8
| | | | | | | | | | | | Change-Id: I709a3cd2639e9209b2c92c700e04ab4c90ed0524
* | | Adapt junit_tests invocation to removal of resource_jars attributeDavid Ostrovsky2022-01-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In upcoming Bazel release 5.0 resource_jars attribute was removed: [1]. Replace resource_jars with runtime_deps as recommended in the release notes. [1] https://github.com/bazelbuild/bazel/issues/13221 Change-Id: Iab834d647cf63259ca182adc1f862b6001db0cce
* | | Update orbit to I20220111151929Matthias Sohn2022-01-1915-103/+103
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | and update - com.google.gson to 2.8.9.v20220111-1409 - org.bouncycastle.bcpg to 1.70.0.v20220105-1522 - org.bouncycastle.bcpkix to 1.70.0.v20220105-1522 - org.bouncycastle.bcprov to 1.70.0.v20220105-1522 - org.bouncycastle.bcutil to 1.70.0.v20220105-1522 Change-Id: I7d9159e0e8524459a11da84cb2db709cb1f0823d
* | | Update org.apache.maven.wagon:wagon-ssh to 3.5.1Matthias Sohn2022-01-191-1/+1
| | | | | | | | | | | | Change-Id: I90807ef1ae065a8a8559e445c0aa7e2abdd2b9a8
* | | Update org.eclipse.jdt:ecj to 3.28.0Matthias Sohn2022-01-191-1/+1
| | | | | | | | | | | | Change-Id: I7573d8cfd07038bca4a7ed9e122e5dcf666632f8
* | | Update org.osgi:org.osgi.core to 6.0.0Matthias Sohn2022-01-191-1/+1
| | | | | | | | | | | | Change-Id: If93e0e8769fcbb92befa1f159f48b0ac6b6f3d24
* | | [errorprone] Fix implicit use of platform default charsetMatthias Sohn2022-01-191-1/+3
| | | | | | | | | | | | Change-Id: I42f893c4248d8b00bf4aaf59cd528c43940f99e2
* | | [bazel] Fix build of ExternalDiffToolTestMatthias Sohn2022-01-191-0/+1
| | | | | | | | | | | | Change-Id: Ida4721142f49c86aa3f05aeffc6ca0aef40939f9
* | | Let org.eclipse.jgit.pgm use BooleanTriStateMatthias Sohn2022-01-191-1/+2
| | | | | | | | | | | | Change-Id: I575cd5e1ecd326514a8bb4c36a86a2dc71ba5457
* | | Merge branch 'stable-6.0'Matthias Sohn2022-01-197-29/+74
|\ \ \ | |_|/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | * stable-6.0: [bazel] Skip ConfigTest#testCommitTemplatePathInHomeDirecory [errorprone] Fix InfiniteRecursion error in RecordingLogger [errorprone] Suppress Finally error in ObjectDownloadListener [errorprone] Fix implicit use of default charset in FileBasedConfigTest [errorprone] Suppress FutureReturnValueIgnored in FileRepository#autoGc Change-Id: I08d58c8f3f04e3a920da43b5fb252b1654c2b33c
| * | Merge changes I6a22f37f,I092389e4,I20af1d8d,I83332efc into stable-6.0Matthias Sohn2022-01-196-29/+73
| |\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | * changes: [bazel] Skip ConfigTest#testCommitTemplatePathInHomeDirecory [errorprone] Fix InfiniteRecursion error in RecordingLogger [errorprone] Suppress Finally error in ObjectDownloadListener [errorprone] Fix implicit use of default charset in FileBasedConfigTest
| | * | [bazel] Skip ConfigTest#testCommitTemplatePathInHomeDirecoryMatthias Sohn2022-01-183-26/+62
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Move this test to another class and skip it when running tests with bazel since the bazel test runner does not allow to create files in the home directory. FS#userHome retrieves the home directory on the first call and caches it for subsequent calls to avoid overhead in case path translation is required (currently on cygwin). This prevents that the test can mock the home directory using MockSystemReader like SshTestHarness does. Change-Id: I6a22f37f4a19eb4b4935509eae508a23e56db7aa
| | * | [errorprone] Fix InfiniteRecursion error in RecordingLoggerMatthias Sohn2022-01-181-1/+5
| | | | | | | | | | | | | | | | Change-Id: I092389e428232a4fe7613d846c288d285ae9102c
| | * | [errorprone] Suppress Finally error in ObjectDownloadListenerMatthias Sohn2022-01-181-0/+1
| | | | | | | | | | | | | | | | Change-Id: I20af1d8d931608e93fbc52e127f1b7bafd2f917c
| | * | [errorprone] Fix implicit use of default charset in FileBasedConfigTestMatthias Sohn2022-01-181-2/+5
| | | | | | | | | | | | | | | | Change-Id: I83332efc498a5bce242915a1eec2346e6e1f58fd
| * | | Merge "[errorprone] Suppress FutureReturnValueIgnored in ↵Matthias Sohn2022-01-191-0/+1
| |\| | | | | | | | | | | | | | FileRepository#autoGc" into stable-6.0
| | * | [errorprone] Suppress FutureReturnValueIgnored in FileRepository#autoGcMatthias Sohn2022-01-181-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Ignore the FutureReturnValueIgnored warning for the unused return value of #gc. Change-Id: I4e7a2f85d404962c01726f9a1d079fe4a6430a1b
* | | | Merge branch 'stable-6.0'Matthias Sohn2022-01-184-3/+63
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-6.0: UploadPack v2 protocol: Stop negotiation for orphan refs Complete update to servlet api 4.0.0 Change-Id: I55ab6e8fd4a76e4313e37b12f9fc5d5e4b84a681
| * | | Merge branch 'stable-5.13' into stable-6.0Matthias Sohn2022-01-182-0/+60
| |\ \ \ | | |/ / | |/| | | | | | | | | | | | | | | | | | * stable-5.13: UploadPack v2 protocol: Stop negotiation for orphan refs Change-Id: I6a9ed8338ffbf5363e48d640a2c4209e4e503549
| | * | Merge branch 'stable-5.12' into stable-5.13Matthias Sohn2022-01-182-0/+60
| | |\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-5.12: UploadPack v2 protocol: Stop negotiation for orphan refs Change-Id: Ib43068c32d9cb8effe4b873396391dc3c9197a6e
| | | * \ Merge branch 'stable-5.11' into stable-5.12Matthias Sohn2022-01-182-0/+60
| | | |\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-5.11: UploadPack v2 protocol: Stop negotiation for orphan refs Change-Id: I5db432bd416cfa8d3dd295bdce63e31d5f160a8a
| | | | * | UploadPack v2 protocol: Stop negotiation for orphan refsMarcin Czech2022-01-182-0/+60
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The fetch of a single orphan ref (for example Gerrit meta ref: refs/changes/21/21/meta) did not stop the negotiation so client had to advertise all refs. This impacts the fetch performance on repositories with a large number of refs (for example on Gerrit repository it takes 20 seconds to fetch meta ref comparing to 1.2 second to fetch ref with parent). To avoid this issue UploadPack, used on the server side, now checks if all `want` refs have parents, if not this means that client doesn't need any extra objects, hence the server responds with `ready` and finishes the negotiation phase. Bug: 577937 Change-Id: Ia3001b400b415d5cf6aae45e72345ca08d3af058