aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit
Commit message (Collapse)AuthorAgeFilesLines
* JGit v6.10.0.202406032110-rv6.10.0.202406032110-rMatthias Sohn2024-06-033-4/+4
| | | | | Signed-off-by: Matthias Sohn <matthias.sohn@sap.com> Change-Id: I3128b2e4bbbed97adde90f7a47e15175e63e97f5
* Prepare 6.10.0-SNAPSHOT buildsMatthias Sohn2024-06-023-4/+4
| | | | Change-Id: I64f6d6a0599cbab462dca236c00e6f3314b2a810
* JGit v6.10.0.202405290101-rc1v6.10.0.202405290101-rc1Matthias Sohn2024-05-293-4/+4
| | | | | Signed-off-by: Matthias Sohn <matthias.sohn@sap.com> Change-Id: Ie3d08213e00fcfe1fc34a39021dd99f27e0abc1f
* JGit v6.10.0.202405282244-rc1v6.10.0.202405282244-rc1Matthias Sohn2024-05-293-4/+4
| | | | | Signed-off-by: Matthias Sohn <matthias.sohn@sap.com> Change-Id: Ia525790e0b4c9011b29768d2b9727cb48b21ba84
* PatchApplier.Result.Error: mark fields finalMatthias Sohn2024-05-281-3/+3
| | | | | | | Fields of an Error instance shouldn't be modifiable after its creation. Adapt tests which were setting hh to null to skip asserting it. Change-Id: I0f55c1d5cd529aa510029054e6f05bd2637d1bca
* PatchApplier: Set a boolean on the result if conflict markers were addedPatrick Hiesel2024-05-271-6/+31
| | | | | | | This will let callers show a different error message or mark the state as conflicting. Change-Id: Id8eea614b6b8d54c62b49ffbac90599e6f4c5efa
* Remove version override of commons-codecThomas Wolf2024-05-252-2/+1
| | | | | | | | | | Since commit 8164155b the commons-codec version is pinned in the parent POM's dependency management. Remove the version specification in org.eclipse.jgit/pom.xml. Also give the package-import in the MANIFEST.MF an upper bound. Change-Id: I2785a87cf77d6df110f57a0cb939dbc9772b8ee6 Signed-off-by: Thomas Wolf <twolf@apache.org>
* WalkFetchConnection: Remove marked packs on all function exitsIvan Frade2024-05-161-6/+15
| | | | | | | | | | | | | [1] replaces Iterator.remove() with a list of "toRemove" that gets processed when returning at the end. There are two others returns in the function where the list is not processed. Let the method report the broken packages and wrap it so the caller can clean them up in any case. [1] https://review.gerrithub.io/c/eclipse-jgit/jgit/+/1194812 Change-Id: I1ffb7829039f644df03b0b3ea1e5d10408ce19b7
* Merge "Do not use ArrayList when there will be deletions"Ivan Frade2024-05-163-27/+30
|\
| * Do not use ArrayList when there will be deletionsjackdt@google.com2024-05-163-27/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In https://gerrithub.io/c/eclipse-jgit/jgit/+/1194015, LinkedList was replaced with ArrayList in DfsReader and WalkFetchConnection. In this case, the Iterator.remove() method of List is called, which is an O(n) operation for ArrayList. This results in an O(n^2) algorithm. Instead of reverting to LinkedList, use a HashSet and LinkedHashmap instead. This maintains O(1) removal, and is less likely to be treated as an antipattern than LinkedList. A likely innocuous usage of Iterator.remove() in UnionInputStream was also fixed. Change-Id: I57d884440c726b2fc80c1b8b2bec9bd7e2e6e3fe
* | Merge changes I12e4d0fd,I082ffb20Matthias Sohn2024-05-161-19/+0
|\ \ | |/ |/| | | | | | | * changes: Remove unused API problem filters Fix warning "Redundant specification of type arguments <Object>"
| * Remove unused API problem filtersMatthias Sohn2024-05-141-19/+0
| | | | | | | | Change-Id: I12e4d0fd48b5b7420d421874c8d63caed9628266
* | Merge "Allow applying a patch with conflicts"Matthias Sohn2024-05-151-19/+115
|\ \ | |/ |/|
| * Allow applying a patch with conflictsPatrick Hiesel2024-05-141-19/+115
| | | | | | | | | | | | | | | | | | | | | | | | | | | | In some settings, we want to let users apply a patch that does not cleanly apply and add conflict markers. In Gerrit, this is useful when cherry picking (via Git patches) from one host to another. This commit takes a simple approach: If a hunk doesn't apply, go to the pre-image line, treat all lines in pre-image length as left side of the conflict and all context and newly added lines as right side of the conflict. Change-Id: I01411d7a32b3f3207097b26231909aae6b835650
* | Check an execution bit by reading it from the file systemYury Molchan2024-05-131-2/+11
|/ | | | | | | | Files.isExecutable() checks possibility to execute a file from the JVM, not POSIX attributes. So it fails when Java Security Manager does not allow to execute a file, but file has X-bit. Change-Id: I85b96fb6cedbaff1b3c063728c25b6ce4d04e9b9
* PackIndex: Make it an interfaceIvan Frade2024-05-083-23/+26
| | | | | | | | | | As we work on different backends for PackIndex, it is much easier to extend an interface than an abstract class. Note that PackIndex is alredy acting as an interface, offering barely any functionality. Change-Id: Icd0db0e96a097631c2b9c3b05e5700f601f606d5
* PackIndex: Make iterator static (pass object count in ctor)Ivan Frade2024-05-083-4/+18
| | | | | | | | | | | | The iterator uses an implicit reference to the external class to call #getObjectCount(). This implicit reference prevents PackIndex to become an interface. The object count is immutable and known at index (and iterator) construction time. Pass the object count in the constructor of the iterator and make it static. Change-Id: I4949ff943de2a88380fb7f4c9b65b089734854b9
* PackIndex: move checksum to the subclassesIvan Frade2024-05-084-10/+21
| | | | | | | | | | PackIndex is almost an interface, and making it so simplifies writing implementations over other storages. Checksum and its getter is the only functionality that is class specific. Make getChecksum abstract and implement it in the subclasses. Change-Id: I3746515d816abab075210505f1bb31b1936962e9
* Merge "PackIndex: Make #getOffset protected to allow out-of-package subclasses"Ivan Frade2024-05-012-2/+2
|\
| * PackIndex: Make #getOffset protected to allow out-of-package subclassesIvan Frade2024-04-262-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | PackIndex#getOffset is abstract and package-private, limiting subclasses to the same package. Given than the class and all other relevant methods are public, this looks like an oversight and it should be ok to write subclasses in other packages. Make the method protected, allowing to write PackIndex subclasses in other packages. Change-Id: I7d3762b0a6c0681c29bd827bbaf094f1ee4583d2
* | [errorprone] Fix error pattern JdkObsoleteMatthias Sohn2024-04-2927-82/+77
|/ | | | | | See https://errorprone.info/bugpattern/JdkObsolete Change-Id: Id105e2695eb64523bd217f507bf95f909bc6b348
* ResolveMerger: Fix the issue with binary modify-modify conflictsSruteesh2024-04-251-30/+43
| | | | | | | | | | | 1) If the file was marked as binary by git attributes, we should add the path to conflicts if content differs in OURS and THEIRS 2) If the path is a file in OURS, THEIRS and BASE and if it is a binary in any one of them, no content merge should be attempted and the file content is kept as is in the work tree Bug: jgit-14 Change-Id: I9201bdc53a55f8f40adade4b6a36ee8ae25f4db8
* PackBitmapIndexBuilder.StoredEntry: add getter for objectIdSam Delmerico2024-04-121-4/+16
| | | | | | | | | | | | | | | | | | If you only have access to the PackBitmapIndexBuilder there is no way to get the ObjectId from a StoredEntry instance without also having access to a reverse pack index. The StoredEntry can provide the idxPosition, but the PackBitmapIndexBuilder's getObject method requires a ridxPosition in order to find an ObjectId. Providing an ObjectId from the StoredEntry gives this information directly and also allows a caller to get the ridxPosition if desired by calling PackBitmapIndexBuilder.findPosition(objectId) without needing an index object. This closes the operations of the PackBitmapIndexBuilder such that any method can be called by using information provided by the other methods. Change-Id: I5a11479b9635cd6b5e7aaff2f862cd41069ac469
* PackBitmapIndex: clarify naming of getObject inputsSam Delmerico2024-04-123-19/+24
| | | | | | | | The documentation for the getObject function seems to be a little outdated. This commit clarifies that this function accepts an offset based on the ordering of objects in the pack. Change-Id: Icffaf4fb72155c415f5fd248e721cab87a1a083e
* Merge "MergeAlgorithm: Fix diff3 conflict hunk computation"Ivan Frade2024-04-091-2/+11
|\
| * MergeAlgorithm: Fix diff3 conflict hunk computationAntonin Delpeuch2024-04-091-2/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Closes https://github.com/eclipse-jgit/jgit/issues/38. The previous code computed the boundaries of the base part of conflict hunks using line numbers computed for the 'ours' and 'theirs' revisions, leading to incorrect boundaries. This only affects the presentation of merge conflicts in diff3 mode (which is probably not used a lot yet on Gerrit). Successful merges are unaffected. Change-Id: I173c79bf5797896dc854791d6d05cb3f035726f4 Signed-off-by: Antonin Delpeuch <antonin@delpeuch.eu>
* | PackBitmapIndexBuilder: make StoredEntry constructor publicSam Delmerico2024-04-031-1/+15
| | | | | | | | | | | | This POD data structure can be used externally Change-Id: I464c45b93d0a56deaadbfe31df57a87e1054741c
* | Merge "PackBitmapIndexBuilder: allow repeated call of getCompressedBitmaps()"Ivan Frade2024-04-021-2/+3
|\ \
| * | PackBitmapIndexBuilder: allow repeated call of getCompressedBitmaps()Sam Delmerico2024-04-021-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Each call of the current implementation of PackBitmapIndexBuilder.getCompressedBitmaps reverses the class member that is returned. So two subsequent calls of this function will receive reversed structures. Instead we should just reverse a copy of the structure. This way the PackBitmapIndexBuilder can continue to efficiently accept new bitmaps via processBitmapForWrite (because we can continue to add to the back of the bitmapsToWrite ArrayList) while ensuring that the bitmaps are returned in the correct ordering from getCompressedBitmaps. Change-Id: If7364222b9e62920c0c2c06894716fe85dd13315
* | | DfsPackFile: Make the loader classes used to construct bitmaps public.jackdt@google.com2024-04-021-7/+20
| | | | | | | | | | | | | | | | | | | | | This is necessary to swap out implementations of the PackBitmapIndex with custom implementations. Change-Id: Ia6f951bbc901446c255fa2902fab05d7ed974111
* | | DfsPackFile: make public the constructor with bitmap loaderIvan Frade2024-04-011-1/+12
|/ / | | | | | | | | | | | | | | | | | | The constructor with the bitmap loader as a parameter is supposed to be used from subclasses in the ObjectDatabase, but those subclasses cannot see it with its current package-private visibility. Make it public, so it can be used as intended. Change-Id: I4afca3d2a13c4a41a766d08c5aa54bde352915a6
* | PackWriter: writeBitmapIndex takes bitmap index writerSam Delmerico2024-03-296-22/+76
| | | | | | | | | | | | | | PackWriter.writeBitmapIndex now takes an interface which will perform the writing of the bitmap index to an arbitrary backing storage. Change-Id: Icba89321d56f7b652bbcbfcd5ed3ec74999cb8c4
* | PackBitmapIndex: convert from class to interfaceSam Delmerico2024-03-253-5/+5
| | | | | | | | | | | | | | | | | | This abstract class can be an interface after https://review.gerrithub.io/c/eclipse-jgit/jgit/+/1184614 moved the packChecksum data behind a getter interface. This also allows easier overriding of this interface with custom types. Change-Id: I89851de678e7ff896cc086455907e2898d2eecf6
* | Merge "PackBitmapIndex: hide packChecksum behind getter"Ivan Frade2024-03-203-3/+16
|\ \
| * | PackBitmapIndex: hide packChecksum behind getterSam Delmerico2024-03-183-3/+16
| | | | | | | | | | | | | | | | | | | | | | | | This allows more flexibility in overriding the PackBitmapIndex and also allows us to turn PackBitmapIndex into an interface in https://review.gerrithub.io/c/eclipse-jgit/jgit/+/1178201. Change-Id: I3be611fad67ff38b308c0052a04149f1497858ae
* | | Merge "Cache refreshed loose ref dirs in SnapshottingRefDirectory"Matthias Sohn2024-03-201-2/+26
|\ \ \
| * | | Cache refreshed loose ref dirs in SnapshottingRefDirectoryNasser Grainawi2024-03-191-2/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Update SnapshottingRefDirectory to have a cache of dirs refreshed for loose refs. This should help improve performance when 'after_open' setting is used for 'trustLooseRefStat' as duplicate refreshes are avoided when a snapshot of the ref database is used in a request scope. Change-Id: I8f66e7cee572e477d29abe2d9db69e97bca3ee4c Signed-off-by: Nasser Grainawi <quic_nasserg@quicinc.com> Co-authored-by: Martin Fick <quic_mfick@quicinc.com> Co-authored-by: Kaushik Lingarkar <quic_kaushikl@quicinc.com>
* | | | Merge "TreeRevFilter: correct changedPathFilter usage for multi-paths inclusion"jonathantanmy2024-03-192-6/+3
|\ \ \ \ | |/ / / |/| | |
| * | | TreeRevFilter: correct changedPathFilter usage for multi-paths inclusionXing Huang2024-03-182-6/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The expected behavior of TreeRevFilter when filtering multiple file paths is to include commits that changed at least one of the given paths; only skipping them if they did not change any of the given paths. The current changedPathFilter utilization logic is skipping a commit if there exists at least one given path that the commit did not change, disregarding the rest of the given paths. Enforcing all given paths to be checked by the changedPathFilter, only skipping a commit if changedPathFilter return negative on all given paths. Signed-off-by: Xing Huang <xingkhuang@google.com> Change-Id: Ib7a9e496b37ec737722fbf33c5d0f05d5d910a8d
* | | | Merge "CleanupService: preload JgitText if not running in OSGi"Thomas Wolf2024-03-182-18/+49
|\ \ \ \ | |/ / / |/| | |
| * | | CleanupService: preload JgitText if not running in OSGiThomas Wolf2024-03-152-18/+49
| | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Load class JGitText eagerly when ShutdownHook is used. If not running in an OSGi framework, the hook executes as a JVM shutdown hook. Normally classloading in a shutdown hook should not be a problem, but there are some other frameworks besides OSGi that may close classloaders before such a JVM shutdown hook runs, for instance Plexus classworlds used in maven. This is not a full fix for classloading problems in JGit shutdown hooks. If a listener causes additional classes to be loaded, there may still be problems. But the current listeners registered with ShutdownHook all appear to use only classes that should already be loaded; except JGitText. Bug: jgit-36 Change-Id: Iab00134b4720adb19e1394c38ad79f1c43c3466b Signed-off-by: Thomas Wolf <twolf@apache.org>
* | | PathFilterGroup: implement getPathsBestEffort()Xing Huang2024-03-182-0/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | getPathsBestEffort() is a method in the TreeFilter class to retrieve file paths specified by the caller. PathFilterGroup do not propagate the paths of their subfilters as it does not implement the getPathsBestEffort() method, resulting in the caller only getting an empty list of paths. Override getPathsBestEffort() in PathFilterGroup to propagate subfilter values. Signed-off-by: Xing Huang <xingkhuang@google.com> Change-Id: I76bf08795360abc0874a7c258636d4f37da35060
* | | DfsPackFile: get commitGraph.readChangePaths from repo configXing Huang2024-03-141-1/+8
| |/ |/| | | | | | | | | | | | | | | | | | | By default, CommitGraphLoader reads the readChangedPaths flag from SystemReader ignoring the values set at repo-level. Read the value of the property from the repo configuration and pass it to CommitGraphLoader. Signed-off-by: Xing Huang <xingkhuang@google.com> Change-Id: I34c807714c5a7573769ba9d611457aa107006244
* | Merge "CommitGraphLoader: receive readChangedPaths as parameter"Ivan Frade2024-03-121-11/+40
|\ \ | |/ |/|
| * CommitGraphLoader: receive readChangedPaths as parameterXing Huang2024-03-121-11/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | commitGraph.readChangedPaths controls the read of bloom filter chunks from commit graph. CommitGraphLoader uses SystemReader to read this conf, so it only sees its value when it is set in $XDG_CONFIG_HOME/jgit/config (and not, for example, in the repo config). Pass the readChangedPaths value to the method that reads the commit graph. Callers should read the value from the right configuration. This change is a noop, but allows to move callers to the new method progressively. Follow up changes will remove the previous method and its usages. Signed-off-by: Xing Huang <xingkhuang@google.com> Change-Id: If10c9b758fbe0498c7bd1e6ac1cda8869682f16d
* | Merge "ShutdownHook: run on bundle deactivation if in OSGi"Matthias Sohn2024-03-096-20/+118
|\ \
| * | ShutdownHook: run on bundle deactivation if in OSGiThomas Wolf2024-03-086-20/+118
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Running as a JVM shutdown hook is far too late in an OSGi framework; by the time the JVM shuts down, the OSGi framework will normally already have deactivated and unloaded bundles, and thus the JGit cleanup code may try to work with unloaded classes for which there will be no classloader anymore. When JGit is used in an OSGi framework, the cleanups must run on bundle deactivation, not on JVM shut down. Add a declarative OSGi service CleanupService. This is a normal Java class that has no dependencies on any OSGi bundle or interface, but that is declared in the MANIFEST.MF and in an OSGi Service XML as an OSGi immediate component. Set the bundle activation policy to "lazy". (A declarative service is used instead of a bundle activator because the latter would need to implement the OSGi interface BundleActivator, but JGit should not have dependencies on OSGi.) When JGit runs in an OSGi framework, the framework will create an instance of CleanupService through the no-args constructor when (and before) the first class from this bundle is loaded. This instance thus knows that it is operating in OSGi, and will run the ShutdownHook when the bundle is deactivated: bundle deactivation will deactivate the CleanupService instance. When JGit does not run in an OSGi framework, the OSGi service declaration will be ignored, and there will be no already existing CleanupService instance. We create one lazily, which thus knows that it is not operating in OSGi, and which will use a JVM shutdown hook to run the ShutdownHook. This also reverts commit e6d83d61eade6dee223757d149a4df9650752a55. Bug: jgit-36 Change-Id: I9c621b0707453c087f638974312ea1bf8ec30c31 Signed-off-by: Thomas Wolf <twolf@apache.org>
* | | FS_POSIX.runInShell(): on MacOS use a login shellThomas Wolf2024-03-091-1/+5
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | On Mac, $PATH for UI programs is not the same as in a shell (terminal). It is typically much shorter. This may lead to surprises when hooks that work fine via the command-line git do not work when run via JGit in a UI application, such as EGit in Eclipse. Therefore use a login shell to run hooks and other commands spawned by git if we're on MacOS. This will give the hooks the same environment as in a terminal. Bug: egit-16 Change-Id: Id2e5485c6d3080d3ef8baa61ad7f6f198f77c590 Signed-off-by: Thomas Wolf <twolf@apache.org>
* | [diffmergetool] Fix running command on CygwinThomas Wolf2024-03-071-3/+3
| | | | | | | | | | | | | | | | Because FS_Win32_Cygwin is a subclass of FS_Win32 the "instanceof" test for Cygwin must come first. Bug: jgit-34 Change-Id: If0cc0fa77e7aa0ce680289cecf808bc8859911a1 Signed-off-by: Thomas Wolf <twolf@apache.org>
* | DfsBlockCache: move cache table specific implementations to a new classLaura Hamelin2024-03-053-551/+933
| | | | | | | | | | | | | | | | | | | | | | | | | | This move of the cache table specific implementation to its own class and extracting the method definition to an interface will allow for additional reworking of the dfs block cache with the goal of letting users implement their own context specific cache tables. This work does not intend to change how the dfs block cache is accessed, limiting the change to DfsBlockCache internal changes only. Change-Id: Ief6755d1dcf54b4f73f9fe8d22ccb9e2952cb0c4 Signed-off-by: Laura Hamelin <haowl@google.com>