summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit
Commit message (Collapse)AuthorAgeFilesLines
* DfsReaderIoStats: Clarify that "blocks" are really cache missesDave Borowitz2018-02-221-5/+13
| | | | | | | | | | | | | The previous wording was ambiguous as to whether these were blocks requested from the cache (hits + misses) or read from underlying storage (misses only). They are in fact recording only misses: Accumulator#{readBlock,readBlockBytes,readBlockMicros} are only incremented from BlockBasedFile#readOneBlock, which is only called from the cache miss path in DfsBlockCache#getOrLoad (line 391). Change-Id: I0135cd1e76d09c1e28e0f1833b34c312511c66ce
* PathMatcher: fix handling of **/Marc Strapetz2018-02-228-46/+81
| | | | | | | **/ should match only directories, but not files Change-Id: I885c83e5912cac5bff338ba657faf6bb9ec94064 Signed-off-by: Marc Strapetz <marc.strapetz@syntevo.com>
* Merge changes Id616611e,Ib6509e81,I52f5d3f2David Pursehouse2018-02-221-36/+36
|\ | | | | | | | | | | | | * changes: RepoCommand: generate relative submodule URLs from absolute URLs. RepoCommand: don't record new commit if tree did not change RepoCommand: persist unreadable submodules in .gitmodules
| * RepoCommand: generate relative submodule URLs from absolute URLs.Han-Wen Nienhuys2018-02-211-6/+2
| | | | | | | | | | | | | | | | If a manifest file specifies an absolute URL on the same host on which the superproject resides, rewrite the URLs to be relative. Signed-off-by: Han-Wen Nienhuys <hanwen@google.com> Change-Id: Id616611e5195998fb665c8e7806539a3a02e219a
| * RepoCommand: don't record new commit if tree did not changeHan-Wen Nienhuys2018-02-191-0/+5
| | | | | | | | | | Signed-off-by: Han-Wen Nienhuys <hanwen@google.com> Change-Id: Ib6509e816684256d723558d5e8f3c37de58a2ff8
| * RepoCommand: persist unreadable submodules in .gitmodulesHan-Wen Nienhuys2018-02-191-30/+29
| | | | | | | | | | | | | | | | | | | | | | | | In cases where a manifest file mixes different remotes, a Gerrit server process may not have access to all remotes, and won't be able to produce a full submodule tree. Preserving this information in .gitmodules will let downstream clients reconstruct the full tree. Signed-off-by: Han-Wen Nienhuys <hanwen@google.com> Change-Id: I52f5d3f288e771dca0af2b4dd3f3fa0f940dcf15
* | dfs: Try to avoid searching UNREACHABLE_GARBAGE during packingShawn Pearce2018-02-211-12/+54
|/ | | | | | | | | | | If an object can be found in a non-garbage pack, favor that pack over paging in the garbage pack's idx and pack content. Only fall back to garbage packs if an object cannot be found and there are garbage packs present in the repository. This fallback is required to correct race conditions during GC. Change-Id: Ia7c123975bc069b8e6e713eda2d357303b71e329
* Silence API error for new constant in ConfigConstantsMatthias Sohn2018-02-181-0/+8
| | | | Change-Id: Ic4bd10b67caf6b2a2cc0c23bb4e7c717e4ccd6d5 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Silence API errors raised for new public fields in PackStatisticsMatthias Sohn2018-02-181-0/+26
| | | | Change-Id: I8e118282a833361b676aa3cc90cbe774ccd42ed0 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* LFS: Add remote download to SmudgeFilterMarkus Duft2018-02-163-1/+8
| | | | | | | | | | | | | | | Transfer data in chunks of 8k Transferring data byte per byte is slow, running checkout with CleanFilter on a 2.9MB file takes 20 seconds. Using a buffer of 8k shrinks this time to 70ms. Also register the filter commands in a way that the native GIT LFS can be used alongside with JGit. Implements auto-discovery of LFS server URL when cloning from a Gerrit LFS server. Change-Id: I452a5aa177dcb346d92af08b27c2e35200f246fd Also-by: Christian Halstrick <christian.halstrick@sap.com> Signed-off-by: Markus Duft <markus.duft@ssi-schaefer.com>
* RepoCommand: Don't leave Git openDavid Pursehouse2018-02-151-79/+79
| | | | | | | | | | | | When the command is run on a non-bare repository, an instance of Git is created to execute the commit, and is left open when the command has finished. Refactor to not use a class scope Git instance, and make sure it gets closed before returning. Change-Id: Ic623ae0fd8b9e264b5dfd434da0de6bb4f910984 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* Merge "Merge branch 'stable-4.10'"Matthias Sohn2018-02-141-2/+16
|\
| * Merge branch 'stable-4.10'Matthias Sohn2018-02-141-2/+16
| |\ | | | | | | | | | | | | | | | | | | | | | | | | * stable-4.10: Fix ssh host name handling for Jsch Jsch overrides the port in the URI with the one in ~/.ssh/config Change-Id: I860fc61ceb12ae792b1ee7421046ecd32373b9f8 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| | * Merge branch 'stable-4.9' into stable-4.10Matthias Sohn2018-02-141-2/+16
| | |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-4.9: Fix ssh host name handling for Jsch Jsch overrides the port in the URI with the one in ~/.ssh/config Change-Id: Iff9076f65e767bbe8df016337b631bdaeb40ad98 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| | | * Fix ssh host name handling for JschThomas Wolf2018-02-141-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If we give Jsch access to the ssh config file, we must _not_ resolve the host name from the alias. Instead we must give the alias (i.e., the host name as is in the URI) to Jsch, so that it finds the same ssh config entry. Otherwise if the hostname in the URI, which is taken as an alias in ssh config ("Host" line), is unequal to the "Hostname" line, and there happens to be another ssh config entry with that translated host name as alias, Jsch will pick up that second entry, and we end up with a strange mixture of both. Add tests for this case. Bug: 531118 Change-Id: I249d8c073b0190ed110a69dca5b9be2a749822c3 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
| | | * Jsch overrides the port in the URI with the one in ~/.ssh/configThomas Wolf2018-02-141-1/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Jsch unconditionally overwrites the port from the ssh config file (if a port is specified there), even if the URI explicitly does give a different port. Fix this, and add tests. Change-Id: I7b014543c7ece26270e366db39d7647f82d64f0d Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
| | * | Merge branch 'stable-4.9' into stable-4.10David Pursehouse2018-02-011-3/+3
| | |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-4.9: Minor fixes in three error messages Change-Id: Ibd6bcecb40a6d97c46c66360020dca7453876298 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
| | | * Minor fixes in three error messagesThomas Wolf2018-01-311-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * Fix "can not" -> "cannot" in two messages * Re-word "Cannot mkdir" to "Cannot create directory" Change-Id: Ide0cec55eeeebd23bccc136257c80f47638ba858 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* | | | Merge "InitCommand: Don't leave Repository open after Git is closed"David Pursehouse2018-02-141-1/+4
|\ \ \ \ | |/ / / |/| | |
| * | | InitCommand: Don't leave Repository open after Git is closedDavid Pursehouse2018-02-141-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The InitCommand returns a Git that is instantiated with the newly created Repository, but the Repository is not closed with the Git resulting in resource leaks. Create the Git with `closeRepo` set to true, such that the Repository is also closed when the Git is closed. Adjust the tests to use try-with-resource on the Git instance. Change-Id: Ib26e7428c7d8840956d1edb09e53b93e23e6fe5a Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* | | | Merge "TransportLocal should reuse FS from source repo"Matthias Sohn2018-02-141-1/+3
|\ \ \ \ | |/ / / |/| | |
| * | | TransportLocal should reuse FS from source repoMarc Strapetz2017-12-291-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is necessary to make sure that the FS set to e.g. the CloneCommand will be passed on and used by the new repository Change-Id: I9f81f65df784099b07e548b91482e7ace3f5a17e Signed-off-by: Marc Strapetz <marc.strapetz@syntevo.com>
* | | | Add a minimum negotiation feature for fetchTerry Parker2018-02-122-16/+84
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Android an Chrome have several repos with >300k refs. We sometimes see negotiations of >100k rounds. This change provides a "minimal negotiation" feature on the client side that limits how many "have" lines the client sends. The client extracts the current SHA-1 values for the refs in its wants set, and terminates negotiation early when all of those values have been sent as haves. If a new branch is being fetched then that set will be empty and the client will terminate after current default minimum of two rounds. This feature is gated behind a "fetch.useminimalnegotiation" configuration flag, which defaults to false. Change-Id: Ib12b095cac76a59da6e8f72773c4129e3b32ff2b Signed-off-by: Terry Parker <tparker@google.com>
* | | | Add negotiation statistics to PackStatisticsTerry Parker2018-02-123-10/+113
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add fetch statistics for the counts of advertised refs, wants and haves. Also add the duration in milliseconds for the negotiation phase. For non-bidirectional transports like HTTP, this is the time for the final round that sends the pack back to the user. Change-Id: I1af7ffd3cb7b62182340682e2a243691ea24ec2e Signed-off-by: Terry Parker <tparker@google.com>
* | | | MergedReftable to skip shadowed refs in same reftableMinh Thai2018-02-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This would allow compact and GC process to clean up duplicate ref names in the reftables. Change-Id: I2b9df0bf72dba63cc3525e374982e60559a776c2 Signed-off-by: Minh Thai <mthai@google.com>
* | | | Fix CleanCommand not to throw FileNotFoundExceptionsChristian Halstrick2018-02-081-14/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When CleanCommand is collecting the files and folders to be deleted it may happen that the list of directories contains obsolete entries. E.g. a folder and its parent folder may be in the list. Only the parent folder would be sufficient. This was a reason for hitting FileNotFoundExceptions when finally trying to delete the files and folders. Improve CleanCommand to ignore files to be deleted which are already gone. Bug: 514434 Change-Id: I10caa01bfb9cec5967dfdaea50c6e4a713eeeabd Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | | | GC: Remove empty references foldersHector Caballero2018-02-071-0/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | After packaging references, the folders containing these references are not deleted. In a busy repository, this causes operations to slow down as traversing the references tree becomes longer. Delete empty reference folders after the loose references have been packed. To avoid deleting a folder that was just created by another concurrent operation, only delete folders that were not modified in the last 30 seconds. Signed-off-by: Hector Oswaldo Caballero <hector.caballero@ericsson.com> Change-Id: Ie79447d6121271cf5e25171be377ea396c7028e0
* | | | Bazel: Support building with Java 9David Ostrovsky2018-02-071-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Bazel@HEAD supports Java 9. The current code has one single issue with Java 9 compliance: the usage of javax.xml.bind.DatatypeConverter class for printHexBinary() method. This class is not available on Java 9. One alternative is to use guava library. Something similar was done here: [1]. But unlike the case with checkstyle library, JGit currently doesn't use guava. Instead, we add java.xml.bind module with --add-modules compiler option. To build (or test) with Java 9, build custom bazel version and issue: $ bazel --host_javabase=/usr/lib64/jvm/java-9-openjdk build \ --javacopt='--release 9' \ --java_toolchain=@bazel_tools//tools/jdk:toolchain_jdk9 :all The Java 9 support is backwards compatible. * [1] https://github.com/checkstyle/checkstyle/issues/5027 Change-Id: I2c5203fc4e65885ce7b210f824fda85ba6d6c51d Signed-off-by: David Ostrovsky <david@ostrovsky.org>
* | | | GC: Merge if statement with the enclosing oneHector Caballero2018-02-061-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Reported by Sonar. Signed-off-by: Hector Oswaldo Caballero <hector.caballero@ericsson.com> Change-Id: Ib6fe6c67d6f7697e6d60693d5cee7e9c6a227767
* | | | GC: Replace Files methods with File alternativesHector Caballero2018-02-061-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The Files.exists method has noticeably poor performance in JDK 8 and can slow an application significantly when used to check files that do not actually exist. The same goes for Files.notExists, Files.isDirectory and Files.isRegularFile [1]. Replace them with their File counterpart. [1] https://rules.sonarsource.com/java/tag/performance/RSPEC-3725 Signed-off-by: Hector Oswaldo Caballero <hector.caballero@ericsson.com> Change-Id: I89d23b9cc74bec8e05f6b7f3e49bfd967dbb6373
* | | | GC: Replace anonymous classes with lambdasHector Caballero2018-02-061-30/+22
| | | | | | | | | | | | | | | | | | | | Signed-off-by: Hector Oswaldo Caballero <hector.caballero@ericsson.com> Change-Id: Ic9725bdb1a281c80055a5438a02d961b1d1875f4
* | | | GC: Simplify lambdaHector Caballero2018-02-061-5/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | filter() stream operation also accepts a lambda expression. Signed-off-by: Hector Oswaldo Caballero <hector.caballero@ericsson.com> Change-Id: Ie0b7fe43d39593172969fd16c3e44b49bac27306
* | | | GC: Simplify reference equals() methodHector Caballero2018-02-061-9/+6
| | | | | | | | | | | | | | | | | | | | Signed-off-by: Hector Oswaldo Caballero <hector.caballero@ericsson.com> Change-Id: I5b2e12e012d5423e9b84c1c66a478960121ea212
* | | | GC: Simplify boolean expressionHector Caballero2018-02-061-2/+2
| | | | | | | | | | | | | | | | | | | | Signed-off-by: Hector Oswaldo Caballero <hector.caballero@ericsson.com> Change-Id: I0e7a365c26b2333627fcc26b9ea9f4fcd65e8746
* | | | GC: Simplify expressionHector Caballero2018-02-061-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Avoid converting path to file to then reconvert it to path. Signed-off-by: Hector Oswaldo Caballero <hector.caballero@ericsson.com> Change-Id: I6a8c3ca9b83bf9b0eead9506938f5d68b27a76f5
* | | | GC: Remove redundant type argumentsHector Caballero2018-02-061-2/+2
| | | | | | | | | | | | | | | | | | | | Signed-off-by: Hector Oswaldo Caballero <hector.caballero@ericsson.com> Change-Id: Id3281a744b08f9d7b2b60f69b4e461b053ac5d02
* | | | GC: Remove unnecessary continue statementHector Caballero2018-02-061-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | continue is unnecessary when it is the last statement in a loop Signed-off-by: Hector Oswaldo Caballero <hector.caballero@ericsson.com> Change-Id: I12af9f9a0bb2fd7fc0239f1f3b59fb8e64e1f351
* | | | Close RevWalk in BranchTrackingStatus.of()Matthias Sohn2018-02-061-12/+15
| | | | | | | | | | | | | | | | | | | | Bug: 530757 Change-Id: I985ee5395e1468981c28ae0a80797732e2f528d2 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | | | Basic submodule merge handlingDavid Turner2018-02-045-10/+145
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This doesn't handle the really hard thing, which is merging spurious conflicts inside .gitmodules files. That's OK: git.git doesn't either. Users can resolve the conflict themselves and then commit the merge. Previously, jgit would crash when attempting to merge conflicting submodule changes. Even if there was no conflict, after a merge which adds submodules, the repository would have been missing empty directories for newly-added submodules. This patch fixes the crash, and adds the empty directories where necessary. It ensures that the index is in a conflicted state when submodule changes conflict. Reported-by: Alexey Korobkov Bug: 494551 Change-Id: I79db6798c2bdcc1159b5b2589b02da198dc906a1 Signed-off-by: David Turner <dturner@twosigma.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | | | Add class to access WindowCache statisticsDavid Pursehouse2018-02-032-3/+80
| | | | | | | | | | | | | | | | | | | | Change-Id: Iacb5b65539efd92a6b45afc307ebf246e8b8fccf Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* | | | Use a TemporaryBuffer to do a content mergeThomas Wolf2018-02-021-84/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This avoids having to re-read the merged file (twice even!) to update the index. Change-Id: Id13e0fd38906ed6f859604f86ca352761dca9ffe Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* | | | Fix index blob for merges with CRLF translationsThomas Wolf2018-02-021-5/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit fc7d407 corrected line endings for working tree files resulting from merges when CRLF translations are to be done. However, that also resulted in the file content being put as-is into the index, which is wrong. The index must contain the file content with reverse CRLF translations applied. With core.autocrlf=true, the working tree file should have CR-LF, but the index blob must still contain only LF. Fix this oversight and apply the inverse translation when updating the index, similar to what is done in AddCommand. Bug: 499615 Change-Id: I3a33931318bdb580b2390f3450f91ea8f258a6a4 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* | | | Honor CRLF settings when writing merge resultsThomas Wolf2018-02-022-5/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Merges are performed using the raw text as stored in the git repository. When we write the merge result, we must apply the correct CRLF settings. Otherwise the line endings in the result will be wrong. Bug: 499615 Change-Id: I37a9b987e9404c97645d2720cd1c7c04c076a96b Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | | | Minor fixes in three error messagesThomas Wolf2018-01-301-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * Fix "can not" -> "cannot" in two messages * Re-word "Cannot mkdir" to "Cannot create directory" Change-Id: Ide0cec55eeeebd23bccc136257c80f47638ba858 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* | | | Minor improvements in git config file inclusionsThomas Wolf2018-01-283-5/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Section and key names in git config files are case-insensitive. * If an include directive is invalid, include the line in the exception message. * If inclusion of the included file fails, put the file name into the exception message so that the user knows in which file the problem is. Change-Id: If920943af7ff93f5321b3d315dfec5222091256c Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* | | | Progress reporting for checkoutMarkus Duft2018-01-2311-1/+138
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The reason for the change is LFS: when using a lot of LFS files, checkout can take quite some time on larger repositories. To avoid "hanging" UI, provide progress reporting. Also implement (partial) progress reporting for cherry-pick, reset, revert which are using checkout internally. The feature is also useful without LFS, so it is independent of it. Change-Id: I021e764241f3c107eaf2771f6b5785245b146b42 Signed-off-by: Markus Duft <markus.duft@ssi-schaefer.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | | | Enforce DFS blockLimit is a multiple of blockSizeDave Borowitz2018-01-223-6/+31
| | | | | | | | | | | | | | | | Change-Id: I2821124ff88d7d1812a846ed20f3828fc9123b38
* | | | Revert usage of TYPE_USE in Nullable and NonNull annotationsDavid Pursehouse2018-01-195-7/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Using TYPE_USE causes compilation errors in Eclipse Neon.3 (JDT 3.12.3) and Eclipse Oxygen.2 (JDT 3.13.2). This reverts commit 8e217517e2c515032dd0d661535d2133cd80123a. This reverts commit 55eba8d0f55464ca84d676828f67a6fe14b2454d. Reported-by: Thomas Wolf <thomas.wolf@paranor.ch> Change-Id: I96869f80dd11ee238911706581b224bca4fb12cd Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* | | | Nullable: Switch to TYPE_USEDavid Pursehouse2018-01-184-12/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since JGit now requires Java 8, we can switch to TYPE_USE instead of explicitly specifying the target type. Some of the existing uses of Nullable need to be reworked slightly as described in [1] to prevent the compilation error: scoping construct cannot be annotated with type-use annotation [1] https://stackoverflow.com/a/21385939/381622 Change-Id: Idba48f67a09353b5237685996ce828c8ca398168 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* | | | NonNull: Switch to TYPE_USEDavid Pursehouse2018-01-181-6/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since JGit now requires Java 8, we can switch to TYPE_USE instead of explicitly specifying the target type. Change-Id: I373d47c3d92507459685789df1fad0933d5625ff Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>