aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.junit/src
Commit message (Collapse)AuthorAgeFilesLines
* TestRepository: Stop using deprecated methods in SystemReaderIvan Frade6 days1-2/+2
| | | | Change-Id: I1d1f174f739137c24fb586cb2f6d054d4785d716
* TestRepository: add version when annotated methods became deprecatedMatthias Sohn9 days1-2/+2
| | | | Change-Id: Ib9466bfbc3d7ecf53af88dd6b5bade7ae48c7165
* LocalDiskRepositoryTestCase: Use java.time API to create PersonIdentIvan Frade10 days1-2/+3
| | | | | | | | | | | This code is using deprecated methods in the mock system reader to invoke a deprecated constructor of PersonIdent. Both classes have now new methods with the java.time API. Use java.time methods to get the timestamp and timezone and build the PersonIdent. Change-Id: I4271d9d1d3c9128cfcedc680410448498530de88
* Add missing @since 7.2 to TestRepository#getTimeZoneIdMatthias Sohn2024-12-201-0/+1
| | | | Change-Id: Icf3b29d075e5d91e64cea06dcd75119745bd13e0
* TestRepository: Deprecate #getDate and use #getInstant insteadIvan Frade2024-12-131-9/+24
| | | | | | | | | | | Errorprone recomments to use the more modern java.time API instead of the java.util.Date family of classes. This removes all uses of TestRepository#getDate and replace them with getInstant. The method is marked as deprecated and doesn't have any other usages. Change-Id: I84ea63abf781d0d3c7c2724891fd2ef7afc2db1d
* SystemReader#now: make it a concrete methodIvan Frade2024-11-141-6/+0
| | | | | | | | | | | | | Abstract methods break subclasses (e.g. DelegateSystemReader in gerrit). Updating jgit and gerrit is simpler if we do not add them. I am not sure why some methods are abstract and others dont, but now() can be a concrete method. Make now() concrete. Implement it by default based on getCurrentTime(), so subclasses overriding that method get the same value. Change-Id: I697749f8cba698c5388ed13ebdc2b238d6259358
* MockSystemReader: create the right time zoneIvan Frade2024-11-131-1/+1
| | | | | | | | | Using this timezone in a later commit, it complains: Exception java.time.DateTimeException: Zone offset minutes and seconds must be negative because hours is negative Change-Id: I5787b51f98109942ac33e0496c5e3761914b2a78
* SystemReader: Give a default implementation to #getTimezoneAt()Ivan Frade2024-11-131-5/+0
| | | | | | | | | | | This abstract method forces subclasses (e.g. DelegateSystemReader in gerrit) to update their code, but there is no strong reason to make it abstract (subclasses can override it if needed). Make the method concrete using the current default implementation (which is the same in the mock). Change-Id: Id1df0d71cab1d86879adf48e782f0050d3abcfa9
* Don't fail when trying to prune pack which is already goneJacek Centkowski2024-11-121-1/+2
| | | | | | | | | Update the TestRepository.prunePacked so that it doesn't fail if a pack to be pruned is already gone. It is especially handy when prunePacked function is called in `TestRepository.packAndPrune` function after repo moves on after the GC was performed. Change-Id: I01b4ddbaddec1fdc24cfbb967e0edfe0de6c4b7c
* Merge branch 'stable-7.0'Matthias Sohn2024-11-121-3/+7
|\ | | | | | | | | | | | | | | | | | | * stable-7.0: Replace custom encoder Constants#encodeASCII by JDK implementation Replace custom encoder `Constants#encode` by JDK implementation Add `numberOfPackFilesAfterBitmap` to RepoStatistics Enhance CommitBuilder#parent to tolerate null parent Change-Id: I46f961144f2e3c4c57ef0f63a9c8954fee8133e9
| * Enhance CommitBuilder#parent to tolerate null parentMatthias Sohn2024-11-071-3/+7
| | | | | | | | Change-Id: Ifdeafd040bca8331804c3e7568da0bee5cbd01df
* | SystemReader: Offer methods with java.time APIIvan Frade2024-11-081-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Error prone explains: The Date API is full of major design flaws and pitfalls and should be avoided at all costs. Prefer the java.time APIs, specifically, java.time.Instant (for physical time) and java.time.LocalDate[Time] (for civil time). Add to SystemReader methods to get the time and timezone in the new java.time classes (Instant/ZoneId) and mark as deprecated their old counterparts. The mapping of methods is: * #getCurrentTime -> #now (returns Instant instead of int) * #getTimezone -> #getTimeZoneAt (returns ZoneOffset intead of int) * #getTimeZone -> #getTimeZoneId (return ZoneId instead of TimeZone) Change-Id: Ic55b2f442a40046ff0ed24f61f566fc7416471be
* | [errorprone] SeparateClassloadertTestRunner: use #split(String,int)Ivan Frade2024-10-301-1/+1
|/ | | | | | | | Errorprone recommends to use String.split(String, int) as it has a less surprising behaviour with empty entries. https://errorprone.info/bugpattern/StringSplitter Change-Id: I48a01ee18d66bbb4a177aee576629dc5132d4a38
* TestRepository: Add getInstant methodDavid Ostrovsky2023-10-051-0/+11
| | | | | | | | Error Prone is flagging Date-API as obsolete and recommends to migrate to Instant and LocalDate. Given that more JGit users starting to migrate to new Time API, offer getInstant method. Change-Id: Ie010b76d1c213cd0a645f716783ed2d57fc78071
* [errorprone] Add missing javadoc summaryMatthias Sohn2023-09-251-0/+2
| | | | | | see https://google.github.io/styleguide/javaguide.html#s7.2-summary-fragment Change-Id: Iaf4a6b55d4e4c59b7a2da3451164abb1bb47d4a1
* [errorprone] Fix BadImportMatthias Sohn2023-09-251-4/+4
| | | | | | See https://errorprone.info/bugpattern/BadImport Change-Id: Iea98b15862ed0bc4bcad759a7240133769680808
* [errorprone] MockSystemReader: fix CatchAndPrintStackTraceMatthias Sohn2023-09-251-1/+1
| | | | | | | See https://errorprone.info/bugpattern/CatchAndPrintStackTrace Change-Id: If1ec66ea65eaef9311a650d8a5741a03ac76cb88 Change-Id: Ic52205bab141a4e3c6a9fefecf749f1ccfc0e491
* Use ShutdownHook to gracefully handle JVM shutdownMatthias Sohn2023-09-121-17/+17
| | | | | | | | | | in all classes which already registered their own shutdown hook - CloneCommand - GC#PidLock - FS#FileStoreAttributes - LocalDiskRepositoryTestCase#Cleanup Change-Id: I3efc1f83f3cbbf43eeeaaedcd2bee1ef31971a72
* Default for global (user) git ignore fileThomas Wolf2023-06-191-5/+19
| | | | | | | | | | | | | | | | | | | | C git has a default for git config core.excludesfile: "Its default value is $XDG_CONFIG_HOME/git/ignore. If $XDG_CONFIG_HOME is either not set or empty, $HOME/.config/git/ignore is used instead." [1] Implement this in the WorkingTreeIterator$RootIgnoreNode. To make this testable, mock the "user.home" directory for all JGit tests, otherwise tests might pick up a real user's git ignore file. Also ensure that JGit code always reads "user.home" via the SystemReader. Add tests for both locations. [1] https://git-scm.com/docs/gitignore#_description Bug: 436127 Change-Id: Ie510259320286c3c13a6464a37da1bd9ca1e373a Signed-off-by: Thomas Wolf <twolf@apache.org>
* Fix all Javadoc warnings and fail on themAntoine Musso2023-06-169-36/+130
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* BatchingProgressMonitor: expose time spent per taskMatthias Sohn2023-02-271-0/+5
| | | | | | | | | | | | | | | | | | | Display elapsed time per task if enabled via ProgressMonitor#showDuration or if system property or environment variable GIT_TRACE_PERFORMANCE is set to "true". If both the system property and the environment variable are set the system property takes precedence. E.g. using jgit CLI: $ GIT_TRACE_PERFORMANCE=true jgit clone https://foo.bar/foobar Cloning into 'foobar'... remote: Counting objects: 1 [0.002s] remote: Finding sources: 100% (15531/15531) [0.006s] Receiving objects: 100% (169737/169737) [13.045s] Resolving deltas: 100% (67579/67579) [1.842s] Change-Id: I4d624e7858b286aeddbe7d4e557589986d73659e
* Merge branch 'stable-6.2' into stable-6.3Matthias Sohn2022-11-201-0/+2
|\ | | | | | | | | | | | | | | | | | | | | | | * stable-6.2: Remove unused imports Suppress non-externalized String warnings Remove unused API problem filters Silence API errors Silence API errors Silence API warnings Change-Id: I71aa9f890c5eb05849ad16a00b9974da5e51171e
| * Silence API errorsMatthias Sohn2022-11-201-0/+2
| | | | | | | | Change-Id: I07c42fe9417edb0570dd475a7e935112a878a93b
* | [merge] Fix merge conflicts with symlinksThomas Wolf2022-09-071-0/+18
|/ | | | | | | | | | | | | | | | | | | | | Previous code would do a content merge on symlinks, and write the merge result to the working tree as a file. C git doesn't do this; it leaves a symlink in the working tree unchanged, or in a delete-modify conflict it would check out "theirs". Moreover, previous code would write the merge result to the link target, not to the link. This would overwrite an existing link target, or fail if the link pointed to a directory. In link/file conflicts or file/link conflicts, C git always puts the file into the working tree. Change conflict handling accordingly. Add tests for all the conflict cases. Bug: 580347 Change-Id: I3cffcb4bcf8e336a85186031fff23f0c4b6ee19d Signed-off-by: Thomas Wolf <twolf@apache.org>
* [test] Fix closing of test repositoriesNail Samatov2022-01-301-2/+19
| | | | | | | | | | | | | | | | Fix tests failing on Windows because Repository instance is created but not closed on tear down. Fix repositories closed twice, except in tests that test this behavior explicitly. Name the temporary directories the tests run in after the test method; that makes it easier to figure out in which tests repositories are closed twice if it should occur again in the future. Bug: 550111 Change-Id: I9398b58f0f36d2c29236d2a9a8599117d9083980 Signed-off-by: Nail Samatov <sanail@yandex.ru> Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* Merge branch 'stable-5.11' into stable-5.12Matthias Sohn2021-12-046-0/+11
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-5.11: Add missing @since tags Add missing @since tag Add missing @since tags Remove unused import in ApacheSshTest Update maven plugins Ignore missing javadoc in test bundles storage: file: De-duplicate File.exists()+File.isFile() RefDirectory.scanRef: Re-use file existence check done in snapshot creation FileSnapshot: Lazy load file store attributes cache Update eclipse-jarsigner-plugin to 1.3.2 Fix p2 repository URLs Change-Id: I72f39fbe82dd578d71aa2e3ceccebb39a25c4e00
| * Merge branch 'stable-5.10' into stable-5.11Matthias Sohn2021-12-046-0/+11
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-5.10: Add missing @since tags Add missing @since tag Add missing @since tags Remove unused import in ApacheSshTest Update maven plugins Ignore missing javadoc in test bundles storage: file: De-duplicate File.exists()+File.isFile() RefDirectory.scanRef: Re-use file existence check done in snapshot creation FileSnapshot: Lazy load file store attributes cache Update eclipse-jarsigner-plugin to 1.3.2 Fix p2 repository URLs Change-Id: I84c73e11381c31566a12033db94e9afdcef5b705
| | * Merge branch 'stable-5.9' into stable-5.10Matthias Sohn2021-12-046-0/+11
| | |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-5.9: Add missing @since tags Add missing @since tag Add missing @since tags Remove unused import in ApacheSshTest Update maven plugins Ignore missing javadoc in test bundles storage: file: De-duplicate File.exists()+File.isFile() RefDirectory.scanRef: Re-use file existence check done in snapshot creation FileSnapshot: Lazy load file store attributes cache Update eclipse-jarsigner-plugin to 1.3.2 Fix p2 repository URLs Change-Id: I971745b529ff903ea8bf9c3dbbc746fa09f41041
| | | * Merge branch 'stable-5.8' into stable-5.9Matthias Sohn2021-12-046-0/+11
| | | |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-5.8: Add missing @since tags Add missing @since tag Add missing @since tags Remove unused import in ApacheSshTest Update maven plugins Ignore missing javadoc in test bundles storage: file: De-duplicate File.exists()+File.isFile() RefDirectory.scanRef: Re-use file existence check done in snapshot creation FileSnapshot: Lazy load file store attributes cache Update eclipse-jarsigner-plugin to 1.3.2 Fix p2 repository URLs Change-Id: I5e7c204c0e4c428df6f3b27ba1fc06326983f27c
| | | | * Merge branch 'stable-5.6' into stable-5.7Matthias Sohn2021-12-046-0/+11
| | | | |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-5.6: Add missing @since tag Add missing @since tags Remove unused import in ApacheSshTest Update maven plugins Ignore missing javadoc in test bundles storage: file: De-duplicate File.exists()+File.isFile() RefDirectory.scanRef: Re-use file existence check done in snapshot creation FileSnapshot: Lazy load file store attributes cache Update eclipse-jarsigner-plugin to 1.3.2 Fix p2 repository URLs Change-Id: I53e6cb4b3a34b32d964e486c1ff3d130eed6e406
| | | | | * Merge branch 'stable-5.5' into stable-5.6Matthias Sohn2021-12-046-0/+11
| | | | | |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-5.5: Add missing @since tags Remove unused import in ApacheSshTest Update maven plugins Ignore missing javadoc in test bundles storage: file: De-duplicate File.exists()+File.isFile() RefDirectory.scanRef: Re-use file existence check done in snapshot creation FileSnapshot: Lazy load file store attributes cache Update eclipse-jarsigner-plugin to 1.3.2 Fix p2 repository URLs Change-Id: I007e92c12fde8d765b75f103e9d530aa0834b7d7
| | | | | | * Add missing @since tagsMatthias Sohn2021-12-046-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Change-Id: Id21e626201363dd3d0358bd709765e7fd07a0cbf
* | | | | | | Introduce getMergedInto(RevCommit commit, Collection<Ref> refs)Adithya Chakilam2021-03-141-0/+12
|/ / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In cases where we need to determine if a given commit is merged into many refs, using isMergedInto(base, tip) for each ref would cause multiple unwanted walks. getMergedInto() marks the unreachable commits as uninteresting which would then avoid walking that same path again. Using the same api, also introduce isMergedIntoAny() and isMergedIntoAll() Change-Id: I65de9873dce67af9c415d1d236bf52d31b67e8fe Signed-off-by: Adithya Chakilam <quic_achakila@quicinc.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | | | | | PackFile: Add id + ext based constructorsNasser Grainawi2021-03-071-9/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add new constructors to PackFile to improve a common use case where callers know the directory, id, and extension, but previously needed to construct a valid file name (with prefix, '.', etc) to create a PackFile. Most callers can use the variant that has id as an ObjectId, but provide an id as String variant too. Change-Id: I39e4466abe8c9509f5916d5bfe675066570b8585 Signed-off-by: Nasser Grainawi <quic_nasserg@quicinc.com>
* | | | | | Create a PackFile class for Pack filenamesNasser Grainawi2021-03-041-4/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The PackFile class is intended to be a central place to do all common pack filename manipulation and parsing to help reduce repeated code and bugs. Use the PackFile class in the Pack class and in many tests to ensure it works well in a variety of situations. Later changes will expand use of PackFiles to even more areas. Change-Id: I921b30f865759162bae46ddd2c6d669de06add4a Signed-off-by: Nasser Grainawi <quic_nasserg@quicinc.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | | | | | Rename PackFile to PackNasser Grainawi2021-02-101-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Pack better represents the purpose of the object and paves the way to add a PackFile object that extends File. Change-Id: I39b4f697902d395e9b6df5e8ce53078ce72fcea3 Signed-off-by: Nasser Grainawi <quic_nasserg@quicinc.com>
* | | | | | Fix SeparateClassloaderTestRunner on Java 9 or higherMatthias Sohn2021-02-051-4/+10
|/ / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since Java 9 the SystemClassLoader is no longer a URLClassLoader. Change-Id: I3aa834f1075e611c86fc4684fda6a50c684b3729 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* / / / / Close Repository to fix tests failing on WindowsNail Samatov2020-11-011-0/+8
|/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix tests failing on Windows because Repository instance is created but not closed on tear down. Change-Id: I72488ba5efeec95110926b1fbd56b7d96fca0d37 Signed-off-by: Nail Samatov <sanail@yandex.ru> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* / / / ResolveMerger: Adding test cases for GITLINK mergeDemetr Starshov2020-08-261-0/+16
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add test cases which cover content-merge resolve logic. Git clients try to agressively merge blobs by content, but GITLINK types of entries can't be merged with each other or with blobs. This change ensures all possible permutations which can trigger blob and GITLINK content merge are covered. Signed-off-by: Demetr Starshov <dstarshov@google.com> Change-Id: I7e83a28a14d4d2f9e0ba2b1cffbf3224fb7f3fef
* | | Merge branch 'stable-5.6'Matthias Sohn2020-02-281-1/+1
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-5.6: Cygwin expects forward slashes for commands to be run via sh.exe Make Logger instances final Move array designators from the variable to the type Change-Id: I9a5dc570deb478525bf48ef526d8cba5b19418bf Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| * | Make Logger instances finalDavid Pursehouse2020-02-271-1/+1
| | | | | | | | | | | | | | | Change-Id: Ibb997952917e47bc31a8cbe3863623bc959a8100 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* | | ErrorProne: Enable and fix UnusedException checkDavid Pursehouse2020-01-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Enable UnusedException at ERROR level which causes the build to fail in many places with: [UnusedException] This catch block catches an symbol and re-throws another, but swallows the caught symbol rather than setting it as a cause. This can make debugging harder. Fix it by setting the caught exception as cause on the subsequently thrown exception. Note: The grammatically incorrect error message is copy-pasted as-is from the version of ErrorProne currently used in Bazel; it has been fixed by [1] in the latest version. [1] https://github.com/google/error-prone/commit/d57a39c Change-Id: I11ed38243091fc12f64f1b2db404ba3f1d2e98b5 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | | Update EDL 1.0 license headers to new short SPDX compliant formatMatthias Sohn2020-01-0413-494/+65
|/ / | | | | | | | | | | | | | | | | | | This is the format given by the Eclipse legal doc generator [1]. [1] https://www.eclipse.org/projects/tools/documentation.php?id=technology.jgit Bug: 548298 Change-Id: I8d8cabc998ba1b083e3f0906a8d558d391ffb6c4 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | Merge branch 'stable-5.5'Matthias Sohn2019-11-112-2/+33
|\| | | | | | | | | | | | | | | | | | | | | * stable-5.5: BaseReceivePack: Fix the format Prepend hostname to subsection used to store file timestamp resolution Store filesystem timestamp resolution in extra jgit config SystemReader: extract updating config and its parents if outdated Change-Id: Iecfddce8081303af29badcdcd3d72a0da50c964f Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| * Store filesystem timestamp resolution in extra jgit configMatthias Sohn2019-11-092-2/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This avoids polluting hand-crafted user level config with auto-configured options which might disturb in environments where the user level config is replicated between different machines. Add a jgit config as parent of the system level config. Persist measured timestamp resolutions always in this jgit config and read it via the user global config. This has the effect that auto-configured timestamp resolution will be used by default and can be overridden in either the system level or user level config. Store the jgit config under the XDG_CONFIG_HOME directory following the XDG base directory specification [1] in order to ensure that we have write permissions to persist the file. This has the effect that each OS user will use its jgit config since they typically use different XDG_CONFIG_HOME directories. If the environment variable XDG_CONFIG_HOME is defined the jgit config file is located at $XDG_CONFIG_HOME/jgit/config otherwise the default is ~/.config/jgit/config. If you want to avoid redundant measurement for different OS users manually copy the values measured and auto-configured for one OS user to the system level git config. [1] https://wiki.archlinux.org/index.php/XDG_Base_Directory Bug: 551850 Change-Id: I0022bd40ae62f82e5b964c2ea25822eb55d94687 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | Enable and fix "Statement unnecessarily nested within else clause" warningsDavid Pursehouse2019-10-171-2/+1
|/ | | | | | | | | | | | | | | Since [1] the gerrit project includes jgit as a submodule, and has this warning enabled, resulting in 100s of warnings in the console. Also enable the warning here, and fix them. At the same time, add missing braces around adjacent and nearby one-line blocks. [1] https://gerrit-review.googlesource.com/c/gerrit/+/227897 Change-Id: I81df3fc7ed6eedf6874ce1a3bedfa727a1897e4c Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* Merge "RevWalk: Traverse all parents of UNINTERESTING commits"Jonathan Tan2019-08-261-1/+38
|\
| * RevWalk: Traverse all parents of UNINTERESTING commitsAlex Spradlin2019-08-261-1/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When firstParent is set, RevWalk traverses only the first parent of a commit, even though that commit is UNINTERESTING. Since we want the maximal UNINTERESTING set, we shouldn't prune any parents here. This issue is apparent only when some of the commits being traversed are unparsed, since walker.carryFlagsImpl() propagates the UNINTERESTING flag to all parsed ancestors, masking the issue. Therefore teach RevWalk to traverse all parents when a commit is UNINTERESTING and not only the first parent. Since this issue is masked by commit parsing, also test situations when the commits involved are unparsed. Signed-off-by: Alex Spradlin <alexaspradlin@google.com> Change-Id: I95e2ad9ae8f1f50fbecae674367ee7e0855519b1
* | Fix error occurring when SecurityManager is enabledNail Samatov2019-08-231-0/+94
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It's expected that jgit should work without native git installation. In such case Security Manager can be configured to deny access to the files outside of git repository. JGit tries to find cygwin installation. If Security manager restricts access to some folders in PATH, it should be considered that those folders are absent for jgit. Also JGit tries to detect if symbolic links are supported by OS. If security manager forbids creation of symlinks, it should be assumed that symlinks aren't supported. Bug: 550115 Change-Id: Ic4b243cada604bc1090db6cc1cfd74f0fa324b98 Signed-off-by: Nail Samatov <sanail@yandex.ru>
* | Merge branch 'stable-5.3' into stable-5.4Matthias Sohn2019-08-202-9/+68
|\ \ | |/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-5.3: Fix NPE in RebaseTodoFile#parseComments Fix NPE in ObjectIdOwnerMap#get Fix NPE in CommitOnlyTest#getHead FileUtils#lastModifiedInstant should not log error if path doesn't exist Cache user global and system-wide git configurations Avoid setup and saving FileStoreAttributes compete for ~/.gitconfig lock Add missing dependencies for running FS_POSIXTest in Eclipse Fix javadoc for SystemReader#getInstance Improve retry handling when saving FileStoreAttributes fails Ensure FSTest uses MockSystemReader Make supportsAtomicCreateNewFile return true as default Update orbit to R20190602212107-2019-06 to enable backports from master Handle InvalidPathException in FS_POSIX#createNewFileAtomic Ensure root cause of lock creation failures is logged Implement toString in MockSystemReader and MockConfig LocalDiskRefTreeDatabaseTest shall use MockSystemReader Ensure LocalDiskRepositoryTestCase#setup fully uses MockSystemReader Ensure we use MockSystemReader in tests Override FileBasedConfig's save method in MockConfig Remove FileBasedConfig.load(boolean) introduced in d45219ba Disable debug log for FS in org.eclipse.jgit.test Bazel: enable logging for tests in org.eclipse.jgit.test LockFile: log exception if creation of lock file failed Stop using deprecated Constants.CHARACTER_ENCODING Change-Id: I43c2ab8b44c3e87d48e4072907ad169c81e3ffe0 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>