aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit
Commit message (Collapse)AuthorAgeFilesLines
* JGit v4.8.0.201706111038-rv4.8.0.201706111038-rMatthias Sohn2017-06-113-4/+4
| | | | | Change-Id: Ie33623a2191ffffc2ca5756fd078a7003c0c660f Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Allow to use an external ExecutorService for background auto-gcMatthias Sohn2017-06-115-6/+29
| | | | | | | | If set use the external executor, otherwise use JGit's own simple WorkQueue. Move WorkQueue to an internal package so we can reuse it without exposing it in the public API. Change-Id: I060d62ffd6692362a88b4bf13ee07b0dc857abe9 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Fetch: Add --recurse-submodules and --no-recurse-submodules optionsDavid Pursehouse2017-06-112-2/+45
| | | | | | | | | | Add options to control recursion into submodules on fetch. Add a callback interface on FetchCommand, to allow Fetch to display an update "Fetching submodule XYZ" for each submodule. Change-Id: Id805044b57289ee0f384b434aba1dbd2fd317e5b Signed-off-by: David Pursehouse <david.pursehouse@gmail.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* SubmoduleUpdateCommand#setCallback should return 'this'Matthias Sohn2017-06-101-1/+3
| | | | | | | | | The other methods in this class follow the builder pattern, and return 'this', allowing multiple method calls to be chained in a single statement. Update the setCallback method to do the same. Change-Id: I4ddaacd6d50601f47f61eb6be8b62c8d59cce062 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* CloneCommand#setCallback should return 'this'David Pursehouse2017-06-081-1/+3
| | | | | | | | | | | The other methods in this class follow the builder pattern, and return 'this', allowing multiple method calls to be chained in a single statement. Update the setCallback method to do the same. Change-Id: I0366d28bf66ba47f08ee7eee636d613c9fe079f5 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* Merge branch 'stable-4.7' into stable-4.8David Pursehouse2017-06-081-0/+6
|\ | | | | | | | | | | | | | | | | * stable-4.7: JGit v4.7.1.201706071930-r ArchiveCommand: Create prefix entry with commit time Signed-off-by: David Pursehouse <david.pursehouse@gmail.com> Change-Id: Id4df76da84fde253ce04484f3437816dc145b4f2
| * JGit v4.7.1.201706071930-rv4.7.1.201706071930-rMatthias Sohn2017-06-083-4/+4
| | | | | | | | | | Change-Id: I28cd8fbe995d76c8a00e7db6ddf826e983d89043 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| * ArchiveCommand: Create prefix entry with commit timeYasuhiro Takagi2017-06-051-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The cgit archive command creates a prefix (root) directory entry in the archive file. That entry's time is set to the commit time. This patch makes jgit's behavior consistent with with cgit: prefix: hoge/ -> creates prefix directory "hoge/" entry. prefix: hoge//// -> creates prefix directory "hoge/" entry. prefix: hoge/foo -> does not create prefix directory entry, but for each file/directory entry, prefix is added. Change-Id: I2610e40ce37972c5f7456fdca6337e7fb07176e5 Signed-off-by: Yasuhiro Takagi <ytakagi@bea.hi-ho.ne.jp>
* | Merge branch 'stable-4.7' into stable-4.8Matthias Sohn2017-06-077-2/+320
|\| | | | | | | | | | | | | * stable-4.7: Run auto GC in the background Change-Id: I5e25765f65d833f13cbe99696ef33055d7f5c4cf Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| * Run auto GC in the backgroundDavid Turner2017-06-067-2/+312
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When running an automatic GC on a FileRepository, when the caller passes a NullProgressMonitor, run the GC in a background thread. Use a thread pool of size 1 to limit the number of background threads spawned for background gc in the same application. In the next minor release we can make the thread pool configurable. In some cases, the auto GC limit is lower than the true number of unreachable loose objects, so auto GC will run after every (e.g) fetch operation. This leads to the appearance of poor fetch performance. Since these GCs will never make progress (until either the objects become referenced, or the two week timeout expires), blocking on them simply reduces throughput. In the event that an auto GC would make progress, it's still OK if it runs in the background. The progress will still happen. This matches the behavior of regular git. Git (and now jgit) uses the lock file for gc.log to prevent simultaneous runs of background gc. Further, it writes errors to gc.log, and won't run background gc if that file is present and recent. If gc.log is too old (according to the config gc.logexpiry), it will be ignored. Change-Id: I3870cadb4a0a6763feff252e6eaef99f4aa8d0df Signed-off-by: David Turner <dturner@twosigma.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | Fix out-of-bounds exception in RepoCommand#relativeHan-Wen Nienhuys2017-05-241-10/+21
| | | | | | | | | | Change-Id: I9c91aa2ff037bff27a8131fba54be22f5f27d80d Signed-off-by: Han-Wen Nienhuys <hanwen@google.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | Fix null return from FS.readPipe when command fails to launchBryan Donlan2017-05-241-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When a command invoked from readPipe fails to launch (i.e. the exec call fails due to a missing command executable), Process.start() throws, which gets caught by the generic IOException handler, resulting in a null return. This change detects this case and rethrows a CommandFailedException instead. Additionally, this change uses /bin/sh instead of bash for its posix command failure test, to accomodate building in environments where bash is unavailable. Change-Id: Ifae51e457e5718be610c0a0914b18fe35ea7b008 Signed-off-by: Bryan Donlan <bdonlan@gmail.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | RenameDetector: Clarify rename limits <= 0Dave Borowitz2017-05-241-1/+3
| | | | | | | | Change-Id: I8da386e02272316b8e5e5c2f31ce10ad98bcdb28
* | Remove unnecessary cast for DfsReaderZhen Chen2017-05-222-2/+2
| | | | | | | | | | Change-Id: I22aaccfc9d589750f9d1d711b655dd0fd543fa57 Signed-off-by: Zhen Chen <czhen@google.com>
* | Merge "Fix javadoc of TooLargeObjectInPackException"David Pursehouse2017-05-221-1/+2
|\ \
| * | Fix javadoc of TooLargeObjectInPackExceptionMatthias Sohn2017-05-191-1/+2
| | | | | | | | | | | | | | | | | | | | | The API exception should have the same javadoc like the internal exception org.eclipse.jgit.errors.TooLargeObjectInPackException Change-Id: Ia7508c77609e53c8e808412ac523a93194648e49 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | | Allow DfsReader to be subclassedShawn Pearce2017-05-194-7/+13
| | | | | | | | | | | | | | | | | | | | | Necessary if a DFS implementation wants to override close() to record DfsReaderIoStats. Change-Id: I144575f9bf1abf2c1fd72030550c4f0795fcf44d
* | | Track read IO for DfsReaderShawn Pearce2017-05-194-11/+173
| | | | | | | | | | | | | | | | | | | | | | | | | | | Compute how much disk IO a DfsReader is performing, and how long the sum of those operations took on this reader instance. Implementations of DFS and interested applications can get the stats by calling the new DfsReader.getIoStats() method at or after close(). Change-Id: If585741301f29182617933d6406d4a70497f2ca7
* | | Exclude refs/tags from bitmap commit selectionTerry Parker2017-05-185-56/+144
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit db77610 ensured that all refs/tags commits are added to the primary GC pack. It did that by adding all of the refs/tags commits to the primary GC pack PackWriter's "interesting" object set. Unfortunately, all commit objects in the "interesting" set are selected as commits for which bitmap indices will be built. In a repository like chromium with lots of tags, this changed the number of bitmaps created from <700 to >10000. That puts huge memory pressure on the GC task. This change restores the original behavior of ignoring tags when selecting commits for bitmaps. In the "uninteresting" set, commits for refs/heads and refs/tags for unannotated tags can not be differentiated. We instead identify refs/tags commits by passing their ObjectIds as a new "noBitmaps" parameter to the PackWriter.preparePack() methods. PackWriterBitmapPreparer.setupTipCommitBitmaps() can then use that "noBitmaps" parameter to exclude those commits. Change-Id: Icd287c6b04fc1e48de773033fe432a9b0e904ac5 Signed-off-by: Terry Parker <tparker@google.com>
* | [findBugs] Use UTF-8 to write to the error stream in TextProgressMonitorMatthias Sohn2017-05-151-1/+4
| | | | | | | | Change-Id: Ic85db2043d6f673f268bf781917daad45d28f8cd Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | [findBugs] Use UTF-8 to read git-rebase-todo fileMatthias Sohn2017-05-151-6/+8
| | | | | | | | Change-Id: I7c6f71e13ef106678157eae1aa3f9d39712e577b Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | [findBugs] Use UTF-8 when writing to the error stream in GitHookMatthias Sohn2017-05-151-2/+12
| | | | | | | | Change-Id: Ica8a40b909ed45cf8e538714e4f26b64ff9a3d21 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | Add shutdown hook to cleanup unfinished clone when JVM is killedMatthias Sohn2017-05-131-0/+4
| | | | | | | | | | Bug: 516303 Change-Id: I5181b0e8096af3537296848ac7dd74dff0b6d279 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | Clean up the disk when cloning failsThomas Wolf2017-05-121-10/+80
| | | | | | | | | | | | | | | | | | | | | | | | | | | | CloneCommand.call() has three stages: preparation, then the actual clone (init/fetch), and finally maybe checking out the working directory. Restructure such that if we fail or are cancelled during the actual clone (middle phase), we do clean up the disk again. This prevents leaving behind a partial clone in an inconsistent state: either we have a fully successfully built clone, or nothing at all. Bug: 516303 Change-Id: I9b18c60f8f99816d42a3deb7d4a33a9f22eeb709 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* | Checkout should not use too long filenamesChristian Halstrick2017-05-101-1/+6
| | | | | | | | | | | | | | | | | | | | DirCacheCheckout is generating names for temporary files. It was not checking the length of this filenames. It may happen that a generated filename is longer than 255 chars which causes problems on certain platforms. Make sure that filenames for temporary files do not exceed 255 chars. Bug: 508823 Change-Id: I9475c04351ce3faebdc6ad40ea4faa3c326815f4
* | Support pull on detached HEADMickael Istria2017-05-081-23/+24
| | | | | | | | | | | | Bug: 485396 Change-Id: I82be09385c9b0bcc0054fea5a9cb9d178a41e278 Signed-off-by: Mickael Istria <mistria@redhat.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | Reset ObjectWalker when it starts a new walkZhen Chen2017-05-032-11/+7
| | | | | | | | | | | | | | | | | | The ObjectWalker in PackWriterBitmapWalker needs to be reset whenever it starts a new walk. Move this responsibility from the caller to the method when the new walk starts. Change-Id: Ib66003be1b5bdc80f46b9bbbb17d45e616714912 Signed-off-by: Zhen Chen <czhen@google.com>
* | Fix stack overflow in MergeBaseGeneratorShawn Pearce2017-05-021-31/+59
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some repository topologies can cause carryOntoHistory to overflow the thread stack, due to its strategy of recursing into the 2nd+ parents of a merge commit. This can easily happen if a project maintains a local fork, and frequently pulls from the upstream repository, which itself may have a branchy history. Rewrite the carryOntoHistory algorithm to use a fixed amount of thread stack, pushing the save points onto the heap. By using heap space the thread stack depth is no longer a concern. Repositories are instead limited by available memory. The algorithm is now structured as two loops: carryOntoHistory: This outer loop pops saved commits off the top of the stack, allowing the inner loop algorithm to dive down that path and carry bits onto commits along that part of the graph. The loop ends when there are no more stack elements. carryOntoHistoryInner: The inner loop walks along a single path of the graph. For a string of pearls (commits with one parent each) r <- s <- t <- u the algorithm walks backwards from u to r by iteratively updating its local variable 'c'. This avoids heap allocation along a simple path that does not require remembering state. The inner loop breaks in the HAVE_ALL case, when all bits have been found to be previously set on the commit. This occurs when a prior iteration of the outer loop (carryOntoHistory) explored a different path to this same commit, and copied the bits onto it. When the inner loop encounters a merge commit, it pushes all parents onto the heap based stack by allocating individual CarryStack elements for each parent. Parents are pushed in order, allowing side branches to be explored first. A small optimization is taken for the last parent, avoiding pushing it and instead updating 'c', allowing the side branch to be entered without allocating a CarryStack. Change-Id: Ib7b67d90f141c497fbdc61a31b0caa832e4b3c04
* | Clone: add --recurse-submodules optionDavid Pursehouse2017-04-272-1/+75
| | | | | | | | | | | | | | | | | | | | Add the --recurse-submodules option on the command, which causes submodules to also be initialized and updated. Add a callback interface on CloneCommand and SubmoduleUpdateCommand to them to provide progress feedback for clone operations. Change-Id: I41b1668bc0d0bdfa46a9a89882c9657ea3063fc1 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | Delete expired garbage even when there is no GC pack present.Thirumala Reddy Mutchukota2017-04-211-46/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | Delete the condition to check whether the garbage pack creation time is older than the last GC operation, because it's not possible to find the last GC operation time when there is no GC pack. Add additional tests to make sure the contents of the expired garbage packs are considered during the GC operation and any actively referenced objects from the garbage packs are copied successfully into the GC pack before deleting the garbage pack. Change-Id: I09e8b2656de8ba7f9b996724ad1961d908e937b6 Signed-off-by: Thirumala Reddy Mutchukota <thirumala@google.com>
* | Add parseCommit(AnyObjectId) method to Repository.Martin Fick2017-04-191-0/+27
| | | | | | | | | | | | | | | | | | It is quite common to want to parse a commit without already having a RevWalk. Provide a shortcut to do so to make it more convenient, and to ensure that the RevWalk is released afterwards. Signed-off-by: Martin Fick<mfick@codeaurora.org> Change-Id: I9528e80063122ac318f115900422a24ae49a920e
* | RepoCommand: Add linkfile support.Dan Willemsen2017-04-187-33/+226
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Android wants them to work, and we're only interested in them for bare repos, so add them just for that. Make sure to use symlinks instead of just using the copyfile implementation. Some scripts look up where they're actually located in order to find related files, so they need the link back to their project. Change-Id: I929b69b2505f03036f69e25a55daf93842871f30 Signed-off-by: Dan Willemsen <dwillemsen@google.com> Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Jeff Gaston <jeffrygaston@google.com> Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* | Merge "Process all "have"s even when MissingObjectException is encountered"Jonathan Nieder2017-04-171-34/+67
|\ \
| * | Process all "have"s even when MissingObjectException is encounteredJonathan Nieder2017-04-171-34/+67
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Because objects described by the client using "have" lines do not need to be reachable by any ref on the server, it is possible for them to point to missing objects in the reachability graph. When such an object is encountered, I1097a2defa4a9dcf502ca8baca5d32880378818f (Only throw MissingObjectException when necessary, 2017-03-29) aborts the "have" walk early to salvage the fetch. The downside of that change is that remaining "have"s are ignored unless they pointed directly to an object with a bitmap. In the worst case this can increase the bandwidth cost of a fetch to the cost of a clone because most "have"s are ignored. Avoid this cost by bypassing the failed "have" completely and moving on to the remaining "have"s. Change-Id: Iac236b6d05f735078c9935abfa6e58d1eb47f388
* | | Merge "Prevent alternates loop"David Pursehouse2017-04-173-63/+221
|\ \ \
| * | | Prevent alternates loopMartin Fick2017-04-143-63/+221
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When looping through alternates, prevent visiting the same object directory twice. This could happen when the objects/info/alternates file includes itself directly or indirectly via a another repo and its alternates file. Change-Id: I79bb3da099ebc3c262d2e6c61ed4578eb1aa3474 Signed-off-by: James Melvin <jmelvin@codeaurora.org> Signed-off-by: Martin Fick <mfick@codeaurora.org> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | | | Add missing @since tag for new API RepoCommand.setTargetURI()Matthias Sohn2017-04-141-3/+5
|/ / / | | | | | | | | | Change-Id: I4531b94e3a04606a69eeb3c3d154510b87507012 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | | Bazel: Restrict src globs to Java source filesDavid Pursehouse2017-04-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Generating the src list with an unrestricted wildcard causes all files in the source tree to be included. This results in junk files such as .orig (generated during merge conflict resolution) to be included, which causes in a build error: in srcs attribute of java_library rule //org.eclipse.jgit:jgit: file '//org.eclipse.jgit:src/org/eclipse/jgit/gitrepo/RepoCommand.java.orig' is misplaced here (expected .java, .srcjar or .properties). Modify the globs to only include Java source files. Change-Id: Iaef3db33ac71d71047cd28acb0378e15cb09ece9 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* | | Fix RepoCommand to allow for relative URLsHan-Wen Nienhuys2017-04-131-7/+90
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is necessary for deploying submodules on android.googlesource.com. * Allow an empty base URL. This is useful if the 'fetch' field is "." and all names are relative to some host root. * The URLs in the resulting superproject are relative to the superproject's URL. Add RepoCommand#setDestinationURI to set this. If unset, the existing behavior is maintained. * Add two tests for the Android and Gerrit case, checking the URL format in .gitmodules; the tests use a custom RemoteReader which is representative of the use of this class in Gerrit's Supermanifest plugin. Change-Id: Ia75530226120d75aa0017c5410fd65d0563e91b Signed-off-by: Han-Wen Nienhuys <hanwen@google.com> Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* | | Merge "BundleWriter: Allow constructing from only an ObjectReader"Jonathan Nieder2017-04-121-6/+33
|\ \ \
| * | | BundleWriter: Allow constructing from only an ObjectReaderDave Borowitz2017-04-121-6/+33
| | | | | | | | | | | | | | | | Change-Id: I01821d6a9fbed7a5fe4619884e42937fbd6909ce
* | | | Merge "Only throw MissingObjectException when necessary"Terry Parker2017-04-121-17/+32
|\ \ \ \ | |/ / / |/| / / | |/ /
| * | Only throw MissingObjectException when necessaryZhen Chen2017-04-051-17/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When preparing the bitmap, the flag ignoreMissingStart only applied to the start object. However, sometime the start object is present but some related objects are not present during the walk, we should only release the MissingObjectException when the ignoreMissingStart is set false. Change-Id: I1097a2defa4a9dcf502ca8baca5d32880378818f Signed-off-by: Zhen Chen <czhen@google.com>
* | | Merge branch 'stable-4.7'Matthias Sohn2017-04-113-13/+31
|\ \ \ | | |/ | |/| | | | | | | | | | | | | | | | | | | * stable-4.7: Cleanup and test trailing slash handling in ManifestParser ManifestParser: Throw exception if remote does not have fetch attribute Change-Id: Ia9dc3110bcbdae05175851ce647ffd11c542f4c0 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| * | Cleanup and test trailing slash handling in ManifestParserHan-Wen Nienhuys2017-04-111-13/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | This is a workaround for https://bugs.openjdk.java.net/browse/JDK-4666701. Change-Id: Idd04657e8d95a841d72230f8881b6b899daadbc2 Signed-off-by: Han-Wen Nienhuys <hanwen@google.com> Signed-off-by: David Pursehouse <david.pursehouse@gmail.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| * | ManifestParser: Throw exception if remote does not have fetch attributeHan-Wen Nienhuys2017-04-103-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In the repo manifest documentation [1] the fetch attribute is marked as "#REQUIRED". If the fetch attribute is not specified, this would previously result in NullPointerException. Throw a SAXException instead. [1] https://gerrit.googlesource.com/git-repo/+/master/docs/manifest-format.txt Change-Id: Ib8ed8cee6074fe6bf8f9ac6fc7a1664a547d2d49 Signed-off-by: Han-Wen Nienhuys <hanwen@google.com> Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
| * | Prepare 4.7.1-SNAPSHOTMatthias Sohn2017-04-063-45/+45
| | | | | | | | | | | | | | | Change-Id: I16a45035258276217446bccc0ad1b0991383aa0c Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| * | JGit v4.7.0.201704051617-rv4.7.0.201704051617-rMatthias Sohn2017-04-053-4/+4
| | | | | | | | | | | | | | | Change-Id: Ic2bd6aca0b7a7e0597ffc1f7cf647b49878f9950 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | | Remove unused API filtersMatthias Sohn2017-04-091-51/+0
| | | | | | | | | | | | Change-Id: I1e00d71395228265aad4071b023024ee1bf855d5 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | | Silence API error for new method added to abstract MergeStrategyMatthias Sohn2017-04-061-0/+8
| | | | | | | | | | | | | | | | | | | | | OSGi semantic versioning rules allow to break implementors of an API in a minor version. Change-Id: I4ada3e6455e8e8e1bb8fb71affa0a1b36bd46fc4 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>