aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Update list of 3rd party dependenciesMatthias Sohn2022-05-031-24/+26
| | | | Change-Id: I4f8f8ede8b4c788ce2b4db174df4cc1d35350542
* Add target platforms for eclipse 4.23 (2022-03) and 4.24 (2022-06)Matthias Sohn2022-05-034-0/+210
| | | | Change-Id: I6481a0e6e989b8ceefeecced0d7d8609a24d0c9f
* Update Orbit to I20220502200629Matthias Sohn2022-05-0215-33/+102
| | | | | | | and - com.jcraft.jzlib to 1.1.3.v20220502-1820 Change-Id: I7694f1b793f598c3adb96b5223a5f7b5783a35ec
* [sshd] Better user feedback on authentication failureThomas Wolf2022-05-0112-61/+586
| | | | | | | | | | | | | | | | | | | | | | | | | When authentication fails, JGit produces an exception with an error message telling the user that it could not log in (including the host name). The causal chain has an SshException from Apache MINA sshd with message "No more authentication methods available". This is not very helpful. The user was left without any indication why authentication failed. Include in the exception message a log of all attempted authentications. That way, the user can see which keys were tried, in which order and with which signature algorithms. The log also reports authentication attempts for gssapi-with-mic or password authentication. For keyboard-interactive Apache MINA sshd is lacking a callback interface. The way Apache MINA sshd loads keys from files, the file names are lost in higher layers. Add a mechanism to record on the session for each key fingerprint the file it was loaded from, if any. That way the exception message can refer to keys by file name, which is easier to understand by users than the rather cryptic key fingerprints. Bug: 571390 Change-Id: Ic4b6ce6b99f307d5e798fcc91b16b9ffd995d224 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* Lazy loading of .lfsconfig.Matthias Fromme2022-04-301-21/+41
| | | | | | | | Load the '.lfsconfig ' on access instead of trying to load it unconditionally each time an LFS filter is applied. Bug 578020 Change-Id: I986d4e61a736fc83cf00e62a08d8413c6bb53f78
* [releng] bump japicmp base versionThomas Wolf2022-04-251-1/+1
| | | | | | Bump the japicmp base version to 6.1.0.202203080745-r. Change-Id: I54a9ae339fbe2a3a02f438f794caa22c8cbcd02c Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* RefSpec: add missing @sinceThomas Wolf2022-04-251-0/+1
| | | | | | New API needs an @since 6.2 annotation. Change-Id: I16b01ea820cc651605166acc13591b515541d06b Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* De-couple ServiceLoader calls from class loadingThomas Wolf2022-04-142-28/+65
| | | | | | | | | Use the holder pattern to de-couple the loading of super classes from the ServiceLoader calls to set up global instances. This prevents potential lock inversions. Bug: 579550 Change-Id: Ie8284e4d6d680ddd4cc6a486bbefe8ed00266240 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* CommitCommand: call GpgSigner.getDefault() only if indeed signingThomas Wolf2022-04-141-8/+8
| | | | | | If we're not signing the commit, we don't need the GpgSigner at all. Change-Id: Ica35651c73d82b7604c8a67487b0d9474c908aae Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* GpgSigner: prevent class lock inversion on the default signerThomas Wolf2022-04-141-14/+30
| | | | | | | | | | | | | | Don't store the default signer in a static field of the abstract superclass GpgSigner. This many lead to a lock inversion on the class initialization locks if there are concurrent loads of the GpgSigner class and of one of its subclasses, and that subclass happens to be the one the ServiceLoader wants to load. Use the holder pattern to de-couple the loading of class GpgSigner from the ServiceLoader call. Bug: 579550 Change-Id: Ifac0ea0c8985a09fe0518d0dabc072fafd6db907 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* Fetch: Introduce negative refspecs.yunjieli2022-04-137-8/+211
| | | | | | | | | | | | | | | 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>
* Merge "Add GetRefsBenchmark for testing refs lookups"Han-Wen NIenhuys2022-04-051-0/+181
|\
| * Add GetRefsBenchmark for testing refs lookupsLuca Milanesio2022-04-011-0/+181
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Introduce a new benchmark that shows a typical use-case of opening a cached repository and fetching one ref from a repository with a high number of refs. This specific benchmark is tailored to the Gerrit use-case of reading frequently individual refs SHA1s and by ref-name prefix from the All-Users repository. Include the following variables for the benchmark: - numBranches (from 100 up to 50000) - trustFolderStat (true or false) - useRefTable (true or false) The benchmark needs to be evaluated on a local high-perf SSD and on a slower NFS network disk. Bug: 576165 Change-Id: Ie59a87ca9f0191ff30229688e3430332e2f59a4f
* | BaseSearch: Suppress ReferenceEquality WarningsFabio Ponciroli2022-04-021-0/+1
| | | | | | | | | | | | | | | | Errorprone raises the following warning: "[ReferenceEquality] Comparison using reference equality instead of value equality" Change-Id: Ib7542506dcdf5a0c7775a99a2c0972930d622879
* | RewriteGenerator: Suppress ReferenceEquality WarningsFabio Ponciroli2022-04-011-0/+1
| | | | | | | | | | | | | | | | Errorprone raises the following warning: "[ReferenceEquality] Comparison using reference equality instead of value equality" Change-Id: Idfe3f044730019fb49dccee25a0563c6fc01fc6a
* | PlotCommit: Suppress ReferenceEquality WarningsFabio Ponciroli2022-04-011-0/+1
| | | | | | | | | | | | | | | | Errorprone raises the following warning: "[ReferenceEquality] Comparison using reference equality instead of value equality" Change-Id: Ia0dc2df68c77e40ff509a2c39568abce92525ee9
* | PlotCommitList: Suppress ReferenceEquality WarningsFabio Ponciroli2022-04-011-0/+4
|/ | | | | | | | | | | | Errorprone raises the following warning: "[ReferenceEquality] Comparison using reference equality instead of value equality" A single pointer comparison is fine here. A comparison with 'equals' would complicate the code and also impact performance. Change-Id: I6677dfc483acb95a64afbf433fd2b9460e408264
* [pgm tests] Relax version constraints for hamcrestMatthias Sohn2022-03-301-1/+1
| | | | | | | | We updated hamcrest to 2.2. but there is no need to prevent that older versions of hamcrest can be used. Hence relax the lower bound to 1.1 like in other bundles. Change-Id: I3f2f270d2aabc7d742a585d2fc7f0bce283e2a64
* Use git config core.commentCharThomas Wolf2022-03-267-34/+258
| | | | | | | | | | | | | This concerns committing, creating merge conflict messages and creating and editing squash messages. In a squash message, once the comment character has been determined initially is always the first character. Note that if core.commentChar=auto and there is a sequence of squashes, it may be necessary to change the comment character when a new message is added. Bug: 579325 Change-Id: Idca19284a0240cd322e7512ea299a03658e1b2c1 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* CommitConfig: add support for core.commentCharThomas Wolf2022-03-263-2/+190
| | | | | | | | | Provide access to the core.commentChar git config, and provide a utility method to determine an unused comment character if the setting is "auto". Bug: 579325 Change-Id: I1ec7e4deffea6ac5929a8538a624d73bb59e4ecc Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* [push, lfs] Tell the pre-push hook whether the push is a dry runThomas Wolf2022-03-233-5/+31
| | | | | | | | | | | | | | | | | | | | | | | | This is a feature that does not exist in C git: an external pre-push hook doesn't know whether the push is run as a dry run. But for internal hooks written in Java it is entirely possible to give a hook this information. In JGit with its internal LFS implementation, this enables us to not perform LFS uploads in a dry run. This is kind of important because EGit frequently does a dry-run before doing the actual push to give the user a way to review what would be pushed before it actually happens. Doing an LFS upload of potentially huge files during a dry-run is wasteful, makes the dry run not actually a dry run, and leads to uploading the same file twice if followed by a real push. Use the information in the LfsPrePushHook to only do the initial call to the LFS server, but then skipping the actual upload if the push is a dry run. That way, a failure to contact the LFS server leads to an error in the dry run, as it should. Bug: 546567 Change-Id: I155430f27c4979d91096ba72fd95c3775dd3f28b Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* Merge changes I5df54a92,Iecc61d1cMatthias Sohn2022-03-224-52/+154
|\ | | | | | | | | | | * changes: LsRemoteCommand: apply url.*.insteadOf Factor out URL replacement from RemoteConfig
| * LsRemoteCommand: apply url.*.insteadOfThomas Wolf2022-03-152-6/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If LsRemoteCommand is used without repository, the remote URI was not translated. If the git user config contains e.g. [url "ssh://git@github.com/"] insteadOf = https://github.com/ and LsRemoteCommand is called with an HTTPS GitHub repository URL, the command should actually rewrite this to an SSH URI and use the SSH transport. Actually this same problem may exist everywhere Transport is used with an URIish instead of with a remote name. However, doing this translation in Transport.open(URIish) and in Transport.open(Repository, URIish, String) if no remote name is given would change the behavior and might break assumptions made in existing clients. For instance, EGit's PushOperation assumes that the URI obtained from PushResult.getURI() was the same as was passed in to Transport.open(Repository, URIish). URIs obtained from a RemoteConfig have this translation applied transparently, and in Transport we cannot know for sure whether or not a URI has already been translated, if needed. So doing this in Transport might also lead to translating URIs twice. Therefore this commit does the translation in LsRemoteCommand, where we can be sure that it won't affect other use cases. If other cases besides LsRemoteCommand are found where such a URI translation is missing, it'll have to be done at higher levels, possibly even in client code directly. Bug: 544769 Change-Id: I5df54a925d30b55d98e21f37f2851fe79649b064 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
| * Factor out URL replacement from RemoteConfigThomas Wolf2022-03-152-46/+124
| | | | | | | | | | | | | | Add a new UrlConfig that encapsulates the basic URL replacement logic for git configs url.<base>.insteadOf and pushInsteadof. Change-Id: Iecc61d1c5e6089533552afa1d1e684ae72393b38 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* | LFS: clean up messagesThomas Wolf2022-03-212-4/+2
| | | | | | | | | | | | Remove an unused message, and remove unnecessary quotes. Change-Id: I9da3eeb3db33324fa07bebd434bca3c0a4da27ab Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* | DirCacheCheckout: use a LinkedHashMap instead of HashMapThomas Wolf2022-03-192-10/+2
| | | | | | | | | | | | | | | | | | | | | | This guarantees that updates are checked out in git order, which is important for LFS if a .lfsconfig file is used. That file comes early in git order, and the LFS smudge filter will consider the working tree version. To ensure that on branch switches the correct version of that file is used, the checkout order must be stable and should be the git order. Change-Id: I20f6d11bf08558f9d5adfd2be71e36321460038c Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* | Re-try reading a file when there are concurrent writesThomas Wolf2022-03-193-107/+168
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Git and JGit are very careful to replace git files atomically when writing. The normal mechanism for this is to write to a temporary file and then to rename it atomically to the final destination. This works fine on POSIX-compliant systems, but on systems where renaming may not be atomic, exceptions may be thrown if code tries to read the file while the rename is still ongoing. This happens in particular on Windows, where the typical symptom is that a FileNotFoundException with message "The process cannot access the file because it is being used by another process" is thrown, but file.isFile() == true at the same time. In FileBasedConfig, a re-try was already implemented for this case. But the same problem can also occur in other places, for instance in RefDirectory when reading loose or packed refs. Additionally, JGit has similar re-tries when a stale NFS file handle is detected, but that mechanism wasn't used consistently (only for git configs and packed refs, but not for loose refs). Factor out the general re-try mechanism for reading into a new method FileUtils.readWithRetry() and use that in all three places. The re-try parameters are hardcoded: at most 5 times for stale NFS handles, and at most 5 times with increasing backoff delays (50, 100, 200, 400, and 800ms) for the above concurrent write case. Bug: 579116 Change-Id: If0c2ad367446d3c0f32b509274cf8e814aca12cf Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* | [sideband] Ensure last bit of progress channel is writtenThomas Wolf2022-03-194-7/+56
| | | | | | | | | | | | | | | | | | 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>
* | WinPipeConnector: Resolve warnings by using "equals" instead of "=="Fabio Ponciroli2022-03-171-1/+1
|/ | | | | | | Errorprone raises the following warning: "[ReferenceEquality] Comparison using reference equality instead of value equality". Change-Id: Ic73305b2af628f66e7659ea1b839b3a640e3cd8d
* Fix MANIFEST.MF in the LFS bundlesThomas Wolf2022-03-122-0/+2
| | | | | | | Somehow new dependencies added in commit a229072f got lost when merging stable-6.1 into master. Change-Id: I19c16c6be73d07e05f37241a44cf25133ff467a5 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* Update Tycho to 2.6.0Matthias Sohn2022-03-092-2/+2
| | | | Change-Id: Ic8b2b352721040ccc0164cf0c8637102518e5ce9
* Merge branch 'stable-6.1'Matthias Sohn2022-03-0929-358/+1808
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-6.1: Prepare 6.1.1-SNAPSHOT builds JGit v6.1.0.202203080745-r [checkout] Use .gitattributes from the commit to be checked out Don't use final for method parameters [push] support the "matching" RefSpecs ":" and "+:" [push] Call the pre-push hook later in the push process IndexDiff: use tree filter also for SubmoduleWalk Run license check with option -Ddash.projectId=technology.jgit Exclude transitive dependencies of sshd-sftp Update DEPENDENCIES for 6.1.0 release Add dependency to dash-licenses Fix typos of some keys in LfsText Sort LfsText entries alphabetically Support for "lfs.url" from ".lfsconfig" Change-Id: I1b9f0c0ed647837e00b9640d235dbfab2329c5a6
| * Prepare 6.1.1-SNAPSHOT buildsMatthias Sohn2022-03-0891-527/+527
| | | | | | | | Change-Id: Ifc80355025d8459245843be1c24dc5a286913e77
| * JGit v6.1.0.202203080745-rv6.1.0.202203080745-rMatthias Sohn2022-03-0891-125/+125
| | | | | | | | | | Change-Id: I8766ed400020c9571f321bbbfe34b0688af0107d Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| * [checkout] Use .gitattributes from the commit to be checked outThomas Wolf2022-03-077-145/+489
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | JGit used only one set of attributes constructed from the global and info attributes, plus the attributes from working tree, index, and HEAD. These attributes must be used to determine whether the working tree is dirty. But for actually checking out a file, one must use the attributes from global, info, and *the commit to be checked out*. Otherwise one may not pick up definitions that are only in the .gitattributes of the commit to be checked out or that are changed in that commit with respect to the attributes currently in HEAD, the index, or the working tree. Maintain in TreeWalk different Attributes per tree, and add operations to determine EOL handling and smudge filters per tree. Use the new methods in DirCacheCheckout and ResolveMerger. Note that merging in JGit actually used the attributes from the base, not those from ours, which looks dubious at least. It now uses those from ours, and for checking out the ones from theirs. The canBeContentMerged() determination was also done from the base attributes, and is newly done from the ours attributes. Possibly this should take into account all three attributes, and only if all three agree the item can be content merged, a content merge should be attempted? (What if the binary/text setting changes between base, ours, or theirs?) Also note that JGit attempts to perform content merges on non-binary LFS files; there it used the filter attribute from base, too, even for the ours and theirs versions. Newly it takes the filter attribute from the correct tree. I'm not convinced doing content merges on potentially huge files like LFS files is really a good idea. Add tests in FilterCommandsTest and LfsGitTest to verify the behavior. Open question: using index and working tree as fallback for the attributes of ours (assuming it is HEAD) is OK. But does it also make sense for base and theirs in merging? Bug: 578707 Change-Id: I0bf433e9e3eb28479b6272e17c0666e175e67d08 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
| * Don't use final for method parametersMatthias Sohn2022-03-063-20/+14
| | | | | | | | | | | | See https://wiki.eclipse.org/EGit/Contributor_Guide#Use_of_the_.22final.22_modifier Change-Id: Idc6ed85483e381689e5085c4a1bacd75d26f5489
| * [push] support the "matching" RefSpecs ":" and "+:"Thomas Wolf2022-03-067-74/+341
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-063-22/+107
| | | | | | | | | | | | | | | | | | | | 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>
| * IndexDiff: use tree filter also for SubmoduleWalkThomas Wolf2022-03-062-0/+32
| | | | | | | | | | | | | | | | | | The only uses of IndexDiff.setFilter() in JGit and EGit set a path filter. Passing the filter on to the SubmoduleWalk gives the desired result, which is consistent with command-line git. Bug: 565251 Change-Id: I8eca1ed73eb1d237b8785f369352f72af9e0e168 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
| * Run license check with option -Ddash.projectId=technology.jgitMatthias Sohn2022-03-041-2/+2
| | | | | | | | | | | | This ensures that works-with-dependencies are attributed properly. Change-Id: Ie41733cdecc83ae0b532fb4bd9f692bc09e16107
| * Exclude transitive dependencies of sshd-sftpMatthias Sohn2022-03-042-0/+20
| | | | | | | | | | | | | | | | | | We don't need the dependencies of sshd-sftp to sshd-common and sshd-core since they are contained in sshd-osgi. Excluding them helps the dash IP log tool to not list them as required dependencies of jgit. Change-Id: I85bce4dca1b99ba880cf3e909fac9669c75e7854
| * Update DEPENDENCIES for 6.1.0 releaseMatthias Sohn2022-03-031-53/+52
| | | | | | | | Change-Id: I9ea925bd444952dc204e2538b9d16fe631202e0c
| * Add dependency to dash-licensesMatthias Sohn2022-03-031-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is required to run the license check using the license tool [1] required by the Eclipse project handbook [2]: mvn org.eclipse.dash:license-tool-plugin:license-check -Ddash.summary=DEPENDENCIES Note: the tool still requires Java 11 hence it needs to be run in a separate build step and is not yet integrated in the build which runs on Java 8. [1] https://github.com/eclipse/dash-licenses [2] https://www.eclipse.org/projects/handbook/#ip-license-tool Change-Id: Ib41d54de246c3c9499cc3be9f026294c39fdfd99
| * Fix typos of some keys in LfsTextMatthias Sohn2022-03-034-6/+6
| | | | | | | | Change-Id: I86dee0b68e627e26cbd29976162bc7b953ebf276
| * Sort LfsText entries alphabeticallyMatthias Sohn2022-03-032-18/+17
| | | | | | | | Change-Id: I3021cb246b51d861d51258808c75d5c6843ec82d
| * Support for "lfs.url" from ".lfsconfig"Matthias Fromme2022-03-039-31/+737
| | | | | | | | | | | | | | | | | | | | | | - New class LfsConfig to enrich repository configuration by settings from ".lfsconfig" file respecting configuration file precedence. - Adapted LfsConnectionFactory to use LfsConfig instead of directly using configuration from repository to calculate url of the lfs repository Bug: 578020 Change-Id: I156f4ec137c2e428136a2ca9b8a4011ecee2d915
* | Refer to target platform as fileMichael Keppler2022-03-072-33/+1
| | | | | | | | | | | | | | | | Since Tycho 2.3 the target platform can be referenced as file, without using Maven coordinates. Signed-off-by: Michael Keppler <Michael.Keppler@gmx.de> Change-Id: I120223dd3dc740fdff13a69201624b4cdc02c6f6
* | Prepare 6.2.0-SNAPSHOT buildsMatthias Sohn2022-03-0391-525/+525
| | | | | | | | Change-Id: Ic2dde88bee3242169d6fa50956f8938f3fc4ba8e
* | Merge branch 'stable-6.1'Matthias Sohn2022-03-0213-20/+20
|\| | | | | | | | | | | | | | | | | | | | | * stable-6.1: Update Orbit to R20220302172233 for 2022-03 Prepare 6.1.0-SNAPSHOT builds JGit v6.1.0.202203021511-rc1 Prepare 6.1.0-SNAPSHOT builds JGit v6.1.0.202202221755-m3 Change-Id: Iff4b13ca8ae5e13a3f2f45c0d4653405f1ceb2f4