summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test
Commit message (Collapse)AuthorAgeFilesLines
* Prepare 5.2.2-SNAPSHOT buildsMatthias Sohn2018-12-272-51/+51
| | | | | Change-Id: I9487f6a59ed684ad13bcfbff7d6c730ae4f37030 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* JGit v5.2.1.201812262042-rv5.2.1.201812262042-rMatthias Sohn2018-12-272-2/+2
| | | | | Change-Id: Idfefc54e898f364407a931b787a26db2489b031c Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Merge branch 'stable-5.1' into stable-5.2Jonathan Nieder2018-12-261-28/+15
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-5.1: UploadPack: Avoid calling AdvertiseRefsHook twice Prepare 5.1.5-SNAPSHOT builds JGit v5.1.4.201812251853-r UploadPack: Filter refs used for want-ref resolution UploadPack: Defer want-ref resolution to after parsing Call AdvertiseRefsHook for protocol v2 Prepare 4.11.7-SNAPSHOT builds JGit v4.11.6.201812241910-r Prepare 4.9.9-SNAPSHOT builds JGit v4.9.8.201812241815-r UploadPack: Test filtering by AdvertiseRefsHook in stateless transports Prepare 4.7.8-SNAPSHOT builds JGit v4.7.7.201812240805-r Fix feature versions imported by feature org.eclipse.jgit.pgm Prepare 4.5.6-SNAPSHOT builds JGit v4.5.5.201812240535-r Call AdvertiseRefsHook before validating wants Change-Id: I5879df9b723a0dbf6a1eff89a34bbb269f3b773d Signed-off-by: Jonathan Nieder <jrn@google.com>
| * Prepare 5.1.5-SNAPSHOT buildsMatthias Sohn2018-12-262-47/+47
| | | | | | | | | | Change-Id: I3eeb24b01a4f955e7e933238defb42635ebfec7d Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| * JGit v5.1.4.201812251853-rv5.1.4.201812251853-rMatthias Sohn2018-12-262-2/+2
| | | | | | | | | | Change-Id: I30ba167bcd8144074553d7446a45fa6be19584fe Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| * UploadPack: Defer want-ref resolution to after parsingJonathan Nieder2018-12-261-30/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ProtocolV2Parser explains: // TODO(ifrade): This validation should be done after the // protocol parsing. It is not a protocol problem asking for an // unexisting ref and we wouldn't need the ref database here. Do so. This way all ref database accesses are in one place, in the UploadPack class. No user-visible change intended --- this is just to make the code easier to manipulate. Change-Id: I68e87dff7b9a63ccc169bd0836e8e8baaf5d1048 Signed-off-by: Jonathan Nieder <jrn@google.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | Prepare 5.2.1-SNAPSHOT buildsMatthias Sohn2018-12-072-51/+51
| | | | | | | | | | Change-Id: I68d9f5b1c8ca8e8eada9143093dc4fa82519edd8 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | JGit v5.2.0.201812061821-rv5.2.0.201812061821-rMatthias Sohn2018-12-072-2/+2
| | | | | | | | | | Change-Id: I8528c913ad1a820ee9a2fa6be1c9125b518caefe Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | Apache MINA sshd client: enable support for ed25519 keysThomas Wolf2018-12-021-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Include the net.i2p.crypto.eddsa bundle via a hard dependency. Add tests for dealing with ed25519 host keys and user key files. Manual tests: fetching from git.eclipse.org with an ed25519 user key, and pushing this change itself using the same ed25519 key. Note that sshd 2.0.0 does not yet support encrypted ed25519 private keys. Bug: 541272 Change-Id: I7072f4014d9eca755b4a2412e19c086235e5eae9 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* | Merge "Set git environment variables for hooks" into stable-5.2Thomas Wolf2018-12-021-2/+5
|\ \
| * | Set git environment variables for hooksThomas Wolf2018-11-301-2/+5
| | | | | | | | | | | | | | | | | | | | | Set GIT_DIR and GIT_WORK_TREE when calling hooks. Bug: 541622 Change-Id: I6153d8a6a934ec37a3a5e7319c2d0e516f539ab7 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* | | Prepare 5.2.0-SNAPSHOT buildsMatthias Sohn2018-11-302-2/+2
|/ / | | | | | | | | Change-Id: I18646aaeee51047b234b758dcc1c2f89fd01b2f8 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | JGit v5.2.0.201811281532-m3v5.2.0.201811281532-m3Matthias Sohn2018-11-282-2/+2
| | | | | | | | | | Change-Id: I79988b473d67e565d8f6bcac40ee9a14b26c9e60 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | Fix running tests from bazelMatthias Sohn2018-11-282-0/+5
| | | | | | | | | | | | | | | | The new dependency to mockito for JDKHttpConnectionTest wasn't added for bazel test run. Change-Id: Ie967b7152340a0b3e05cced7eadfd40af78d9995 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | Update bcprov-jdk15on used in tests to 1.59Matthias Sohn2018-11-281-3/+1
| | | | | | | | | | CQ: 15889 Change-Id: I04c9099941dd1929cd9075ad6c89660a63e7de8f Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | Merge "Fix IndexDiffs for git links"Christian Halstrick2018-11-285-1/+116
|\ \
| * | Fix IndexDiffs for git linksThomas Wolf2018-11-265-1/+116
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | After cloning a repo with a submodule, non-recursively, JGit would encounter in its TreeWalk in IndexDiff: * first, a missing gitlink (in index & HEAD, not in working tree) * second, the untracked folder (not in index and head, in working tree) As a result, it would report the submodule as missing. Canonical git reports a clean workspace. The root cause of this is that the path of a gitlink "x" did not compare equal to the path of a tree "x" in JGit. Correct Paths.compare() to account for that. If two paths are otherwise equal, then let gitlinks match both trees and files. Matching trees solves the bug. Matching files is necessary to handle the case where the gitlink directory was replaced by a file; see the new test case IndexDiffSubmoduleTest.testSubmoduleReplacedByFile(). Comparisons of unequal paths are left untouched, so the sort order is unchanged. After the fix, another bug(?) in WorkingTreeIterator became apparent: with core.dirNoGitLinks = true, it was no longer possible to overwrite a gitlink in the index. This is now fixed in WorkingTreeIterator. Add new test cases for the bug itself and for some related cases (submodule directory deleted or replaced by a file) in IndexDiffSubmoduleTest. Add a test for missing files in IndexDiffTest, and adapt the PathsTest to test matching gitlinks. Bug: 467631 Change-Id: I0549d10d46b1858e5eec3cc15095aa9f1d5f5280 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* | | Merge branch 'stable-5.1'David Pursehouse2018-11-271-16/+39
|\ \ \ | |/ / |/| / | |/ | | | | | | | | | | * stable-5.1: Fix DescribeCommand with multiple match options Fix git-describe tie-breakers Change-Id: I64d9b0099fc0d8449ec08f0b5653572b5c2f840f Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
| * Merge branch 'stable-5.0' into stable-5.1David Pursehouse2018-11-271-16/+39
| |\ | | | | | | | | | | | | | | | | | | | | | | | | * stable-5.0: Fix DescribeCommand with multiple match options Fix git-describe tie-breakers Change-Id: I63e7a56bb617b5ce8774e1dc7f5efdde25e7cd97 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
| | * Merge branch 'stable-4.11' into stable-5.0David Pursehouse2018-11-271-16/+39
| | |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-4.11: Fix DescribeCommand with multiple match options Fix git-describe tie-breakers Change-Id: Ibb98f143ee0ce7635beb30ec404b4134a73788f6 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
| | | * Fix DescribeCommand with multiple match optionsMatthias Sohn2018-11-261-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | when multiple match options are given in git describe the result must not depend on the order of the match options. JGit wrongly picked the first match using the match options in the order they were defined. Fix this by concatenating the streams of matching tags for all match options and then choosing the first match on the concatenated stream sorted in tie break order. See https://git-scm.com/docs/git-describe#git-describe---matchltpatterngt Change-Id: Id01433d35fa16fb4c30526605bee041ac1d954b2 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| | | * Fix git-describe tie-breakersHåvard Wall2018-11-091-15/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Correct behaviour as git 1.7.1.1 is to resolve tie-breakers to choose the most recent tag. https://github.com/git/git/blob/master/Documentation/RelNotes/1.7.1.1.txt: * "git describe" did not tie-break tags that point at the same commit correctly; newer ones are preferred by paying attention to the tagger date now. Bug: 538610 Change-Id: Ib0b2a301997bb7f75935baf7005473f4de952a64 Signed-off-by: Håvard Wall <haavardw@gmail.com>
| | | * Prepare 4.11.6-SNAPSHOT buildsMatthias Sohn2018-10-202-47/+47
| | | | | | | | | | | | | | | | | | | | Change-Id: Ic823775aad59530f516602e7e848474d65763314 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| | | * JGit v4.11.5.201810191925-rv4.11.5.201810191925-rMatthias Sohn2018-10-202-2/+2
| | | | | | | | | | | | | | | | | | | | Change-Id: I9d11536062de74775ca545c26f341610d0ddaeb2 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| * | | Prepare 5.1.4-SNAPSHOT buildsMatthias Sohn2018-10-202-47/+47
| | | | | | | | | | | | | | | | | | | | Change-Id: Iee86860f3b4eb9f4af818c60342fd29465c0474c Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| * | | JGit v5.1.3.201810200350-rv5.1.3.201810200350-rMatthias Sohn2018-10-202-2/+2
| | | | | | | | | | | | | | | | | | | | Change-Id: Ib2c5a79d4fdf77680b7b65652fc3659527df27ad Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | | | Add a method to get all values of HTTP header defined as listMatthias Sohn2018-11-263-0/+135
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | According to RFC 2616 [1] header field names are case insensitive. Header fields defined as a comma separated list can have multiple header fields with the same field name. Add a method to HttpConnection which retrieves all values with a given header field name with the field name compared case insensitive. [1] https://tools.ietf.org/html/rfc2616#section-4.2" Change-Id: I7f601b21cda99e84f43f866c7c7cb4cb0e3cf5c3 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | | | Undo treating blobs with NULs as a single lineThomas Wolf2018-11-263-5/+79
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This partially reverts commit a551b646: revert the changes in RawParseUtils.lineMap(). Forcing all blobs containing a NUL byte as a single line causes blame to produce useless results as soon as it hits any version containing a NUL byte. Doing binary detection at this level also has the problem that the user cannot control it. Not by setting the text attribute nor in any other way. This came up in bug 541036, where a Java source inadvertently contained NUL bytes in strings. Even fixing this by using escapes "\000" will not fix JGit's blame for this file because the past versions will still contain the NUL byte. Native git can blame that file from bug 541036 fine. Added new tests verifying that blaming a text file containing a NUL byte produces sensible results. Bug: 541036 Change-Id: I8991bec88e9827cc096868c6026ea1890b6d0d32 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* | | | New GpgConfig for typed access to GPG settingsGunnar Wagenknecht2018-11-201-0/+147
| | | | | | | | | | | | | | | | | | | | Change-Id: Ifece38132e0390931d33b5678bbbd4a43f9099da Signed-off-by: Gunnar Wagenknecht <gunnar@wagenknecht.org>
* | | | Apache MINA sshd client: test & fix password authenticationThomas Wolf2018-11-171-0/+132
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add tests for password and keyboard-interactive authentication. Implement password authentication; the default provided by sshd is non-interactive, which is not useful for JGit. Make sure the CredentialsProvider gets reset on successive password retrieval attempts. Otherwise it might always return the same non- accepted password from a secure storage. (That one was discovered by actually trying this via EGit; the JGit tests don't catch this.) Change the default order of authentication mechanisms to prefer password over keyboard-interactive. This is a mitigation for upstream bug SSHD-866.[1] Also include a fix for upstream bug SSHD-867.[2] [1] https://issues.apache.org/jira/projects/SSHD/issues/SSHD-866 [2] https://issues.apache.org/jira/projects/SSHD/issues/SSHD-867 Bug: 520927 Change-Id: I423e548f06d3b51531016cf08938c8bd7acaa2a9 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* | | | Move SshTestGitServer to new bundle org.eclipse.jgit.junit.sshThomas Wolf2018-11-172-13/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Create the bundle and move the SshTestGitServer there. Verified that the Eclipse build still works and ran JSchSshTest and ApacheSshTest as junit tests inside Eclipse. Update maven build and features to account for that. Verified by running full maven build including packaging. Update bazel build files to account for that. Verified by a clean-slate bazel build :all, followed by running the JSchSshTest and the ApacheSshTest via bazel. Change-Id: Ia084942f4425b454529de148e00417e7da786a90 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* | | | Apache MINA sshd: use NumberOfPasswordPrompts for encrypted keysThomas Wolf2018-11-142-10/+65
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | sshd only asks exactly once for the password. C.f. upstream issue SSHD-850.[1] So we have to work around this limitation for now. Once we move to sshd > 2.1.0, this can be simplified somewhat. [1] https://issues.apache.org/jira/browse/SSHD-850 Bug: 520927 Change-Id: Id65650228486c5ed30affa9c62eac982e01ae207 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* | | | Merge "Format BUILD files with buildifier"David Pursehouse2018-11-141-9/+9
|\ \ \ \
| * | | | Format BUILD files with buildifierDavid Pursehouse2018-11-131-9/+9
| | | | | | | | | | | | | | | | | | | | | | | | | Change-Id: I7eb83e0560b1826c4f8567e9bc5fbdb2ae3fe9d0 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* | | | | Apache MINA sshd client: properly handle HostKeyAlgorithms configThomas Wolf2018-11-131-0/+36
|/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | By default sshd will use its default built-in list, which matches the one of openssh (as far as the algorithms exist in sshd at all). But it doesn't handle HostKeyAlgorithms from the ssh config at all. Implement this as in openssh, including the '+' and '-' modifiers and reordering the default if there are known host keys for a server already. Add tests for the reordering. Also use a more robust reader for the known hosts file. The default aborts on the first error. Bug: 520927 Change-Id: Ib1684440bfe2e96140536aa1a93c4bd4a0d35916 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* | | | Add ssh tests for PreferredAuthenticationsThomas Wolf2018-11-131-0/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Tests that it works with unknown authentications in the list, and fails if there are no common authentications between server and client. The latter also tests that the ssh config setting is taken into account at all. And promptly the JGit sshd client didn't. Add a fix for this. It's a tiny bit hacky: Apache MINA looks up a custom property set on a hierarchy of "PropertyResolver"s starting with the session. On the session itself this property can never be set since it's read already in the session constructor before anyone had any chance to set it. The next element in the resolver hierarchy is the sshd SshClient, and so we set that property there. Since we use one SshClient and one ClientSession per JGit SshdSession, this is OK. Bug: 520927 Change-Id: I62446fc1fffde125a8965c030240f0918ae234b7 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* | | | Apache MINA sshd clientThomas Wolf2018-11-1344-6/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a new ssh client implementation based on Apach MINA sshd 2.0.0. This implementation uses JGit's own config file parser and host entry resolver. Code inspection of the Apache MINA implementation revealed a few bugs or idiosyncrasies that immediately would re-introduce bugs already fixed in the past in JGit. Apache MINA sshd is not without quirks either, and I had to configure and override more than I had expected. But at least it was all doable in clean ways. Apache MINA boasts support for Bouncy Castle, so in theory this should open the way to using more ssh key algorithms, such as ed25519. The implementation is in a separate bundle and is still not used in the core org.eclipse.jgit bundle. The tests re-use the ssh tests from the core test bundle. Bug: 520927 Change-Id: Ib35e73c35799140fe050d1ff4fb18d0d3596580e Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* | | | Add more ssh tests: pushing, known_host file handling, etc.Thomas Wolf2018-11-1342-223/+1169
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add support for git-receive-pack to the ssh git server and add two new tests for pushing. This actually uncovered an undocumented requirement in TransportSftp: the FTP rename operation assumes POSIX semantics, i.e., that the target is removed. This works as written only for servers that support and advertise the "posix-rename@openssh.com" FTP extension. Our little Apache MINA server does not advertise this extension. Fix the FtpChannel implementation for Jsch to handle this case in a meaningful way so that it can pass the new "push over sftp" test. Add more tests to test the behavior of server host key checking. Also refactor the tests generally to separate better the test framework from the actual tests. Bug: 520927 Change-Id: Ia4bb85e17ddacde7b36ee8c2d5d454bbfa66dfc3 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* | | | DepthGenerator: fix multi-child boundary handlingJonathan Tan2018-11-081-0/+85
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Suppose that a repository has the following commit graph: B C \ / A and it was cloned with --shallow-exclude=A. DepthGenerator does not mark C as shallow, causing an invalid repository to be produced on the client, because A is not sent. (A similar issue occurs when --shallow-since is used to exclude A but neither B nor C.) This happens whenever an excluded commit has more than one child that is to be sent to the client. Fix DepthGenerator to handle this case correctly. While we're editing DepthWalk.Commit, fix the documentation of DepthWalk.Commit#isBoundary. Change-Id: I7068abf0fe0c864d1b0e56e1616dad1aa8719411 Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
* | | | SshTestBase: Make inner class TestCredentialsProvider staticDavid Pursehouse2018-11-081-1/+1
| | | | | | | | | | | | | | | | | | | | Change-Id: Id5ba87b24e8a29157d49e9e5b151d65bdbcab37a Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* | | | org.eclipse.jgit.test/BUILD: Format with buildifierDavid Pursehouse2018-11-071-1/+1
| | | | | | | | | | | | | | | | | | | | Change-Id: Ia70f2af8f8c7a85f891a1963ab146695262e7ce2 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* | | | Factor out a JSch-independent ssh config parserThomas Wolf2018-11-061-16/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Move the bulk of the basic parsing and host entry handling into a new class OpenSshConfigFile that has no dependencies on any concrete ssh implementation. Make the existing OpenSshConfig use the new parser. Introduce a new class SshConstants collecting all the various ssh- related string literals. Also use TreeMaps with a case-insensitive key comparator instead of converting keys to uppercase. Add a test to verify that keys are matched case-insensitively. Most of the parsing code was simply moved, except that the new parser supports looking up entries given host name, port, and user name, and can thus handle more %-substitutions correctly. This feature is not yet used and cannot be used with JSch since JSch only has a ConfigRepository.getConfig(String) interface. The split is still worth the trouble as it opens the way to using another ssh client altogether. Apache MINA sshd, for instance, resolves host entries giving host name, port, and user name. (Apache MINA has a built-in ssh config handling, but that has problems, too: its pattern matching is case-insensitive, and its merging of host entries if several match is not the same as in OpenSsh. But with this refactoring, it will be possible to plug in OpenSshConfigFile into an Apache MINA sshd client without dragging along JSch.) One test case that doesn't make sense anymore has been removed. It tested that repeatedly querying for a host entry returned the same object. That is no longer true since the caching has been moved to a deeper level. Bug: 520927 Change-Id: I6381d52b29099595e6eaf8b05c786aeeaefbf9cc Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* | | | Ssh tests with an Apache MINA sshd test git serverThomas Wolf2018-11-069-1/+635
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a simple ssh git server based on Apache MINA sshd, and use it in new tests that verify ssh operations and in particular a number of bugs that had cropped up over time in JSch. The git server supports fetching only, and sftp access. The tests are all in an abstract base class; the concrete JschSshTest class only provides ssh-specific test setup. So the same tests could be run easily also with some other ssh client. Bug: 520927 Change-Id: Ide6687b717fb497a29fc83f22b07390a26dfce1d Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* | | | Bazel: Add missing test dependency on ObjectIdMatcherDavid Pursehouse2018-11-051-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Test plan: bazel build //... Change-Id: I28a8d3cfa54b46b95043ddd7bfdd1412c6b54865 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* | | | Merge changes from topic 'client-caps-v0-test'Jonathan Nieder2018-11-023-23/+313
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | * changes: Add test for protocol v0 parser ObjectIdMatcher: Custom matcher for sets of ObjectIds
| * | | | Add test for protocol v0 parserIvan Frade2018-10-241-0/+199
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ProtocolV2Parser has unit tests but protocol v0/v1 is not covered. Change-Id: I96022e8f8eb60d4da748d1042474fd1efd67e882 Signed-off-by: Ivan Frade <ifrade@google.com>
| * | | | ObjectIdMatcher: Custom matcher for sets of ObjectIdsIvan Frade2018-10-242-23/+114
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Parsed requests represent object ids (SHA1) in ObjectId instances but tests use strings for those ids because they are easier to define. Create a custom matcher that hides the conversion from string to ObjectId. Note that this reverses the existing code conversion (it was transforming ObjectIds into string). This produces more readable code, consistent with the other hamcrest assertions. Change-Id: I47ba1d25557d791fe74fb93c740ff7de9923cc00 Signed-off-by: Ivan Frade <ifrade@google.com>
* | | | | Fix test setup for Eclipse Photon and greaterThomas Wolf2018-11-023-9/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When a source folder is marked as a test folder, JDT requires that it has an output folder different from the one used for regular sources. Therefore give the test folders in org.eclipse.jgit.test a separate output folder "bin-tst". Moreover JDT reports errors if non-test classes have dependencies on test classes. Therefore remove the "test" annotation from org.eclipse.jgit.junit. Change-Id: Ib527439ff5b7d7b570b8a60819ecaa70f59c63a3 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* | | | | RepoCommand: Preserve executable bit in <copyfile>Ivan Frade2018-10-311-0/+118
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The copyfile entry in the manifest file copies the contents of the file but doesn't keep the executable flag. This is inconsistent with repo tool behaviour, plus is natural to expect that the copy of a executable file is executable. Transfer the executable bit when copying the file, aligning the RepoCommand with repo tool and user expectations. Change-Id: I01b24f482d5939e01d496f032388b3a5c02a912a Signed-off-by: Ivan Frade <ifrade@google.com>
* | | | | RepoCommand.RemoteReader: Add method to read contents and mode of fileIvan Frade2018-10-311-12/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The RepoCommand.RemoteReader interface doesn't offer access to the mode of a file. Caller can only default to mark the copied objects as regular files, losing e.g. the executable bit (if set). Add a new method readFileWithMode that returns the contents and mode of the remote file. It supersedes the readFile method, that is marked as deprecated. Now callers can set correctly the file mode of the copied file. Change-Id: I8fce01e4bc5707434c0cbc4aebbae1b6b64756f0 Signed-off-by: Ivan Frade <ifrade@google.com>