summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.pgm/src/org/eclipse/jgit
Commit message (Collapse)AuthorAgeFilesLines
* PackWriter: Remove constructor with only Reader as paramIvan Frade2024-09-161-1/+2
| | | | | | | | | | | | At construction time, PackWriter receives the PackConfig as a parameter or reads it from the repository. The only exception is when the constructor receives only a reader (no repo nor conf provided?!). Remove PackWriter(Reader) and let callers be explicit what conf to use. This makes clearer the flow of conf in the PackWriter. Change-Id: If12e122797ffc8c44fc3c435ca1b000ca016645b
* Signing: refactor interfacesThomas Wolf2024-08-244-41/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a big API-breaking change cleaning up the signing interfaces. Initially, these interfaces were GPG/OpenPGP-specific. When EGit added new signers and signature verifiers that called an external GPG executable, they were found inadequate and were extended to be able to pass in the GpgConfig to get access to the "gpg.program" setting. With the introduction of X.509 S/MIME signing, it was discovered that the interfaces were still not quite adequate, and the "Gpg" prefix on the class names were confusing. Since 7.0 is a major version bump, I'm taking this chance to overhaul these interfaces from ground up. For signing, there is a new Signer interface. With it goes a SignerFactory SPI interface, and a final Signers class managing the currently set signers. By default, signers for the different signature types are created from the signer factories, which are discovered via the ServiceLoader. External code can install its own signers, overriding the default factories. For signature verification, exactly the same mechanism is used. This simplifies the setup of signers and signature verifiers, and makes it all more regular. Signer instances just get a byte[] to sign and don't have to worry about ObjectBuilders at all. SignatureVerifier instances also just get the data and signature as byte[] and don't have to worry about extracting the signature from a commit or tag, or about what kind of signature it is. Both Signers and SignatureVerifiers always get passed the Repository and the GpgConfig. The repository will be needed in an implementation for SSH signatures because gpg.ssh.* configs may need to be loaded explicitly, and some of those values need the current workspace location. For signature verification, there is exactly one place in core JGit in SignatureVerifiers that extracts signatures, determines the signature type, and then calls the right signature verifier. Change RevTag to recognize all signature types known in git (GPG, X509, and SSH). Change-Id: I26d2731e7baebb38976c87b7f328b63a239760d5 Signed-off-by: Thomas Wolf <twolf@apache.org>
* Add worktrees read supportJanne Valkealahti2024-07-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Based on deritative work done in Andre's work in [1]. This change focuses on adding support for reading the repository state when branches are checked out using git's worktrees. I've refactored original work by removing all unrelevant changes which were mostly around refactoring to extract i.e. constants which mostly created noise for a review. I've tried to address original review comments: - Not adding non-behavioral changes - "HEAD" should get resolved from gitDir - Reftable recently landed in cgit 2.45, see https://github.com/git/git/blob/master/Documentation/RelNotes/2.45.0.txt#L8 We can add worktree support for reftable in a later change. - Some new tests to read from a linked worktree which is created manually as there's no write support. [1] https://git.eclipse.org/r/c/jgit/jgit/+/163940/18 Change-Id: Id077d58fb6c09ecb090eb09d5dbc7edc351a581d
* Bump jetty version to 12.0.9 and servlet-api to 6.0nextDavid Ostrovsky2024-05-081-2/+2
| | | | | Bug: jgit-41 Change-Id: Ib3e42581db2dd88043a1a67d606795501b8019f4
* [errorprone] Fix error pattern JdkObsoleteMatthias Sohn2024-04-291-2/+2
| | | | | | See https://errorprone.info/bugpattern/JdkObsolete Change-Id: Id105e2695eb64523bd217f507bf95f909bc6b348
* Merge branch 'stable-6.7'Matthias Sohn2023-10-131-0/+7
|\ | | | | | | | | | | | | | | | | | | * stable-6.7: PackConfig: fix @since tags Remove unused API problem filters Add support for git config repack.packKeptObjects Do not exclude objects in locked packs from bitmap processing Change-Id: I7e0856a5d70d5d155cf6874383ea1f5622d5238a
| * Merge branch 'stable-6.6' into stable-6.7Matthias Sohn2023-10-131-0/+7
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-6.6: PackConfig: fix @since tags Remove unused API problem filters Add support for git config repack.packKeptObjects Do not exclude objects in locked packs from bitmap processing Change-Id: I29241619e6c09933bb856e486f379be10dd609c2
| | * Merge branch 'stable-6.5' into stable-6.6Matthias Sohn2023-10-131-0/+6
| | |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-6.5: PackConfig: fix @since tags Remove unused API problem filters Add support for git config repack.packKeptObjects Do not exclude objects in locked packs from bitmap processing Change-Id: I7272a22451c0de6b4770767e7bb4e24c81518c20
| | | * Merge branch 'stable-6.4' into stable-6.5Matthias Sohn2023-10-131-0/+6
| | | |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-6.4: PackConfig: fix @since tags Remove unused API problem filters Add support for git config repack.packKeptObjects Do not exclude objects in locked packs from bitmap processing Change-Id: I2951d01f5f4581bee20079508cd8ee6ca8554f1f
| | | | * Merge branch 'stable-6.3' into stable-6.4Matthias Sohn2023-10-131-0/+6
| | | | |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-6.3: PackConfig: fix @since tags Remove unused API problem filters Add support for git config repack.packKeptObjects Do not exclude objects in locked packs from bitmap processing Change-Id: I4b94a2b79941c085fa2f62246e8e879aaa85cd3f
| | | | | * Merge branch 'stable-6.2' into stable-6.3Matthias Sohn2023-10-131-0/+6
| | | | | |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-6.2: PackConfig: fix @since tags Remove unused API problem filters Add support for git config repack.packKeptObjects Do not exclude objects in locked packs from bitmap processing Change-Id: I22b89bf00dcef26b2096d25397aa9a57a745a92b
| | | | | | * Merge branch 'stable-6.1' into stable-6.2Matthias Sohn2023-10-131-0/+6
| | | | | | |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-6.1: PackConfig: fix @since tags Remove unused API problem filters Add support for git config repack.packKeptObjects Do not exclude objects in locked packs from bitmap processing Change-Id: Ib4e4fe407dce334c7537bf278baa39db93aa2f09
| | | | | | | * Merge branch 'stable-6.0' into stable-6.1Matthias Sohn2023-10-131-0/+6
| | | | | | | |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-6.0: PackConfig: fix @since tags Remove unused API problem filters Add support for git config repack.packKeptObjects Do not exclude objects in locked packs from bitmap processing Change-Id: I0c9c0b3c206cac03a93b30eda348177a4de35c36
| | | | | | | | * Merge branch 'stable-5.13' into stable-6.0Matthias Sohn2023-10-131-0/+6
| | | | | | | | |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-5.13: PackConfig: fix @since tags Remove unused API problem filters Add support for git config repack.packKeptObjects Do not exclude objects in locked packs from bitmap processing Change-Id: Ifeaa4b4f0c5944d4ecd3042be429833ff72b43ed
| | | | | | | | | * Do not exclude objects in locked packs from bitmap processingLuca Milanesio2023-10-121-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Packfiles having an equivalent .keep file are associated with in-flight pushes that haven't been completed, with potentially a set of git objects not yet referenced by a ref. If the Git client is not up-to-date, it may result in pushing a packfile, generating a <packfile>.keep on the server, which may also contain existing commits due to the lack of Git protocol negotiation in the git-receive-pack. The Git protocol negotiation is the phase where the client and the server exchange the list of refs they have for trying to find a common base and minimise the amount of objects to be transferred. The repack phase in GC was previously skipping all objects that were contained in all packfiles having a <packfile>.keep file associated (aka "locked packfiles"), which did not take into consideration the fact that excluding the existing commits would have resulted in the generation of an invalid bitmap file. The code for excluding the objects in the locked packfiles was written well before the bitmap was introduced, hence could not consider a use case that did not exist at that time. However, when the bitmap was introduced, the exclusion of locked packfiles was not changed, hence creating a potential problem. The issue went unnoticed for many years because the bitmap generation was disabled when JGit noticed any locked packfiles; however, the bitmaps are enabled again since Id722e68d9f , and the the issue is now visible and is impacting the GC repack phase. Introduce the '--pack-kept-objects' option in GC for including the objects contained in the locked packfiles during the repack phase, which is not an issue because of the following: - If there are any existing commits duplicated in the packfiles they will be just considered once anyway because the repack doesn't generate duplicates in the output packfile. - If there are any new commits that do not have any ref pointing to them, they will be automatically excluded from the output repacked packfile. The same identical solution is adopted in the C implementation of git in repack.c. Because the locked packfile is not pruned, any new commits not pointed by any refs will remain in the repository and there will not be any accidental pruning or object loss as it is today before this change. As a side-effect of this change, it is now potentially possible to still have duplicate BLOBs after GC when the keep packfile contained existing objects. However, it is way better to keep the duplication until the next GC phase rather than omitting existing objects from repacking and, therefore generating an invalid bitmap and incorrect packfile. Bug: 582292 Bug: 582455 Change-Id: Ide3445e652fcf256a7912f881cb898897c99b8f8
* | | | | | | | | | [errorprone] Add missing javadoc summaryMatthias Sohn2023-09-251-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | see https://google.github.io/styleguide/javaguide.html#s7.2-summary-fragment Change-Id: Iaf4a6b55d4e4c59b7a2da3451164abb1bb47d4a1
* | | | | | | | | | [errorprone] Fix BadImportMatthias Sohn2023-09-2512-60/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | See https://errorprone.info/bugpattern/BadImport Change-Id: Iea98b15862ed0bc4bcad759a7240133769680808
* | | | | | | | | | [errorprone] Suppress MissingSummary for translation bundlesMatthias Sohn2023-09-251-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Change-Id: I4da51c7e089366b016a0cc64f768a151c24bc956
* | | | | | | | | | [errorprone] Remove unnecessary parenthesesMatthias Sohn2023-09-222-3/+2
|/ / / / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | see https://errorprone.info/bugpattern/UnnecessaryParentheses Change-Id: Id08cf0e05b3d35f139fc34e0aa83882555a8a81a
* | | | | | | | | ReadChangedPathFilter: fix Non-externalized string literal warningJörg Kubitz2023-08-281-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Change-Id: I78161a2dbc08918267bc59a1ed267c5108f5c391
* | | | | | | | | CommitGraphWriter: write changed-path filtersJonathan Tan2023-07-181-0/+83
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add support for writing the BIDX and BDAT chunks of the commit graph file, as described in man gitformat-commit-graph(5). The ability to read such chunks will be added in a subsequent commit. This work is based on earlier work by Kyle Zhao (Ib863782af209f26381e3ca0a2c119b99e84b679c). Change-Id: Ic18e6f0eeec7da1e1ff31751aabda5e6952dbe6e Signed-off-by: kylezhao <kylezhao@tencent.com> Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
* | | | | | | | | Fix all Javadoc warnings and fail on themAntoine Musso2023-06-1673-123/+38
|/ / / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes all the javadoc warnings, stops ignoring doclint 'missing' category and fails the build on javadoc warnings for public and protected classes and class members. Since javadoc doesn't allow access specifiers when specifying doclint configuration we cannot set `-Xdoclint:all,-missing/private` hence there is no simple way to skip private elements from doclint. Therefore we check javadoc using the Eclipse Java compiler (which is used by default) and javadoc configuration in `.settings/org.eclipse.jdt.core.prefs` files. This allows more fine grained configuration. We can reconsider this when javadoc starts supporting access specifiers in the doclint configuration. Below are detailled explanations for most modifications. @inheritDoc =========== doclint complains about explicits `{@inheritDoc}` when the parent does not have any documentation. As far as I can tell, javadoc defaults to inherit comments and should only be used when one wants to append extra documentation from the parent. Given the parent has no documentation, remove those usages which doclint complains about. In some case I have moved up the documentation from the concrete class up to the abstract class. Remove `{@inheritDoc}` on overriden methods which don't add additional documentation since javadoc defaults to inherit javadoc of overridden methods. @value to @link =============== In PackConfig, DEFAULT_SEARCH_FOR_REUSE_TIMEOUT and similar are forged from Integer.MAX_VALUE and are thus not considered constants (I guess cause the value would depends on the platform). Replace it with a link to `Integer.MAX_VALUE`. In `StringUtils.toBoolean`, @value was used to refer to the `stringValue` parameter. I have replaced it with `{@code stringValue}`. {@link <url>} to <a> ==================== @link does not support being given an external URL. Replaces them with HTML `<a>`. @since: being invalid ===================== org.eclipse.jgit/src/org/eclipse/jgit/util/Equality.java has an invalid tag `@since: ` due to the extra `:`. Javadoc does not complain about it with version 11.0.18+10 but does with 11.0.19.7. It is invalid regardless. invalid HTML syntax =================== - javadoc doesn't allow <br/>, <p/> and </p> anymore, use <br> and <p> instead - replace <tt>code</tt> by {@code code} - <table> tags don't allow summary attribute, specify caption as <caption>caption</caption> to fix this doclint visibility issue ======================== In the private abstract classes `BaseDirCacheEditor` and `BasePackConnection` links to other methods in the abstract class are inherited in the public subclasses but doclint gets confused and considers them unreachable. The HTML documentation for the sub classes shows the relative links in the sub classes, so it is all correct. It must be a bug somewhere in javadoc. Mute those warnings with: @SuppressWarnings("doclint:missing") Misc ==== Replace `<` and `>` with HTML encoded entities (`&lt; and `&gt;`). In `SshConstants` I went enclosing a serie of -> arrows in @literal. Additional tags =============== Configure maven-javad0c-plugin to allow the following additional tags defined in https://openjdk.org/jeps/8068562: - apiNote - implSpec - implNote Missing javadoc =============== Add missing @params and descriptions Change-Id: I840056389aa59135cfb360da0d5e40463ce35bd0 Also-By: Matthias Sohn <matthias.sohn@sap.com>
* | | | | | | | AddCommand: ability to switch off renormalizationThomas Wolf2023-04-281-2/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | JGit's AddCommand always renormalizes tracked files. C git does so only on git add --renormalize. Especially for git add . and the JGit equivalent git.add().addFilepattern(".").call() this can make a big difference if there are many files, or large files. Add a "renormalize" option to AddCommand. To maintain compatibility with existing uses, this option is "true" by default, and the behavior of AddCommand is as it has always been in JGit. If set to "false", use an IndexDiffFilter (in addition to a path filter, if any). This skips any unchanged files (that are not racily clean) from content checks. Note that changes in CRLF settings or in filters will be ignored for such files if renormalize == false. Add the "--renormalize" option to the Add command in the JGit command line program. For the command-line program, the default is as in C git: renormalize is off by default and enabled only if the option is given. Note that --renormalize implies --update in the command line program, as in C git. In AddCommand, the two settings are independent. Additionally, avoid opening input streams unnecessarily in WorkingTreeIterator.getEntryContentLength() and fix some bogus indentation. Add a simple test that adds 1000 files of 10kB in 10 directories twice and that fails if the second invocation (without any changes) with renormalize=false is not significantly faster. Locally, I observe for that second invocation * git.add().addFilepattern(".").call() ~660ms * git.add().addFilepattern(".").setRenormalize(false).call() ~16ms Bug: 494323 Change-Id: I30f9d518563fa55d7058a48c27c425f3b60aeb4c Signed-off-by: Thomas Wolf <twolf@apache.org>
* | | | | | | | [pgm] Implement git tag --contains optionMatthias Sohn2023-04-121-0/+9
|/ / / / / / / | | | | | | | | | | | | | | | | | | | | | Change-Id: I390bcd2c2c563d4b27e1369f09548be59ba7c111
* | | | | | | Merge branch 'stable-6.4'Matthias Sohn2023-02-201-6/+12
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-6.4: Fix getPackedRefs to not throw NoSuchFileException Add pack options to preserve and prune old pack files Allow to perform PackedBatchRefUpdate without locking loose refs Document option "core.sha1Implementation" introduced in 59029aec Change-Id: I36051c623fcd480aa80ed32b4e89f9bdd1b798e0
| * | | | | | Merge branch 'stable-6.3' into stable-6.4Matthias Sohn2023-02-201-6/+12
| |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-6.3: Fix getPackedRefs to not throw NoSuchFileException Add pack options to preserve and prune old pack files Allow to perform PackedBatchRefUpdate without locking loose refs Document option "core.sha1Implementation" introduced in 59029aec Change-Id: I1073098fb06eabafdb3c5e7fcf44d55b86a1b152
| | * | | | | Merge branch 'stable-6.2' into stable-6.3Matthias Sohn2023-02-201-6/+12
| | |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-6.2: Fix getPackedRefs to not throw NoSuchFileException Add pack options to preserve and prune old pack files Allow to perform PackedBatchRefUpdate without locking loose refs Document option "core.sha1Implementation" introduced in 59029aec Change-Id: I765c7302ce84a6a9c28fdef29da2bfaa49477c6e
| | | * | | | Merge branch 'stable-6.1' into stable-6.2Matthias Sohn2023-02-161-6/+12
| | | |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-6.1: Fix getPackedRefs to not throw NoSuchFileException Add pack options to preserve and prune old pack files Allow to perform PackedBatchRefUpdate without locking loose refs Document option "core.sha1Implementation" introduced in 59029aec Change-Id: Id32683d5f506e082d39af269803bccee0280cc27
| | | | * | | Merge branch 'stable-6.0' into stable-6.1Matthias Sohn2023-02-161-6/+12
| | | | |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-6.0: Add pack options to preserve and prune old pack files Allow to perform PackedBatchRefUpdate without locking loose refs Document option "core.sha1Implementation" introduced in 59029aec Change-Id: I876a38c2de8b7d5eaacd00e36b85599f88173221
| | | | | * | Merge branch 'stable-5.13' into stable-6.0Matthias Sohn2023-02-161-6/+12
| | | | | |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-5.13: Add pack options to preserve and prune old pack files Allow to perform PackedBatchRefUpdate without locking loose refs Document option "core.sha1Implementation" introduced in 59029aec Change-Id: I423f410578f5bbe178832b80fef8998a5372182c
| | | | | | * Add pack options to preserve and prune old pack filesMatthias Sohn2023-02-111-6/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add the options - pack.preserveOldPacks - pack.prunePreserved This allows to configure in git config if old packs should be preserved during gc and pruned during the next gc. The original implementation in 91132bb0 only allows to set these options using the API. Change-Id: I5b23ab4f317d12f5ccd234401419913e8263cc9a
* | | | | | | [pgm] Fetch-CLI: add support for shallowHarald Weiner2023-01-245-0/+105
|/ / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds support for shallow cloning. The CloneCommand and the FetchCommand now have the new options --depth, --shallow-since and --shallow-exclude to tell the server that the client doesn't want to download the complete history. Bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=475615 Change-Id: I8f113bed25dd6df64f2f95de6a59d4675ab8a903
* | | | | | [pgm] Add options --name-only, --name-status to diff, log, showalerthak2022-11-234-8/+98
| | | | | | | | | | | | | | | | | | | | | | | | Change-Id: Ib218bd2ccbd7990feca4c35d8c8dc34d4a8291e6
* | | | | | [pgm] Ensure UploadPack is closed to fix resource leakMatthias Sohn2022-11-211-5/+6
|/ / / / / | | | | | | | | | | | | | | | Change-Id: I40da4b331012dd1c6f4b497e46c973fd776b737f
* | | | | Fix DefaultCharset bug pattern flagged by error proneDavid Ostrovsky2022-06-172-5/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | See more details in: [1]. [1] https://errorprone.info/bugpattern/DefaultCharset Change-Id: I3de0be57a2d74490a5b4e66801e9767b38f13bf9
* | | | | Use SystemReader#getDefaultCharset to read console inputDavid Ostrovsky2022-06-171-2/+3
|/ / / / | | | | | | | | | | | | | | | | | | | | | | | | In I986f97a410 SystemReader.getDefaultCharset() that provides the locale-dependent charset the way JEP 400 recommends. Change-Id: I30560ac47e450070e3864325d153d45f1a66882c
* | | | Adapt diff- and merge tool code for PGM and EGit usageAndre Bossert2022-06-022-155/+155
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | see: https://git-scm.com/docs/git-mergetool * DiffTools and MergeTools * store FS, gitDir and workTree for usage without git repository (for EGit preferences) * add getUserDefinedToolNames() and getPredefinedToolNames() * replace getToolNames() with getAllToolNames() that combines the two lists and put default tool name (diff.tool or merge.tool) as first element (for EGit preferences) * FileElement: refactoring of getFile() and friends to have midName (LOCAL, REMOTE etc.) always added to the temp file name (also for EGit) * FileElement: added directory attribute that is used in getFile() to return path with workDir as parent * DiffTool and MergeTool * added errw.flush(), because sometimes stderr is not printed in case of die() * print e.getMessage() always to stderr * Moved toolname and prompt logic into managers * Exported internal packages required for egit.ui Bug: 356832 Change-Id: I71e7f4dc362169a7612ca4f6546a021bc4b2b5f4 Signed-off-by: Andre Bossert <andre.bossert@siemens.com> Signed-off-by: Tim Neumann <Tim.Neumann@advantest.com>
* | | | Add availability check of pre-defined toolsAndre Bossert2022-06-013-37/+90
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | see: https://git-scm.com/docs/git-difftool see: https://git-scm.com/docs/git-mergetool * now all available tools are printed with "--tool-help" * if no diff.tool or merge.tool is defined the first available pre-defined tool is used TODO: - add mergetools to difftools --> extra change or merge to this - return the exit-code of the tool to jgit / java runtime Bug: 356832 Change-Id: I20fb04e71ced981f5625020f461bbac24e6cec70 Signed-off-by: Andre Bossert <andre.bossert@siemens.com>
* | | | Add filtering with help of DirCacheCheckout.getContent()Andre Bossert2022-05-302-46/+133
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | see: https://git-scm.com/docs/git-mergetool * refactoring of content (FileElement) handling * now the temporary files are already filled with filtered content in the calling classes (PGM), that can be used with EGit content too TODO: * keep the temporaries when no change detected and the user answers no to the question if the merge was successful Bug: 356832 Change-Id: I86a0a052d059957d4d152c1bb94c262902c377d2 Signed-off-by: Andre Bossert <andre.bossert@siemens.com>
* | | | Add mergetool merge feature (execute external tool)Andre Bossert2022-05-253-67/+287
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | see: https://git-scm.com/docs/git-mergetool * implement mergetool merge function (execute external tool) * add ExecutionResult and commandExecutionError to ToolException * handle "base not present" case (empty or null base file path) * handle deleted (rm) and modified (add) conflicts * handle settings * keepBackup * keepTemporaries * writeToTemp Bug: 356832 Change-Id: Id323c2fcb1c24d12ceb299801df8bac51a6d463f Signed-off-by: Andre Bossert <andre.bossert@siemens.com>
* | | | Add command line support for "git mergetool"Andre Bossert2022-05-252-2/+214
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | see: https://git-scm.com/docs/git-mergetool see: https://git-scm.com/docs/git-config * add command line support for "git mergetool" * add option handling for "--tool-help", "--tool=<mytool>", "--[no-]prompt", "--[no-]gui" * handle prompt * add MergeTools * add pre-defined mergetools * print merge actions --> no execute, will be done later Bug: 356832 Change-Id: I6e505ffc3d03f75ecf4bba452a25d25dfcf5793f Signed-off-by: Andre Bossert <andre.bossert@siemens.com>
* | | | Add difftool compare feature (execute external tool)Andre Bossert2022-05-251-30/+70
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | see: http://git-scm.com/docs/git-difftool * add CommandExecutor that handles tool execution with help of "jgit.FS" * it handles tool execution with temporary created "command file" --> for for all "command interpreters" and parameters with spaces etc. * using of external bash.exe at Windows (MinGW) if shell-script is used as difftool command. It can be enabled with parameter "jgit.usemsys2bash=auto" that checks if command contains ".sh" or enabled / disabled with "jgit.usemsys2bash=true|false" * added special handling for empty files (e.g. deleted, added etc.) that are named "/dev/null" * added creation and deletion of temporary files needed for compare * added own Exception class for reporting to pgm / command line / EGit * added prompt option handling before executing difftool * reworked trustExitCode option for specific difftool and override for all difftools from config and command line * tested with command line options "--[no]-trust-exit-code", "--tool=<toolname>", "--[no]-gui", --[no]-prompt * ContentSource * added close() methods to close / cleanup used resources (like ObjectReader TreeWalk etc.) * added isWorkingTreeSource() methods to check if file can be used from working tree instead of copy from "ObjectLoader / ObjectReader" to temporary file (fixes "difftool <commit> <commit>") Bug: 356832 Change-Id: I5462fb6dbe4ecfd9da7c74117fce4070bbfd4d7a Signed-off-by: Andre Bossert <andre.bossert@siemens.com> Signed-off-by: Simeon Andreev <simeon.danailov.andreev@gmail.com>
* | | [pgm] Add describe --abbrev optionMatthias Sohn2022-03-021-0/+6
| | | | | | | | | | | | Change-Id: I8adf2fad21db71b43266d3f274143eee6bc9dce2
* | | Introduce a constant for the length of an abbreviated hash stringSebastian Schuberth2022-02-033-4/+13
| | | | | | | | | | | | | | | Signed-off-by: Sebastian Schuberth <sebastian.schuberth@bosch.io> Change-Id: I196d58a813f7caa1965af4cf8e2f977ed4cdc350
* | | [errorprone] Fix implicit use of platform default charsetMatthias Sohn2022-01-191-1/+3
| | | | | | | | | | | | Change-Id: I42f893c4248d8b00bf4aaf59cd528c43940f99e2
* | | Add config reader for user-defined difftoolsAndre Bossert2021-12-081-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | see: http://git-scm.com/docs/git-difftool * add config reader for user-defined difftools * diff.tool * diff.guitool * difftool.prompt * difftool.trustExitCode * difftool.<tool>.path * difftool.<tool>.cmd * add pre-defined difftools * implemented "git difftool --tool-help" to verify config reader and pre-defined difftools Bug: 356832 Change-Id: Idde8fddbef61f3378ee565c6321570b3962d0e1d Signed-off-by: Andre Bossert <andre.bossert@siemens.com> Signed-off-by: Simeon Andreev <simeon.danailov.andreev@gmail.com>
* | | Add command line support for "git difftool"Andre Bossert2021-11-252-0/+258
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | see: http://git-scm.com/docs/git-difftool * add command line support for "jgit difftool" * show supported commands with "jgit difftool --help" * added "git difftool --tool-help" to show the tools (empty now) * prepare for all other commands Bug: 356832 Change-Id: Ice0c13ef7953a20feaf25e7746d62b94ff4e89e5 Signed-off-by: Andre Bossert <andre.bossert@siemens.com> Signed-off-by: Simeon Andreev <simeon.danailov.andreev@gmail.com>
* | Binary and CR-LF detection: lone CRs -> binaryThomas Wolf2021-10-312-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | C git considers not only files containing NUL bytes as binary but also files containing lone CRs. Implement this also for JGit. C git additionally counts printable vs. non-printable characters and considers files that have non_printable_count > printable_count / 128 also as binary. This is not implemented because such counting probably only makes sense if one looks at the full file or blob content. The Auto[CR]LF* streams in JGit look only at the first few KiB of a stream in order not to buffer too much. For the C git implementation, see [1]. [1] https://github.com/git/git/blob/7e27bd589d/convert.c#L35 Bug: 576971 Change-Id: Ia169b59bdbf1477f32ee2014eeb8406f81d4b1ab Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* | Fix split package in bundle org.eclipse.jgit.ssh.jschMatthias Sohn2021-09-291-1/+1
|/ | | | | | | | The package org.eclipse.jgit.transport was split between org.eclipse.jgit and org.eclipse.jgit.ssh.jsch. Bug: 564544 Change-Id: I91d38e67c65ed97a880f8dc8f9559663b9eec33b
* Ignore IllegalStateException if JVM is already shutting downMatthias Sohn2021-08-291-2/+6
| | | | | | | | | Trying to register/unregister a shutdown hook when the JVM is already in shutdown throws an IllegalStateException. Ignore this exception since we can't do anything about it. Bug: 575367 Change-Id: Ic967c16c7f566c84778795315ab369e76668b364