summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* JGit v4.9.0.201710071750-rv4.9.0.201710071750-rMatthias Sohn2017-10-0756-59/+59
| | | | | Change-Id: I487f6aa3d0c4ef1d57f91cdc36177d994ae24c51 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Terminate StreamCopy threads in case of errorsTill Brychcy2017-10-071-4/+12
| | | | | | | | - fix NPE: don't invoke close() if no exception happened. Bug: 513554 Change-Id: I29f9b2ac1607ee26521e8aba334facd20e4ad79c Signed-off-by: Till Brychcy <register.eclipse@brychcy.de> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Use a new RevWalk for validating not advertised wantsZhen Chen2017-10-052-26/+117
| | | | | | | | | | | | | | Shadow commits in the RevWalk in the UploadPack object may cause the UNINTERESTING flag not being carried over to their parents commits since they were marked NO_PARENTS during the assumeShallow or initializeShallowCommits call. A new RevWalk needs to be created for this reason, but instead of creating a new RevWalk from Repository, we can reuse the ObjectReader in the RevWalk of UploadPack to load objects. Change-Id: Ic3fee0512d35b4f555c60e696a880f8b192e4439 Signed-off-by: Zhen Chen <czhen@google.com>
* Add photon target platform jgit-4.8.targetMatthias Sohn2017-10-053-0/+124
| | | | Change-Id: I87f52f512db4c89fa4e3e550ff97fdec843b8469 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Checkout now reports failures through exceptions.Ned Twigg2017-10-012-11/+33
| | | | | | | | | | | Checkout sometimes throws an exception, and other times it writes an error message to outw and returns normally, even though the command failed. This commit now reports all failures through a die() exception. Change-Id: I038a5d976d95020fea3faac68e9178f923c25b28 Signed-off-by: Ned Twigg <ned.twigg@diffplug.com>
* Terminate StreamCopy threads in case of errorsDmitry Neverov2017-09-302-6/+7
| | | | | | Bug: 513554 Change-Id: I065836b8fc77ade6de92e4a809fcf770a4f793ec Signed-off-by: Dmitry Neverov <dmitry.neverov@gmail.com>
* ReflogWriter: Align auto-creation defaults with C gitDave Borowitz2017-09-304-12/+15
| | | | | | | | | | Per git-config(1), core.logAllRefUpdates auto-creates reflogs for HEAD and for refs under heads, notes, tags, and for HEAD. Add notes and remove stash from ReflogWriter#shouldAutoCreateLog. Explicitly force writing reflogs for refs/stash at call sites, now that this is supported. Change-Id: I3a46d2c2703b7c243e0ee2bbf6948279800c485c
* Support force writing reflog on a per-update basisDave Borowitz2017-09-308-20/+196
| | | | | | | | | | Even if a repository has core.logAllRefUpdates=true, ReflogWriter does not create reflog files unless the refs are under a hard-coded list of prefixes, or unless the forceWrite bit is set. Expose the forceWrite bit on a per-update basis in RefUpdate/BatchRefUpdate/ReceiveCommand, creating RefLogWriters as necessary. Change-Id: Ifc851fba00f76bf56d4134f821d0576b37810f80
* Ensure ReflogWriter only works with a RefDirectoryDave Borowitz2017-09-308-63/+66
| | | | | | | | | | | | | | | | | | | | | | | | | The ReflogWriter constructor just took a Repository and called getDirectory() on it to figure out the reflog dirs, but not all Repository instances use this storage format for reflogs, so it's incorrect to attempt to use ReflogWriter when there is not a RefDirectory directly involved. In practice, ReflogWriter was mostly only used by the implementation of RefDirectory, so enforcing this is mostly just shuffling around calls in the same internal package. The one exception is StashDropCommand, which writes to a reflog lock file directly. This was a reasonable implementation decision, because there is no general reflog interface in JGit beyond using (Batch)RefUpdate to write new entries to the reflog. So to implement "git stash drop <N>", which removes an arbitrary element from the reflog, it's fair to fall back to the RefDirectory implementation. Creating and using a more general interface is well beyond the scope of this change. That said, the old behavior of writing out the reflog file even if that's not the reflog format used by the given Repository is clearly wrong. Fail fast in this case instead. Change-Id: I9bd4b047bc3e28a5607fd346ec2400dde9151730
* ChangeIdUtilTest: Remove unused notestCommitDashVDavid Pursehouse2017-09-301-17/+0
| | | | | | | | | | | | | | | | This test was never being run. Since it was introduced it was named "notest.." which meant it didn't run with JUnit3, and since it is not annotated @Test it also doesn't run with JUnit4. When compiling with Bazel 0.6.0, error-prone raises an error that the public method is not annotated with @Ignore or @Test. Given that the test has never been run anyway, we can just remove it. Bug: 525415 Change-Id: Ie9a54f89fe42e0c201f547ff54ff1d419ce37864 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* Add the args4j jarPepper Lebeck-Jobe2017-09-301-0/+1
| | | | | | | | | This allows the tests to all be built and run by bazel. Bug: 525412 Change-Id: Ie9281d07462cd07200fadb4b0e7b7f88c44f7865 Signed-off-by: Pepper Lebeck-Jobe <eljobe@gmail.com> Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* HttpConfig: load user config before reading values from itThomas Wolf2017-09-261-15/+33
| | | | | | | | | | | | | Same problem as in commit c227268: openUserConfig() just creates the FileBasedConfig object, but doesn't read the file yet. An explicit load() is needed. As HttpConfig is read-only this omission did not cause any bad effects, but it simply ignored values from the user config. Most uses of HttpConfig go through the two-argument constructor, though, where HttpConfig is given an already loaded repo config. Change-Id: Ibe7c562c17d6ef37de8b661ab7f6fa0246db01a2 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* Load the user config before modifying itThomas Wolf2017-09-231-4/+17
| | | | | | | | SystemReader.openUserConfig() does not load the config yet; an explicit StoredConfig.load() is needed. Bug: 374703 Change-Id: I1c397e2fb1a07ac4d9de3675d996417734ff90e9 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* Added API to TextBuiltin for piped usage.Ned Twigg2017-09-212-0/+143
| | | | | | | | | | Added a public method to TextBuiltin which makes it possible for clients to initialize all of its state, including output and error streams. This gives clients the ability to customize the way in which a command is run. Change-Id: If718236964d2c5cf869e120c74f1a12965f4812e Signed-off-by: Ned Twigg <ned.twigg@diffplug.com>
* SubmoduleUpdateCommand: Add fetch callbackDavid Pursehouse2017-09-201-4/+18
| | | | | | | | | | When the submodule already exists, it is fetched instead of cloned. Use the fetch callback instead of clone callback in this case. Change-Id: I170c21ab92b4117f25fdf940fe6807f214b04d39 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* Fetch submodule repo before resolving commitsMichael FIG2017-09-201-1/+28
| | | | | | | | | | | | | By default, this is turned off unless cmd.setFetch(true) is given. It will default to true in a future release to mimic c-git behaviour. This is needed to prevent Eclipse from crashing with "Missing unknown [REF]" when cloning a repo with submodules. Bug: 470318 Change-Id: I8ae37c7c5bd2408cead8d57dd13e93e01e0e9dc1 Signed-off-by: Michael FIG <michael@fig.org> Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* Handle SSL handshake failures in TransportHttpThomas Wolf2017-09-136-126/+358
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When a https connection could not be established because the SSL handshake was unsuccessful, TransportHttp would unconditionally throw a TransportException. Other https clients like web browsers or also some SVN clients handle this more gracefully. If there's a problem with the server certificate, they inform the user and give him a possibility to connect to the server all the same. In git, this would correspond to dynamically setting http.sslVerify to false for the server. Implement this using the CredentialsProvider to inform and ask the user. We offer three choices: 1. skip SSL verification for the current git operation, or 2. skip SSL verification for the server always from now on for requests originating from the current repository, or 3. always skip SSL verification for the server from now on. For (1), we just suppress SSL verification for the current instance of TransportHttp. For (2), we store a http.<uri>.sslVerify = false setting for the original URI in the repo config. For (3), we store the http.<uri>.sslVerify setting in the git user config. Adapt the SmartClientSmartServerSslTest such that it uses this mechanism instead of setting http.sslVerify up front. Improve SimpleHttpServer to enable setting it up also with HTTPS support in anticipation of an EGit SWTbot UI test verifying that cloning via HTTPS from a server that has a certificate that doesn't validate pops up the correct dialog, and that cloning subsequently proceeds successfully if the user decides to skip SSL verification. Bug: 374703 Change-Id: Ie1abada9a3d389ad4d8d52c2d5265d2764e3fb0e Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* Support http.<url>.* configsThomas Wolf2017-09-107-96/+843
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Git has a rather elaborate mechanism to specify HTTP configuration options per URL, based on pattern matching the URL against "http" subsection names.[1] The URLs used for this matching are always the original URLs; redirected URLs do not participate. * Scheme and host must match exactly case-insensitively. * An optional user name must match exactly. * Ports must match exactly after default ports have been filled in. * The path of a subsection, if any, must match a segment prefix of the path of the URL. * Matches with user name take precedence over equal-length path matches without, but longer path matches are preferred over shorter matches with user name. Implement this for JGit. Factor out the HttpConfig from TransportHttp and implement the matching and override mechanism. The set of supported settings is still the same; JGit currently supports only followRedirects, postBuffer, and sslVerify, plus the JGit-specific maxRedirects key. Add tests for path normalization and prefix matching only on segment separators, and use the new mechanism in SmartClientSmartServerSslTest to disable sslVerify selectively for only the test server URLs. Compare also bug 374703 and bug 465492. With this commit it would be possible to set sslVerify to false for only the git server using a self-signed certificate instead of having to switch it off globally via http.sslVerify. [1] https://git-scm.com/docs/git-config Change-Id: I42a3c2399cb937cd7884116a2a32fcaa7a418fcb Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* Add PushConfig class with PushRecurseSubmodulesModeDavid Pursehouse2017-09-092-0/+183
| | | | | | | | This will be used later when adding for support for recursing submodules on push. Change-Id: Ie2a183e5404a32046de9f6524e6ceeec37919671 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* Implement CommandRef.toString() to help debuggingMatthias Sohn2017-09-081-0/+8
| | | | Change-Id: If3ebed08c8f4e2cc925a97dbdd4c84410bc7c4a5 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Fix missing RefsChangedEvent when packed refs are usedThomas Wolf2017-09-073-5/+82
| | | | | | | | | | | | | | | With atomic ref updates using packed refs, JGit did not fire a RefsChangedEvent. This resulted in a user-visible regression in EGit: the UI would not update after a "Fetch from upstream...". Presumably it would also make Gerrit miss out on ref changes? Strengthen the BatchRefUpdateTest by also asserting the expected number of RefsChangedEvents, and ensure modCnt is incremented in RefDirectory.commitPackedRefs() when refs really changed (as opposed to some internal housekeeping operation, such as packing loose refs). Bug: 521296 Change-Id: Ia985bda1d99f45a5f89c8020ca4845e7a66e743e Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* Add FetchCommand#setRefSpecs(String...) variantDave Borowitz2017-09-073-21/+28
| | | | | | | | Much of the time the caller can specify a RefSpec succinctly using a string, and doesn't care about calling setters. Add a convenience method for this case, and use it where applicable in JGit core. Change-Id: Ic3fac7fc568eee4759236a5264d2e7e5f9b9716d
* ReceivePack: clear advertised .haves if application changes refsShawn Pearce2017-09-072-0/+42
| | | | | | | | | | | | | | | | | | | | | | | | An application can choose to invoke setAdvertisedRefs multiple times, for example several AdvertiseRefsHook installed in a chain. Each of these invocations populates the advertisedHaves collection with the unique set of ObjectIds. This can lead to a server over-advertising with ".have" lines if the first hook pushes in a lot of references, and the second hook filters this to a subset. ReceivePack will advertise the unique objects from the first hook using ".have" lines, which may lead to a huge advertisement sent to the client. This can also contribute to a very slow connectivity check after the pack is parsed as ReceivePack calls markUninteresting on every commit in advertisedHaves. This may require expanding a lot of subtrees to mark all trees as uninteresting as well. On a very big repository this can lead to a many-second stall. Clear the advertisedHaves collection any time the refs are updated. Add a test to verify the correct set of objects was sent. Change-Id: I97f6998d0597251444a2e846a3ea1f461bae96f9
* DfsGarbageCollector: support disabling conversion to reftableShawn Pearce2017-09-061-1/+15
| | | | | | | | When a repository is initially created using only reftable but doesn't yet have a GC pack, the garbage collector shouldn't scan the ref database. Support disabling the reftable conversion path. Change-Id: Iaaf3a4375cd43760b7181c1bd10244de8b2c5d9e
* Remove dead warning about minUpdaeIndex and maxUpdateIndex affecting refreshShawn Pearce2017-09-061-10/+0
| | | | | | | | DfsGarbageCollector always performs refreshes. This warning was from a prior iteration of the patch set and should have been removed before the change was merged. Change-Id: Id4750bb6c1c177e1ef040fd22912f434bbb5e992
* Merge "Remove no longer needed API problem filters"David Pursehouse2017-09-061-28/+0
|\
| * Remove no longer needed API problem filtersMatthias Sohn2017-09-061-28/+0
| | | | | | | | Change-Id: I206682a60ad9228c89efa22f8db9e72e19f17f6d Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | Stop using deprecated CmdLineException constructorsDavid Pursehouse2017-09-068-32/+75
|/ | | | | | | | | | | Instead of taking a String, the constructors now take a Localizable and a variable list of format arguments. Introduce a new Format helper class in CLIText, which implements the Localizable interface, and use it in place of raw Strings. Change-Id: I241eda16e242293ceb17b3c85ae5df85bd37c658 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* UntrackedFilesHandler: Fix non-localized stringDavid Pursehouse2017-09-063-2/+7
| | | | | Change-Id: Ida7b9ddc991515ab233763f2cb985853c9143a3c Signed-off-by: David Pursehouse <david.pursehouse@gmail.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Main: Replace deprecated ExampleMode with OptionHandlerFilterDavid Pursehouse2017-09-061-2/+3
| | | | | Change-Id: I1161a82269b7f093c00c9533ed8b99b7cca0a322 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* ObjectCheckerTest: Factor duplicate instances out to constantsDavid Pursehouse2017-09-061-72/+42
| | | | | | | | | | | | | | | | | | | | | | | | | The tests: - testCheckBlobNotCorrupt - testCheckBlobCorrupt create instances of ObjectChecker that are the same. The tests: - testCheckBlobWithBlobObjectCheckerNotCorrupt - testCheckBlobWithBlobObjectCheckerCorrupt also create instances of ObjectChecker that are the same. Factor these instances out to constants instead of creating them in the tests. The `checker` member is still created anew in each test, since some of the tests change its state. Change-Id: I2d90263829d01d208632185b1ec2f678ae1a3f4c Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* SubmoduleConfigTest: Add additional tests in fetchRecurseToConfigValueDavid Pursehouse2017-09-051-0/+2
| | | | | | | Add tests for "true" and "false" matching to "YES" and "NO". Change-Id: I58223855022871ac4b21bd34ff6a9cd00fce30a1 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* SubmoduleConfig: Simplify #toConfigValueDavid Pursehouse2017-09-051-3/+1
| | | | | | | Just return configValue instead of transforming name(). Change-Id: I7f94ab2e206e93d1370467e187c5e68e8f6a8836 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* Merge changes from topic 'dfs-reftable'Shawn Pearce2017-09-054-76/+542
|\ | | | | | | | | | | * changes: dfs: write reftable from DfsGarbageCollector dfs: compact reftables during DfsPackCompactor
| * dfs: write reftable from DfsGarbageCollectorShawn Pearce2017-09-052-14/+339
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If a ReftableConfig has been supplied by the caller, write out a reftable as a sibling of the the GC pack, alongside the heads. To bootstrap from a non-reftable system, the refs are read from the DfsRefDatabase if no GC reftables are present. Its assumed the references are fully current, and do not need to be merged with any other reftables. Any non-GC reftables will be pruned at the end of the GC cycle, just like any packs that were replaced. If a GC reftable is present, all existing reftables are compacted, and references from DfsRefDatabase are only used to seed the packer. Its assumed these are consistent with each other. Change-Id: Ie397eb58aaaefb6865c816d9b39de3ac12998019
| * dfs: compact reftables during DfsPackCompactorShawn Pearce2017-09-052-62/+203
| | | | | | | | | | | | | | Combine intermediate, non-GC reftables when combining pack files. This shrinks the reftable stack, improving lookup times. Change-Id: I5dbba41806f99af5ecaff3a3119f6630e9404256
* | Remove final modifier on args4j option or argument fieldsMatthias Sohn2017-09-054-8/+8
| | | | | | | | | | | | | | | | | | Remove final field modifier since args4j does no longer allow use of final fields [1]. [1] https://github.com/kohsuke/args4j/commit/6e11f89d40dcc518c0e5eb9eef5d74f05d58e6af Change-Id: Ib3dee10828d87d6b558c2e90387eadd9aa2ce260 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | Fix Daemon.stop() to actually stop the listener threadThomas Wolf2017-09-042-39/+188
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ServerSocket.accept() is not interruptible: a thread busy in accept() may not react to Thread.interrupt() and may not return from accept() via an InterruptedException. Close the socket instead to make the daemon's listener thread terminate. * Close the listening socket to get the listening thread to exit instead of interrupting it. * Add a stopAndWait() method that stops the listening thread and then waits until it has indeed finished. * Set SO_REUSE_ADDRESS on the listening socket. Bug: 376369 Change-Id: I9d6014103e6dcb0173daea134feb44dc52c5c69a Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* | Merge "Remove workaround for bug in Java's ReferenceQueue"Shawn Pearce2017-09-041-33/+9
|\ \
| * | Remove workaround for bug in Java's ReferenceQueueMatthias Sohn2017-09-041-33/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Sun's Java 5, 6, 7 implementation had a bug [1] where a Reference can be enqueued and dequeued twice on the same reference queue due to a race condition within ReferenceQueue.enqueue(Reference). This bug was fixed for Java 8 [2] hence remove the workaround. [1] http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6837858 [2] http://hg.openjdk.java.net/jdk8/jdk8/jdk/rev/858c75eb83b5 Change-Id: I2deeb607e3d237f9f825a207533acdee305c7e73 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | | Use Config.getEnum() to read the IgnoreSubmoduleModeThomas Wolf2017-09-041-7/+2
| | | | | | | | | | | | | | | | | | | | | Doing so goes through the TypedConfigGetter and thus allows library clients (for instance EGit) to warn about invalid configurations. Change-Id: If1080ad90b8aff54a903d4d75637614faad6469b Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* | | Don't assume name = path in .gitmodulesThomas Wolf2017-09-042-11/+83
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | While parsing .gitmodules, the name of the submodule subsection is purely arbitrary: it frequently is the path of the submodule, but there's no requirement for it to be. By building a map of paths to the section name in .gitmodules, we can more accurately return the submodule URL. Bug: 508801 Change-Id: I8399ccada1834d4cc5d023344b97dcf8d5869b16 Also-by: Doug Kelly <dougk.ff7@gmail.com> Signed-off-by: Doug Kelly <dougk.ff7@gmail.com> Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch> Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* | Upgrade Maven compiler pluginsDavid Pursehouse2017-09-021-4/+4
| | | | | | | | | | | | | | | | | | - error_prone_core to 2.1.1 - maven-compiler-plugin to 3.6.2 - plexus-compiler-javac{-error-prone} to 2.8.2 Change-Id: I20d864c869f2d03f623ea054b6d08e7ee0eb262a Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* | Upgrade args4j to 2.33 in the bazel buildDavid Pursehouse2017-09-011-2/+2
| | | | | | | | Change-Id: Ic440657e3da53b643f79fbcdde45d4e659bc166d
* | Add org.apache.commons.codec 1.9.0 to target platformMatthias Sohn2017-09-015-5/+13
| | | | | | | | | | | | | | | | | | | | | | | | This is needed to run tests in org.eclipse.jgit.http.test from Eclipse. The change 7ac1bfc8 which added this dependency to org.eclipse.jgit.http.test was already merged. Restrict dependency to org.apache.commons.codec to the version range [1.6.0,2.0.0). CQ: 14048 Change-Id: I461a5f6bfc114757061d68992f9bc7ab38622328 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | Merge "Fix some tests for running in bazel"David Pursehouse2017-08-313-7/+13
|\ \
| * | Fix some tests for running in bazelThomas Wolf2017-08-313-7/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some tests call out to external cgit. Those tests all failed for me locally on Mac. Turned out that the reason was that the system git config used by the git in the bazel run contained paths with ~/ but somehow $HOME was not set. As a result the external git returned with exit code 128. Fix this by passing along $HOME explicitly. Also improve assertions to make sure we do get the stderr of the external command in the test log. I hadn't noticed that until now because apparently the maven build does pass along $HOME. Change-Id: I7069676d5cc7b23a71e79a4866fe8acab5a405f4 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* | | Merge "Update args4j to 2.33"David Pursehouse2017-08-3114-45/+28
|\ \ \
| * | | Update args4j to 2.33Matthias Sohn2017-08-3014-45/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | CQ: 11068 Change-Id: I7d52cddacff05477f646fda5f7b9f2de844922f6 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com> Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* | | | FsckPackParser: Fix warning about int being boxed to IntegerDavid Pursehouse2017-09-011-1/+2
| | | | | | | | | | | | | | | | | | | | Change-Id: I525164090e3990ce353bbb1627aaafaad2c903b6 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>