Commit Graph

5960 Commits

Author SHA1 Message Date
Matthias Sohn 0dbaf9d951 Prepare 5.0.1-SNAPSHOT builds
Change-Id: Iadf12dbdd63ef17c3f712c0fc18495304aa35016
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-06-13 23:24:42 +02:00
Matthias Sohn e729a83bd2 JGit v5.0.0.201806131550-r
Change-Id: Ia2d548676217250593c3f0c383aec19e12e5e4a4
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-06-13 21:42:40 +02:00
Matthias Sohn 94a585e6e8 JGit v5.0.0.201806131210-r
Change-Id: Iedccfcaf57c11822f1faf5d5195357de42b2a14e
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-06-13 18:11:23 +02:00
Matthias Sohn 2d276161a2 Downgrade Apache httpclient to 4.5.2.v20170210-0925
Eclipse platform uses this version from the Oxygen Orbit release for
Photon. In order to avoid that we end up with two slightly different
versions in the same p2 repository of the simultaneous release we
downgrade temporarily from the version 4.5.2.v20180410-1551 in the
Photon Orbit release.

See
https://dev.eclipse.org/mhonarc/lists/cross-project-issues-dev/msg15659.html

Change-Id: Id46a840aa4b1010af7fe311498f17f1f2e5b81e0
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-06-13 13:18:12 +02:00
David Pursehouse 5ff56d2ed1 RefUpdateTest: Refactor to not use deprecated Repository#getAllRefs
Change-Id: I157e62a0e1479d4bc95ef867e616ca8a30041759
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-06-13 11:24:46 +02:00
Matthias Sohn f7fbc7fcd7 Propagate failure of ssh command to caller of SshSupport
When SshSupport.runSshCommand fails since the executed external ssh
command failed throw a CommandFailedException.

If discovery of LFS server fails due to failure of the
git-lfs-authenticate command chain the CommandFailureException to the
LfsConfigInvalidException in order to allow root cause analysis in the
application using that.

Change-Id: I2f9ea2be11274549f6d845937164c248b3d840b2
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-06-13 11:24:24 +02:00
Marcel Trautwein 5429d1a0cf Make JGit describe behaves same as c-git for lightweight tags
JGit now considers lightweight tags only if the --tags option is set
i.e. `git.describe().setAllTags(true)` has to be set, else the default
is now as in c git:

Only annotated tags are evaluated unless you pass true
equivalent to --tags (or --all) by the option setAllTags.

Hint: This (still) doesn't address any difference between c-git
`--all` and `!--all --tags` behavior;
perhaps this might be a follow up request

Bug: 423206
Change-Id: I9a3699756df0b9c6a7c74a7e8887dea0df17c8e7
Signed-off-by: Marcel Trautwein <me+eclipse@childno.de>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-06-13 09:37:47 +02:00
Markus Duft 01c52a58f6 Fix issues with LFS on GitHub (SSH)
* URIish seems to have a tiny feature (bug?). The path of the URI
   starts with a '/' only if the URI has a port set (it seems).
 * GitHub does not return SSH authorization on a single line as Gerrit
   does - need to account for that.
 * Increase the SSH git-lfs-authenticate timeout, as GitHub sometimes
   responds slower than expected.
 * Guard against NPE in case the download action does not contain any
   additional headers.

Change-Id: Icd1ead3d015479fd4b8bbd42ed42129b0abfb95c
Signed-off-by: Markus Duft <markus.duft@ssi-schaefer.com>
2018-06-12 09:49:15 +02:00
Matthias Sohn 747ad8b166 Merge branch 'stable-4.11' into stable-5.0
* stable-4.11:

Change-Id: Iec2dafd00979ab02f5ab698fc514866255007de5
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-06-11 11:25:55 +02:00
Matthias Sohn c6f210a38b Merge branch 'stable-4.10' into stable-4.11
* stable-4.10:
  Ensure DirectoryStream is closed promptly

Change-Id: I2c0d5ea96b2c96336908674032d0f7d39dc062b9
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-06-11 11:03:49 +02:00
Matthias Sohn e512d919ec Merge branch 'stable-4.9' into stable-4.10
* stable-4.9:
  Ensure DirectoryStream is closed promptly

