summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Return 'this' from setters in commandsMario Molina2019-01-073-20/+131
| | | | | | | | | To avoid breaking ABI, take the opportunity to give these setters (hopefully sometimes better) names and deprecate their old names. Change-Id: Ib45011678c3d941f8ecc1a1e0fdf4c09cdc337e3 Signed-off-by: Mario Molina <mmolimar@gmail.com> Signed-off-by: Jonathan Nieder <jrn@google.com>
* Upgrade wagon-ssh to 3.3.1David Pursehouse2019-01-071-1/+1
| | | | | Change-Id: I7428e55302e673380b1ab024b5ee2fd71308b40f Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* Upgrade spotbugs-maven-plugin to 3.1.10David Pursehouse2019-01-071-1/+1
| | | | | Change-Id: I800930d34491ae5568d47ccc59271b6ad4a24c3d Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* Don't swallow IOExceptionJonathan Nieder2019-01-071-9/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Swallowing intermittent errors and trying to recover from them makes JGit's behavior hard to predict and difficult to debug. Propagate the errors instead. This doesn't violate JGit's usual backward compatibility promise for clients because in these contexts an IOException indicates either repository corruption or a true I/O error. Let's consider these cases one at a time. In the case of repository corruption, falling back e.g. to an empty set of refs or a missing ref will not serve a caller well. The fallback does not indicate the nature of the corruption, so they are not in a good place to recover from the error. This is analogous to Git, which attempts to provide sufficient support to recover from corruption (by ensuring commands like "git branch -D" cope with corruption) but little else. In the case of an I/O error, the best we can do is to propagate the error so that the user sees a dialog and has an opportunity to try again. As in the corruption case, the fallback behavior does not provide enough information for a caller to rely on the current error handling, and callers such as EGit already need to be able to handle runtime exceptions. To be conservative, keep the existing behavior for the deprecated Repository#peel method. In this example, the fallback behavior is to return an unpeeled ref, which is distinguishable from the ref not existing and should thus at least be possible to debug. Change-Id: I0eb58eb8c77519df7f50d21d1742016b978e67a3 Signed-off-by: Jonathan Nieder <jrn@google.com>
* Merge "Deprecate Repository#hasObject"Jonathan Nieder2019-01-0718-131/+146
|\
| * Deprecate Repository#hasObjectJonathan Nieder2019-01-0418-131/+146
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Its implementation contains } catch (IOException e) { // Legacy API, assume error means "no" return false; } Better to use ObjectDatabase#has, which throws IOException to report errors. Change-Id: I7de02f7ceb8f57b2a8ebdb16d2aa4376775ff933 Signed-off-by: Jonathan Nieder <jrn@google.com>
* | Apache MINA sshd client: less aggressive key file name cachingThomas Wolf2019-01-054-5/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | Don't use the ~/.ssh directory as cache key for the key provider but the configured paths of the default keys. Otherwise changes in that list of paths are not picked up. This is in particular a problem for EGit, where the user can modify this list of keys interactively in the preferences. Without this change, Eclipse needs to be restarted to pick up such changes. Bug: 542845 Change-Id: I63432fb10729a90b3c5e14f13e39bf482aef811b Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* | Correct target name for jgit-4.10-stagingDave Borowitz2019-01-042-3/+3
|/ | | | Change-Id: I130c7f1420b6b3753f4d419a37d16633755da21c
* Deprecate RawParseUtils.UTF8-CHARSETMichael Keppler2019-01-041-0/+3
| | | | | | | | | That constant is just a redirection to a java standard constant meanwhile. It is not referenced anymore in jgit code (and egit is just removing it). Clients can use the redirection target directly. Change-Id: I058d013f61da8d7b771c499d8743aafb8faa5ea8 Signed-off-by: Michael Keppler <Michael.Keppler@gmx.de> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Fix detection of "initial checkout"Christian Halstrick2019-01-021-3/+3
| | | | | | | | | | | | | | | | | A checkout done directly after cloning (the "initial checkout") has a different semantic as a default checkout. That is defined in the documentation of "git read-tree" [1]. JGit was detecting that it is doing an initial checkout differently from native git: jgit used to check that the index is empty but native git required that the index file does not exist [2]. Teach JGit to behave like native git. [1] https://github.com/git/git/blob/master/Documentation/git-read-tree.txt#L187 [2] https://marc.info/?t=154150811200001&r=1&w=2 Change-Id: I1dd0f1ede7cd7ea60d28607916d0165269a9f628
* Upgrade plexus-compiler-javac-errorprone to 2.8.5David Pursehouse2019-01-021-1/+1
| | | | | Change-Id: I2898eef32472216a5fb33f5a036588dd022445cb Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* Replace deprecated FirstLine by FirstCommandMichael Keppler2018-12-312-2/+3
| | | | | | | | and allow package org.eclipse.jgit.http.server to use package org.eclipse.jgit.internal.transport.parser. Change-Id: Ief330c3e75a735853d0a5a265a9ff56fb5128b99 Signed-off-by: Michael Keppler <Michael.Keppler@gmx.de> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Move BaseReceivePack#advertisedRefs getter and setter to ReceivePackJonathan Nieder2018-12-295-27/+80
| | | | | | | Another step toward merging BaseReceivePack into ReceivePack. Change-Id: If861e28ce512f556e574352fa7d4a0df0984693f Signed-off-by: Jonathan Nieder <jrn@google.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Move BaseReceivePack#walk getter to ReceivePackJonathan Nieder2018-12-293-4/+21
| | | | | | | Another step toward merging BaseReceivePack into ReceivePack. Change-Id: I43cf2e36e2d5b0cd85bf23c81469909c14757b63 Signed-off-by: Jonathan Nieder <jrn@google.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Move BaseReceivePack#db getter to ReceivePackJonathan Nieder2018-12-293-4/+20
| | | | | | | Another step toward eliminating BaseReceivePack as a separate API. Change-Id: If7b7d5c65a043607a2424211adb479fa33a9077b Signed-off-by: Jonathan Nieder <jrn@google.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Move BaseReceivePack#pushCert getter and setter to ReceivePackJonathan Nieder2018-12-293-7/+50
| | | | | | | | | This is a first step toward eliminating the BaseReceivePack API. Inspired by a larger change by Dan Wang <dwwang@google.com>. Change-Id: I5c876a67d8db24bf808823d9ea44d991b1ce5277 Signed-off-by: Jonathan Nieder <jrn@google.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Remove unused API problem filtersMatthias Sohn2018-12-291-74/+0
| | | | Change-Id: I8ed98ac60362ba071506b0bdacd2941ab72b6bf4 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Silence API error for RefDatabase.getRef declared finalMatthias Sohn2018-12-291-0/+6
| | | | | | | | RefDatabase.getRef was declared final in c1954f6c366121f971699573322a2669c7dd9430 which only affects implementers. Change-Id: I4c14232a119670d263d88db2b8d725dcdd36ab2a Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Suppress API errors and add missing @since tags caused by 6ea888aMatthias Sohn2018-12-293-0/+21
| | | | Change-Id: Id042d46ba078af35b9c22a079da4ae14fc5fa231 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Merge changes Id3bb9443,I1be1948bJonathan Nieder2018-12-287-53/+57
|\ | | | | | | | | | | * changes: RefDatabase: Introduce findRef synonym for getRef RefDirectory: Look up several exact refs in one shot
| * RefDatabase: Introduce findRef synonym for getRefJonathan Nieder2018-12-267-67/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Using findRef instead of getRef makes it clearer that the caller wants to search for the ref in the search path, instead of looking for a ref that exactly matches the input. This change introduces the new findRef method and deprecates getRef. It updates Repository#findRef to use the new method, ensuring some test coverage. Other callers will be updated in followup changes. A nice side effect of introducing the new findRef method is that it is final and based on firstExactRef, so implementers can focus on implementing the latter efficiently and do not have to carefully write custom path search code respecting SEARCH_PATH. Change-Id: Id3bb944344a9743705fd1f20193ab679298fa51c Signed-off-by: Jonathan Nieder <jrn@google.com>
| * RefDirectory: Look up several exact refs in one shotJonathan Nieder2018-12-261-0/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Override exactRef(String...) and firstExactRef(String...) with implementations specific to FileRepository. The specialized implementations are similar to the generic ones from RefDatabase, but because these use readRef directly instead of exactRef, they only need to call fireRefsChanged once. This will allow replacing RefDirectory#getRef with a generic implementation that uses firstExactRef without hurting performance. Change-Id: I1be1948bd6121c1a1e8152e201aab97e7fb308bb Signed-off-by: Jonathan Nieder <jrn@google.com>
* | Move first line parsing for v0 push out of BaseReceivePackJonathan Nieder2018-12-273-15/+121
|/ | | | | | | | | | This simplifies the BaseReceivePack class and decreases its API surface, which should make merging with ReceivePack easier. Inspired by 6aca8899a5c02b3f6be7b9196cf5e935914476f0 (Move first line parsing for v0/v1 pack negotiation out of UploadPack, 2018-09-17). Change-Id: I1fc175d15aa7cb5968c26fc83a95480403af617c
* RefDirectory: Do not use search path to find additional refsJonathan Nieder2018-12-262-1/+24
| | | | | | | | | Psuedorefs like FETCH_HEAD and MERGE_HEAD are supposed to be directly under the .git directory, not in other locations in the SEARCH_PATH like refs/ and refs/heads/. Use exactRef to access them. Change-Id: Iab8ac47008822fa78fc0691e239e518c34d7a98e Signed-off-by: Jonathan Nieder <jrn@google.com>
* RefDatabase: Remove fallback exactRef implementationJonathan Nieder2018-12-263-7/+14
| | | | | | | | This is simpler to implement than getRef. Make it abstract so implementers remember to override it. Change-Id: I5f319be1fb1206d7a0142ea939dc4e1039f850ab Signed-off-by: Jonathan Nieder <jrn@google.com>
* RefDirectory: Fire RefsChangedEvent on error, tooJonathan Nieder2018-12-261-11/+15
| | | | | | | | | | | | | | | getRef and exactRef can produce recoverable exceptions --- for example, a corrupt loose ref that cannot be parsed. If readRef was called and updated looseRefs in the process, RefsChangedEvent should still be fired. Noticed while improving the implementation of getRef. This commit only affects exactRef and getRef. Other methods might be similarly skipping firing RefsChangedEvent in their error handling code, and this change does not fix them. Change-Id: I0f460f6c8d9a585ad8453a4a47c1c77e24a1fb83 Signed-off-by: Jonathan Nieder <jrn@google.com>
* RefDirectory: Refactor getRef and exactRef to share codeJonathan Nieder2018-12-261-20/+14
| | | | | | | | | | | | Both getRef and exactRef look for a ref or pseudoref in the $GIT_DIR directory, with careful error handling to handle non-refs like .git/config. Avoid the duplication by factoring out a helper that takes care of this. This should make the code easier to understand and manipulate. Change-Id: I2ea67816d2385e84e2d3394b897e23df5826ba50 Signed-off-by: Jonathan Nieder <jrn@google.com>
* Merge changes from topic 'update-index-ref-decorator'Jonathan Nieder2018-12-2617-60/+342
|\ | | | | | | | | | | * changes: RefCursor: Remove unnecessary getUpdateIndex method RefDatabase/Ref: Add versioning to reference database
| * RefCursor: Remove unnecessary getUpdateIndex methodIvan Frade2018-12-267-34/+2
| | | | | | | | | | | | | | | | Now the reference carries its updateIndex, so the cursor doesn't need to expose it. Change-Id: Icbfca46f92a13f3d8215ad10b2a166a6f40b0b0f Signed-off-by: Ivan Frade <ifrade@google.com>
| * RefDatabase/Ref: Add versioning to reference databaseIvan Frade2018-12-2614-28/+342
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In DFS implementations the reference table can fall out of sync, but it is not possible to check this situation in the current API. Add a property to the Refs indicating the order of its updates. This version is set only by RefDatabase implementations that support versioning (e.g reftable based). Caller is responsible to check if the reference db creates versioned refs before accessing getUpdateIndex(). E.g: Ref ref = refdb.exactRef(...); if (refdb.hasVersioning()) { ref.getUpdateIndex(); } Change-Id: I0d5ec8e8df47c730301b2e12851a6bf3dac9d120 Signed-off-by: Ivan Frade <ifrade@google.com>
* | Update org.tukaani.xz to 1.8.0.v20180207-1613Matthias Sohn2018-12-249-23/+23
| | | | | | | | | | CQ: 18321 Change-Id: I49f47748e7753146c0d696b2bd381d2d3465691e Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | Skip some tests when the runtime cannot handle Unicode file pathsMasaya Suzuki2018-12-232-7/+52
| | | | | | | | | | | | | | | | | | | | | | | | When executing a test with LANG environment variable set to non UTF-8 encoding, it seems that JRE cannot handle Unicode file paths. This happens when this test is executed in Bazel as it unsets LANG (https://docs.bazel.build/versions/master/test-encyclopedia.html#initial-conditions). Skip the test if the runtime cannot handle Unicode file paths. Change-Id: I16bd3cd959dbaf2335b9c5202873e2f12ed0ba21 Signed-off-by: Masaya Suzuki <masayasuzuki@google.com>
* | Change RacyGitTests to create a racy git situation in a stable wayMasaya Suzuki2018-12-231-29/+24
| | | | | | | | | | | | | | | | | | | | | | By using File#setLastModified, we can create a racy git situation stably. Tested with --runs_per_test=100 Bug: 526111 Change-Id: I60b3632d353e19f335668325aa603640be423f58 Signed-off-by: Masaya Suzuki <masayasuzuki@google.com>
* | Capture test coverage and add an aggregate test coverage reportMatthias Sohn2018-12-2114-10/+245
| | | | | | | | | | | | | | | | | | | | | | | | | | Configure Maven build to capture test coverage using jacoco. Add new org.eclipse.jgit.coverage Maven module to aggregate jacoco test coverage results and generate test coverage HTML report at org.eclipse.jgit.coverage/target/site/jacoco-aggregate/index.html See https://www.eclemma.org/jacoco/trunk/doc/maven.html Change-Id: Iaeec4033e448ebc16965c05ab54109c4155a307a Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | JGitInternalException: Fix typo in JavadocDavid Pursehouse2018-12-221-1/+1
|/ | | | | Change-Id: I46fabab3cb2d9164234ce04de346826687a3fa35 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* Avoid double wordsMincong HUANG2018-12-2123-34/+34
| | | | | Change-Id: I0fdf595cba93f5a5cdd0496cee07ac91db304532 Signed-off-by: Mincong Huang <mincong.h@gmail.com>
* Silence API error for 3 digit version number in @since tagMatthias Sohn2018-12-211-0/+14
| | | | Change-Id: I4943d9338ddf294e2ef67f0d459a3030f528d0c9 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Remove unnecessary @since tags from non-API classesDavid Pursehouse2018-12-207-7/+0
| | | | | Change-Id: I6bed174c062a0785641dc8ad69151bf7e843cdcf Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* Merge branch 'stable-5.2'David Pursehouse2018-12-204-3/+38
|\ | | | | | | | | | | | | | | | | | | * stable-5.2: BasePackConnection: Check for expected length of ref advertisement TransferConfig: Make constructors public Update last JGit version Change-Id: I4406d4f68136a2ce363701324b9a842ad468bc59 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
| * Merge branch 'stable-5.1' into stable-5.2David Pursehouse2018-12-204-3/+38
| |\ | | | | | | | | | | | | | | | | | | | | | | | | * stable-5.1: BasePackConnection: Check for expected length of ref advertisement TransferConfig: Make constructors public Change-Id: I2480a0455250ee381fae93cac2db30f8305fa6aa Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
| | * BasePackConnection: Check for expected length of ref advertisementDavid Pursehouse2018-12-203-1/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When a server sends a ref advertisement using protocol v2 it contains lines other than ref names and sha1s. Attempting to get the sha1 out of such a line using the substring method can result in a SIOOB error when it doesn't actually contain the sha1 and ref name. Add a check that the line is of the expected length, and subsequently that the extracted object id is valid, and if not throw an exception. Change-Id: Id92fe66ff8b6deb2cf987d81929f8d0602c399f4 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
| | * TransferConfig: Make constructors publicDavid Pursehouse2018-12-201-2/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | UploadPack has a setTransferConfig method which allows to set the transfer config, however since the constructors of TransferConfig have the default package visibility it is not possible for any application using UploadPack, for example Gerrit, to actually set a transfer config. Make the constructors public. This is consistent with the public constructors for example on PackConfig. Change-Id: I07080255838421871403b2b2bcc294aa8f621c57 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
| * | Update last JGit versionThomas Wolf2018-12-151-1/+1
| | | | | | | | | | | | | | | | | | The jgit-last-release-version is used by japicmp as baseline. Change-Id: If56cc1785b61c92c9a05c8c29c6cb62001e89218 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* | | LfsGson: Remove unnecessary @since tagDavid Pursehouse2018-12-201-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The tag is formed inconsistently to tags in the rest of the JGit code base (i.e. "4.10.0" with a trailing ".0" where all the others don't). However since this class is not in the public API, the @since tag is not necessary and can just be removed. Change-Id: Ifa3f543f819a39453fcf343278e522b5d7b003c3 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* | | UploadPack: Rewrite setAdvertiseRefsHook to use ternary operatorDavid Pursehouse2018-12-191-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | This makes the implementation consistent with the other similar methods in this class. Change-Id: I007876aad883615d696c8eabc886818ae00b10ee Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* | | UploadPack: Prevent setting null protocolV2HookDavid Pursehouse2018-12-191-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The setProtocolV2Hook sets the protocolV2Hook to whatever value is passed, which could be null, but the invocations of protocolV2Hook's methods are not guarded by null-checks. Annotate the parameter as @Nullable and set ProtocolV2Hook.DEFAULT when null is passed. This makes the implementation consistent with other similar methods that set a hook or filter with possible null value. Change-Id: I70919a3248d4c2658783941a37c47e437cff0baa Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* | | UploadPack: Add @Nullable annotationsDavid Pursehouse2018-12-191-8/+9
| | | | | | | | | | | | | | | | | | | | | | | | The class has several methods where passing a null parameter is valid. Annotate those parameters as @Nullable. Change-Id: Ie08893ee3ab34c1ffb2db875b4ab049ad065c697 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* | | Upgrade maven-jar-plugin to 3.1.1David Pursehouse2018-12-161-1/+1
| | | | | | | | | | | | | | | Change-Id: I1b230fb558bc4773594a11292ee12820abe3ebaf Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* | | Upgrade Tycho to 1.3Michael Keppler2018-12-162-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | With the upcoming Eclipse release 2018-12 a new version of Tycho has been released. Upgrade the Tycho related build steps to the new version in the Maven build. Change-Id: Ifff186a9f97ed9faf70f15b20396724b0c9e801c Signed-off-by: Michael Keppler <Michael.Keppler@gmx.de>
* | | Enable japicmp for new SSH bundle; update its baselineThomas Wolf2018-12-152-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | In the original contribution of this bundle, japicmp was disabled as no previous version to compare against existed. Enable it now. Update the version to compare against to 5.2.0.201812061821-r. Change-Id: I42f812befde2d0d98db5f87e05230b51af244ae6 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>