Change-Id: I62674a1db9266c04fb353ab697e2c0a24a7369b7
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-06-11 10:54:59 +02:00
Michael Keppler e710f14ed1 Fix Javadoc typo
Change-Id: Ib4ebc57236bdea663f27295764886413e2550580
Signed-off-by: Michael Keppler <Michael.Keppler@gmx.de>
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-06-10 23:19:20 +09:00
Thomas Wolf 4ef8769f81 Ensure Jsch checks all configured algorithms
Jsch checks only for the availability of the algorithms given by
Jsch-internal config keys "CheckCiphers", "CheckKexes", and
"CheckSignatures". If the ssh config defines any algorithms
unknown to Jsch not listed in those keys, it'll still propose them
during the negotiation phase, and run into an NPE later on if the
server happens to propose such an algorithm and it gets chosen.

Jsch reads those "CheckCiphers" and the other values from either a
session-local config, or the global static Jsch config. It bypasses
~/.ssh/config for these values.

Therefore, copy these values from the config as read from
~/.ssh/config into the session-specific config. That makes Jsch
check _all_ configured algorithms up front, discarding any for
which it has no implementation. Thus it proposes only algorithms
it actually can handle.

Bug: 535672
Change-Id: I6a68e54f4d9a3267e895c536bcf3c58099826ad5
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2018-06-10 12:06:59 +02:00
Matthias Sohn 6cb0199ffc Merge branch 'stable-4.9' into stable-5.0
* stable-4.9:
  Ensure DirectoryStream is closed promptly

Change-Id: I447a01e1170db85fcf5978206ed35ad1956a2d82
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-06-10 09:23:52 +02:00
Matthias Sohn 5f8b6ebc9f RawTextTest#testBinary: use array comparison to compare arrays
Change-Id: Iac1feadf24858a0bdf0cb224f16b34e9498fe3bb
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-06-09 14:42:55 +02:00
Markus Duft a9e6da1082 LFS: Better SSH authentication token timeout handling
* Larger eager timeout to compensate for high-latency lines
 * Respect eager timeout in case the server uses "expiresIn"

Change-Id: Id87da1eea874e70b69eaccf35c84af4c3bb50770
Signed-off-by: Markus Duft <markus.duft@ssi-schaefer.com>
2018-06-09 14:42:55 +02:00
Dave Borowitz 5fe8e31d43 Ensure DirectoryStream is closed promptly
From the javadoc for Files.list:

"The returned stream encapsulates a DirectoryStream. If timely disposal
of file system resources is required, the try-with-resources construct
should be used to ensure that the stream's close method is invoked
after the stream operations are completed."

This is the only call to Files#newDirectoryStream that is not already in
a try-with-resources.

Change-Id: I91e6c56b5d74e8435457ad6ed9e6b4b24d2aa14e
(cherry picked from commit 1c16ea4601)
2018-06-09 17:34:29 +09:00
Matthias Sohn 62460b42b7 Validate branch names on branch creation
Since v2.16.0-rc0~89^2~1 (branch: correctly reject
refs/heads/{-dash,HEAD}, 2017-11-14),
native git does not allow branch names
- refs/heads/HEAD
- starting with '-'

Bug: 535655
Change-Id: Ib1c4ec9ea844073901a4ebe6a29ff6cc8ae58e93
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-06-09 01:20:13 +02:00
Matthias Sohn 5f27032fb8 Use constant for ".lock"
Change-Id: Id65dc94c970ffd3ca3d3d4a5d57123c95d29e8af
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-06-08 21:43:39 +02:00
Matthias Sohn 1cb8c5d7fe Simplify locking of FileRepository's index snapshot
synchronize on simple Object monitor instead of using ReentrantLock

Change-Id: I897020ab35786336b51b0fef76ea6071aff8aefa
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-06-08 09:54:38 +02:00
Matthias Sohn b782518cae Refactor FileRepository.detectIndexChange()
Change-Id: I50c751e2e90f685dc27043c569da2eb210d4611b
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-06-08 09:42:13 +02:00
Jonathan Nieder f98112289c Merge "Ensure index change event is fired when index snapshot changed" into stable-5.0 2018-06-08 01:34:12 -04:00
Matthias Sohn 5f46661cae Update to latest Photon Orbit R20180606145124
also add missing bundle org.hamcrest

Change-Id: I88ad7769b8fda491fe3641ddaf0964ca55ffc0f6
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-06-07 14:45:12 +02:00
David Pursehouse 0d908de53f Update maven plugins to fix Zip Slip vulnerability
Zip Slip [1] is an arbitrary file write generic vulnerability, that can
be achieved using a specially crafted zip (or bzip2, gzip, tar, xz, war)
archive, that holds path traversal filenames.

According to Maven's announcement [2] several plugins use plexus-archiver to
unpack dependencies to disk and have been identified as potential triggers
for exposing the vulnerability.

Of those, JGit uses the maven-dependency-plugin and the maven-javadoc-plugin.

Update them to the fixed versions reported in [2].

See the corresponding issues for the maven-dependency-plugin [3] and the
maven-javadoc-plugin [4] for details.

[1] https://snyk.io/research/zip-slip-vulnerability
[2] https://maven.apache.org/security-plexus-archiver.html
[3] https://issues.apache.org/jira/browse/MDEP-611
[4] https://issues.apache.org/jira/browse/MJAVADOC-520

Change-Id: Id3ab2d6161db240f2ab8f82298fa3ecd7a930a43
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-06-06 13:34:34 +09:00
Matthias Sohn a3738ef137 Ensure index change event is fired when index snapshot changed
Ensure that notifyIndexChanged is called every time we call
FileSnapshot.save, except the first.

Change-Id: I5a4e9826e791f518787366ae7c3a0ef3d416d2c1
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-06-06 00:45:27 +02:00
Matthias Sohn cb0abf787e Prepare 5.0.0-SNAPSHOT builds
Change-Id: I9acca328146aa7100fbc1b457fcb1f8fd87cf52a
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-06-05 15:31:07 +02:00
Matthias Sohn ca57743a45 JGit v5.0.0.201806050710-rc3
Change-Id: Ic7a6a87dd3a21351e60fbf6cd330456adf1f6800
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-06-05 13:10:10 +02:00
Jonathan Tan 7dbd2bfe7e Teach UploadPack "filter" in protocol v2 fetch
If the configuration variable uploadpack.allowfilter is true, advertise
that "filter" is supported, and support it if the client sends such an
argument.

Change-Id: I7de66c0a0ada46ff71c5ba124d4ffa7c47254c3b
Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
2018-06-04 22:09:07 -07:00
Jonathan Tan c9d4609ecb Refactor test of capabilities output
A subsequent patch will dynamically generate the capability
advertisement, so the capability advertisements produced are not always
the same. Separate the checking of the advertisements into its own test
method.

Change-Id: I768d14b9d1a244d5d886c42ffd62ef3957b518fb
Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
2018-06-04 22:09:07 -07:00
Jonathan Tan e319a6f8d4 Refactor v2 advertisement into own function
A subsequent patch needs dynamic generation of this advertisement
depending on a configuration variable in the underlying repository, so
refactor it into a function instead of using a constant list.

Change-Id: Ie00584add1fb56c9e88c7b57f75703981ea5bb85
Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
2018-06-04 22:09:06 -07:00
Jonathan Tan 62c4d3a133 Refactor parsing of "filter" into its own method
The implementation of protocol v2 will also need to parse the "filter"
option, so refactor it into its own method.

Change-Id: I751f6e6ca63fab873298594653a3885202297a2e
Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
2018-06-04 22:08:29 -07:00
Jonathan Tan 2f60804396 Disallow unknown args to "fetch" in protocol v2
JGit's implementation of the fetch command of protocol v2, unlike its
implementation of ls-refs, currently tolerates unknown arguments.
Tighten fetch to not allow unrecognized arguments and add tests to
verify this behavior for both ls-refs and fetch.

Change-Id: I321161d568bd638252fab1a47b06b924d472a669
Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
2018-06-04 22:08:21 -07:00
Jonathan Tan f7e501c36c Teach UploadPack shallow fetch in protocol v2
Add support for the "shallow" and "deepen" parameters in the "fetch"
command in the fetch-pack/upload-pack protocol v2. Advertise support for
this in the capability advertisement.

TODO: implement deepen-relative, deepen-since, deepen-not

Change-Id: I7ffd80d6c38872f9d713ac7d6e0412106b3766d7
Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Jonathan Nieder <jrn@google.com>
2018-06-04 22:08:18 -07:00
Jonathan Tan cd0d69ffec Refactor unshallowCommits to local variable
This reduces the amount of state held as instance variables in
UploadPack, and makes it easier for a future patch to contain a clearer
version of UploadPack#processShallow.

Change-Id: I6df80b42f9e5118fda1420692e02e417670cced3
Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Jonathan Nieder <jrn@google.com>
2018-06-04 22:04:18 -07:00
Jonathan Tan f516c1df9d Add protocol v2 support in http
Teach UploadPack to support protocol v2 with non-bidirectional pipes,
and add support to the HTTP protocol for v2. This is only activated if
the repository's config has "protocol.version" equal to 2.

Change-Id: I093a14acd2c3850b8b98e14936a716958f35a848
Helped-by: Matthias Sohn <matthias.sohn@sap.com>
Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Jonathan Nieder <jrn@google.com>
2018-06-04 21:59:20 -07:00
Jonathan Tan c32a62cd4a Give info/refs services more control over response
Currently, SmartServiceInfoRefs always prints "# service=serviceName"
followed by a flush packet in response to an info/refs request, and then
hands it off to the specific service class. Printing of "#
service=serviceName" is mandated for protocol v0, but not v2.

Therefore, the existing code works for protocol v0, but whenever a
service that supports protocol v2 receives an info/refs request, it must
first determine which protocol version is to be used (depending on, for
example, the request and any relevant configuration variables), and then
decide if "# service=serviceName" needs to be printed.

Create a new method that v2-supporting service classes can override,
covering the printing of both "# service=serviceName" and everything
that the #advertise method prints. This will be used in a subsequent
commit in which UploadPackServlet (and the other classes it uses) is
updated to support protocol v2.

Change-Id: Ia026b06e96a6b15937514096babd024ef77df1ea
Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Jonathan Nieder <jrn@google.com>
2018-06-04 21:54:25 -07:00
Mincong HUANG 36a8c21069 Chain RemoteAddCommand methods
Change-Id: I1cf64c90a5cd2220034810b0d65d59582b420c4e
Signed-off-by: Mincong Huang <mincong.h@gmail.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-06-02 02:04:20 +02:00
Matthias Sohn bbf7ca3eda Update target platforms to Orbit R20180531190352-Photon
Use the final Photon Orbit release

Change-Id: Ie07eb3dedb5ccb6a2a7b0ad2c90593a07fdd240e
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-06-01 14:18:29 +02:00
Matthias Sohn c473bbf802 Prepare 5.0.0-SNAPSHOT builds
Change-Id: I9c4a0465f8e85041d24da97f4b4c7ad5f5eed3e4
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-05-30 23:16:23 +02:00
Matthias Sohn dbf091a7ee JGit v5.0.0.201805301535-rc2
Change-Id: Ifad678794525c01838b03e52bada66e1c089c5ae
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-05-30 21:33:49 +02:00
Matthias Sohn f2e0ace1e0 Fix description property in feature.properties of pgm source feature
Change-Id: I29c7bf1dc6aaf71542e2529883d44dcd995e17f7
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-05-30 01:14:14 +02:00
Matthias Sohn eecf06ca42 Update SUA
Following [1] update SUA in license.html [2] and feature.properties [3]

[1] https://www.eclipse.org/projects/handbook/#legaldoc-plugins
[2] https://www.eclipse.org/legal/epl/notice.html
[3] https://www.eclipse.org/legal/epl/feature.properties.txt

Bug: 532265
Change-Id: Ia3929808154510ad09ceeead263a3fe0dba9a34a
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-05-29 17:47:29 +02:00
Thomas Wolf de21c58d03 Don't prune symbolic refs when fetch.prune = true
The canonical implementation also doesn't. Compare current
code in remote.c, function get_stale_heads_cb.[1] Not handling
symrefs in this case was introduced in canonical git in [2]
in 2008.

[1] https://github.com/git/git/blob/v2.17.0/remote.c#L2259
[2] https://github.com/git/git/commit/740fdd27f0

Bug: 533549
Change-Id: If348d56bb4a96b8aa7141f7e7b5a0d3dd4e7808b
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2018-05-25 06:08:25 -05:00
Matthias Sohn 9ad7031381 Prepare 5.0.0-SNAPSHOT builds
Change-Id: Ie343ccf37f46168041046500a2e19acc80814cfe
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-05-23 01:54:32 +02:00
Matthias Sohn 812abefd58 JGit v5.0.0.201805221745-rc1
Change-Id: Ie2c35fab87f294b00f9754b07b60a848bf256b10
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-05-22 23:43:43 +02:00
Matthias Sohn ce5cdea143 Merge branch 'master' into stable-5.0
* master:
  DescribeCommand: Refactor to not use deprecated Repository#peel
  Repository: Deprecate #peel method
  Repository: Make #exactRef and #findRef final
  Skip ignored directories in FileTreeIterator
  Repository: Deprecate getTags method
  InfoRefsServlet: Refactor to not use deprecated methods
  RefAdvertiser: Add send(Collection<Ref>) and deprecate send(Map<String, Ref>)
  Remove deprecated Repository#notifyIndexChanged
  Implementors should override Repository#notifyIndexChanged(boolean)
  Revive Repository#notifyIndexChanged()
  Remove further unnecessary 'final' keywords
  Execute AdvertiseRefsHook only for protocol v0 and v1
  Add protocol v2 support in "jgit daemon"
  Teach UploadPack "ofs-delta" in "fetch"
  Teach UploadPack "include-tag" in "fetch"
  Avoid using #refs in UploadPack#sendPack
  FileRepository: Don't use deprecated RefDatabase#getRefs(String)
  BatchRefUpdate: Don't use deprecated RefDatabase#getRefs(String)

Change-Id: I16c5da62d09262d3f4070aa0f466dd6c8352b5ea
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-05-22 23:00:51 +02:00
David Pursehouse 51599ebb84 DescribeCommand: Refactor to not use deprecated Repository#peel
Change-Id: I76073ad62d1bc4fc21d8a1f5fc7eb92060a73baa
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-05-22 12:08:08 +09:00
David Pursehouse f6c4a492d0 Repository: Deprecate #peel method
Callers should use getRefDatabase().peel(ref) instead since it
doesn't swallow the IOException.

Adapt all trivial callers to user the alternative.

DescribeCommand still uses the deprecated method and is not adapted in
this change since it will require more refactoring to add handling of
the IOException.

Change-Id: I14d4a95a5e0570548753b9fc5c03d024dc3ff832
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-05-22 11:49:37 +09:00
David Pursehouse e701c59a85 Repository: Make #exactRef and #findRef final
This means less cognitive overhead for both implementors and callers,
since this way we can guarantee that they are always synonyms for
RefDatabase#exactRef and RefDatabase#findRef, respectively.

Change-Id: Ic8aeb52fc7ed65672f3f6cd1da39a66908d88baa
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-05-22 10:21:42 +09:00
Thomas Wolf d7deda98d0 Skip ignored directories in FileTreeIterator
Make FileTreeIterator not enter ignored directories by default. We
only need to enter ignored directories if we do some operation against
git, and there is at least one tracked file underneath an ignored
directory.

Walking ignored directories should be avoided as much as possible as
it is a potential performance bottleneck. Some projects have a lot of
files or very deep hierarchies in ignored directories; walking those
may be costly (especially so on Windows). See for instance also bug
500106.

Provide a FileTreeIterator.setWalkIgnoredDirectories() operation to
force the iterator to iterate also through otherwise ignored
directories. Useful for tests (IgnoreNodeTest, CGitIgnoreTest), or
to implement things like "git ls-files --ignored".

Add tests in DirCacheCheckoutTest, and amend IndexDiffTest to test a
little bit more.

Bug: 388582
Change-Id: I6ff584a42c55a07120a4369fd308409431bdb94a
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2018-05-22 03:03:35 +02:00