aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit/src/org/eclipse/jgit/submodule
Commit message (Collapse)AuthorAgeFilesLines
* [errorprone] Add missing javadoc summaryMatthias Sohn2023-09-251-2/+4
| | | | | | see https://google.github.io/styleguide/javaguide.html#s7.2-summary-fragment Change-Id: Iaf4a6b55d4e4c59b7a2da3451164abb1bb47d4a1
* [errorprone] Remove unnecessary parenthesesMatthias Sohn2023-09-221-1/+1
| | | | | | see https://errorprone.info/bugpattern/UnnecessaryParentheses Change-Id: Id08cf0e05b3d35f139fc34e0aa83882555a8a81a
* Fix all Javadoc warnings and fail on themAntoine Musso2023-06-162-13/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Ensure .gitmodules is loaded when accessing submodule nameJohn Dallaway2020-10-251-1/+4
| | | | | | | | | | | | This problem occurred when calling SubmoduleWalk#getModuleName if the first submodule processed has a name and a path which do not match SubmoduleWalk#getModuleName returned the module path instead of the module name. In order to fix this SubmoduleWalk#getModuleName needs to ensure that the modules config is loaded. Bug: 565776 Change-Id: I36ce1fbc64c4849f9d8e39864b825c6e28d344f8 Signed-off-by: John Dallaway <john@dallaway.org.uk> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Update EDL 1.0 license headers to new short SPDX compliant formatMatthias Sohn2020-01-043-114/+15
| | | | | | | | | | 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>
* IndexDiff/SubmoduleWalk: make the RepositoryBuilder configurableThomas Wolf2019-11-151-6/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | Some applications using JGit use their own repository caching. In such applications, it may be needlessly inefficient to create new submodule repositories from a SubmoduleWalk or in an IndexDiff. It can be much more efficient to use an already cached repository instance. Provide a way to configure a SubmoduleWalk with a factory to create BaseRepositoryBuilders to use to create repositories, and use it in IndexDiff. Provide new IndexDiff.diff() operations that take such an additional factory as parameter. An application that caches Repository instances (for instance EGit) can use a factory that provides builders that don't create a new Repository instance but that return the already cached instance, if one is available. Note that in such a case, the application may need to be prepared to deal with IndexDiff.diff() also _closing_ the obtained repository; if the application expects its cached Repository instances to remain open while being cached, it'll have to use Repository.incrementOpen() to prevent that the repository instance gets closed. Bug: 550878 Change-Id: Icc1b34dfc4cebd8ed4739dd09d37744d41adf711 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* IndexDiff/SubmoduleWalk: handle submodule.<name>.ignore correctlyThomas Wolf2019-11-151-0/+7
| | | | | | | | | | | | | | IndexDiff would apply ignore mode ALL from .gitmodules to all remaining submodules, and would ignore other settings from .gitignore and always apply the setting defined on the IndexDiff instead. Correct that. In canonical git the ignore setting from .gitmodules can also be overridden by .git/config.[1] Implement that override in SubmoduleWalk. [1] https://git-scm.com/docs/gitmodules#Documentation/gitmodules.txt-submoduleltnamegtignore Bug: 521613 Change-Id: I9199fd447e41c7838924856dce40678370b66395 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* SubmoduleWalk#forPath: Clarify that caller must close returned instanceDavid Pursehouse2019-04-291-2/+4
| | | | | Change-Id: I25e7913a78c23c030a8c568975ee1044a9973517 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* Revert "Use try-with-resources in SubmoduleWalk"Jonathan Nieder2019-04-141-12/+14
| | | | | | | | | This reverts commit 39b0b51b1253f569888db3578b01708a14360b69. Before that change, SubmoduleWalk.forPath transferred ownership to the caller on success. Afterward, it returns a closed SubmoduleWalk to the caller, which does not appear to be intentional. Change-Id: I9381daac5153706e24fd9117700089848b58c54e
* Use try-with-resources in SubmoduleWalkCarsten Hammer2019-04-131-14/+12
| | | | | | Convert try finally block to try-with-resources Change-Id: Ifd676a2aba3e926bd2f3b6b8fefd5f63564899ed Signed-off-by: Carsten Hammer <carsten.hammer@t-online.de> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Remove 'final' in parameter listsHan-Wen Nienhuys2018-05-151-6/+6
| | | | | Change-Id: Id924f79c8b2c720297ebc49bf9c5d4ddd6d52547 Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
* SubmoduleWalk#forIndex: Suppress resource warning and update JavadocDavid Pursehouse2018-03-141-1/+3
| | | | | | | | | | | | SubmoduleWalk is auto-closeable, and Eclipse warns that is is not managed by try-with-resource. However in this case the resource should not be closed, because the caller needs to use it. Instead, it is the responsibility of the caller to close it after use. Update the Javadoc to clarify this, and suppress the warning. Change-Id: Ib7ba349353bfd3341bdcbe4bb19abaeb9f3aeba5 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* SubmoduleWalk: Open Repository in try-with-resourceDavid Pursehouse2018-03-141-12/+8
| | | | | Change-Id: Ib29aaf26b49aa94a5a7cc0b0264a0a93ecff0c16 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* Basic submodule merge handlingDavid Turner2018-02-041-0/+77
| | | | | | | | | | | | | | | | | | | | | This doesn't handle the really hard thing, which is merging spurious conflicts inside .gitmodules files. That's OK: git.git doesn't either. Users can resolve the conflict themselves and then commit the merge. Previously, jgit would crash when attempting to merge conflicting submodule changes. Even if there was no conflict, after a merge which adds submodules, the repository would have been missing empty directories for newly-added submodules. This patch fixes the crash, and adds the empty directories where necessary. It ensures that the index is in a conflicted state when submodule changes conflict. Reported-by: Alexey Korobkov Bug: 494551 Change-Id: I79db6798c2bdcc1159b5b2589b02da198dc906a1 Signed-off-by: David Turner <dturner@twosigma.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* WorkingTreeIterator should pass FS to submodulesMarc Strapetz2017-12-301-2/+20
| | | | | Change-Id: I4b7bc6bab449b9e3aebba8170788ff9e4a04195a Signed-off-by: Marc Strapetz <marc.strapetz@syntevo.com>
* Use submodule name instead of path as key in configDavid Turner2017-12-271-10/+15
| | | | | | | | | When a submodule is moved, the "name" field remains the same, while the "path" field changes. Git uses the "name" field in .git/config when a submodule is initialized, so this patch makes JGit do so too. Change-Id: I48d8e89f706447b860c0162822a8e68170aae42b Signed-off-by: David Turner <dturner@twosigma.com>
* Fix remaining javadoc errors raised by doclintMatthias Sohn2017-12-211-1/+1
| | | | | | | For now ignore doclint "missing" warnings. Change-Id: I0e5af7a757f4d92ffeeb113f30576a35414d6781 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Fix javadoc in org.eclipse.jgit submodule packageMatthias Sohn2017-12-192-37/+75
| | | | Change-Id: Idc2a32a2e10d1cfc0b23a4f3fd1bf29840724336 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Use Config.getEnum() to read the IgnoreSubmoduleModeThomas Wolf2017-09-041-7/+2
| | | | | | | Doing so goes through the TypedConfigGetter and thus allows library clients (for instance EGit) to warn about invalid configurations. Change-Id: If1080ad90b8aff54a903d4d75637614faad6469b Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* Don't assume name = path in .gitmodulesThomas Wolf2017-09-041-11/+43
| | | | | | | | | | | | | | | While parsing .gitmodules, the name of the submodule subsection is purely arbitrary: it frequently is the path of the submodule, but there's no requirement for it to be. By building a map of paths to the section name in .gitmodules, we can more accurately return the submodule URL. Bug: 508801 Change-Id: I8399ccada1834d4cc5d023344b97dcf8d5869b16 Also-by: Doug Kelly <dougk.ff7@gmail.com> Signed-off-by: Doug Kelly <dougk.ff7@gmail.com> Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch> Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* Don't rely on default locale when using toUpperCase() and toLowerCase()Matthias Sohn2017-01-281-1/+3
| | | | | | | | | | | | | | | | Otherwise these methods may produce unexpected results if used for strings that are intended to be interpreted locale independently. Examples are programming language identifiers, protocol keys, and HTML tags. For instance, "TITLE".toLowerCase() in a Turkish locale returns "t\u0131tle", where '\u0131' is the LATIN SMALL LETTER DOTLESS I character. See https://docs.oracle.com/javase/8/docs/api/java/lang/String.html#toLowerCase-- http://blog.thetaphi.de/2012/07/default-locales-default-charsets-and.html Bug: 511238 Change-Id: Id8d8f37d84d62239c918b81f8d883ed798d87656 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Replace use of deprecated method Repository.getRef()Matthias Sohn2016-05-311-2/+2
| | | | Change-Id: Iecf2b8deafc4991cc3333702fb9fa0638be7b914 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* containsGitModulesFile() should not crash on bare repositoryAndrey Loskutov2015-08-031-6/+6
| | | | | Change-Id: Iba7e4674b3d33c730613a6ac703977f48b015853 Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
* Replace deprecated release() methods by close()Matthias Sohn2015-05-211-9/+0
| | | | | | | | See the discussion [1] in the Gerrit mailing list. [1] https://groups.google.com/forum/#!topic/repo-discuss/RRQT_xCqz4o Change-Id: I2c67384309c5c2e8511a7d0d4e088b4e95f819ff Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Use AutoClosable to close resources in bundle org.eclipse.jgitMatthias Sohn2015-05-211-9/+6
| | | | | | | - use try-with-resource where possible - replace use of deprecated release() by close() Change-Id: I0f139c3535679087b7fa09649166bca514750b81 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Implement AutoClosable interface on classes that used release()Matthias Sohn2015-02-091-3/+17
| | | | | | | | | Implement AutoClosable and deprecate the old release() method to give JGit consumers some time to adapt. Bug: 428039 Change-Id: Id664a91dc5a8cf2ac401e7d87ce2e3b89e221458 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Add missing @since tags in SubmoduleWalkMatthias Sohn2014-11-031-0/+4
| | | | Change-Id: Ica34e6709a34977422fd528cbd4df0044403e45d Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Enhance SubmoduleWalk with a fast check whether a repo containsChristian Halstrick2014-11-031-0/+22
| | | | | | submodules Change-Id: Id37efb4f4dd77f3b8eb5607d15d32adeda3992d4
* Support for Submodule configuration submodule.<name>.ignoreChristian Halstrick2014-11-031-0/+44
| | | | | | | | | | | | For each submodule native git allows to configure which modifications to submodules should be ignored by the status command. It is possible to ignore "none", "all", "dirty", "untracked" [1]. This configuration is now supported by IndexDiff. The StatusCommand offers the possibility to specify this mode. [1] http://git-scm.com/docs/gitmodules Change-Id: Ifd81d574a680f9b4152945ba70f8ec4af4f452c9
* Mark non-externalizable strings as suchRobin Rosenberg2012-12-271-3/+3
| | | | | | | | | | A few classes such as Constanrs are marked with @SuppressWarnings, as are toString() methods with many liternal, but otherwise $NLS-n$ is used for string containing text that should not be translated. A few literals may fall into the gray zone, but mostly I've tried to only tag the obvious ones. Change-Id: I22e50a77e2bf9e0b842a66bdf674e8fa1692f590
* Add Javadoc description for packagesRobin Stocker2012-10-311-0/+4
| | | | | | | | | These appear as descriptions in the index, see here (currently empty): http://download.eclipse.org/jgit/docs/latest/apidocs/ Change-Id: If7996deef30ae688bade8b3ad6b19547ca3d8b50 Signed-off-by: Chris Aniszczyk <zx@twitter.com>
* Use the working tree's .gitmodules in SubmoduleWalk.forIndex()Dave Borowitz2012-06-251-19/+9
| | | | | | | This was broken in fe1f1b8f8aba60fdd1ad6f0f72e9c9180978cc60, which preferred the index over the working tree when both were present. Change-Id: I97dcf9a088adcbd0187fa7eec9ef34445ce3a981 Signed-off-by: Kevin Sawicki <kevin@github.com>
* Fix resource leaks due to unclosed repositoriesChristian Halstrick2012-06-161-3/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Whenever a call to JGit returns a Repository the caller should make sure to call close() on it if he doesn't need it anymore. Since instances of Repository contain e.g. open FileOutputStreams (for pack files) forgetting to close the repository can lead to resource leaks. This was the reason why dozens of the JUnit tests failed on Windows with "Can't delete file ...." errors. In LocalDiskRepositoryTestCase.tearDown() we tried to delete the repositories we used during tests which failed because we had open FileOutputStreams. Not only the obvious cases during Clone or Init operations returned Repositories, but also the new SubModule API created repository instances. In some places we even forgot to close submodule repositories in our internal coding. To see the effects of this fix run the JGit JUnit tests under Windows. On other platforms it's harder to see because either the leaking resources don't lead to failing JUnit tests (on Unix you can delete files with open FileOutputStreams) or the java gc runs differently and cleans up the resources earlier. Change-Id: I6d4f637b0d4af20ff4d501db091548696373a58a Signed-off-by: Christian Halstrick <christian.halstrick@sap.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Read .gitmodules config from the tree in SubmoduleWalkDave Borowitz2012-06-151-7/+142
| | | | | | | | | | | | | It is not always appropriate to use the .gitmodules file from the working tree, for example if reading the modules at a specific commit. And sometimes it is impossible, as in a bare repository. When using the static factory methods, automatically set up the appropriate root tree so lazy loading of the config file reads from the appropriate place. Leave the current behavior of looking in the working tree as a fallback for the case where walking the index. Change-Id: I71b7ed3ba16c80b0adb8c5fd85b5c37fd4aef8eb
* Add a release() method to SubmoduleWalkDave Borowitz2012-06-151-12/+29
| | | | | | | | We need a way to release the underlying TreeWalk. Also, use this method to release walks from the static factory methods on error or when submodules are not found. Change-Id: I6bedc2db78bcd577aef2cfe6715bb981a26dcfd7
* Move JGitText to an internal packageRobin Rosenberg2012-03-121-1/+1
| | | | Change-Id: I763590a45d75f00a09097ab6f89581a3bbd3c797
* Support gitdir references in working tree .git fileKevin Sawicki2012-02-081-34/+19
| | | | | | | | | | | | | A '.git' file in a repository's working tree root is now parsed as a ref to a folder located elsewhere. This supports submodules having their repository location outside of the parent repository's working directory such as in the parent repository's '.git/modules' directory. This adds support to BaseRepositoryBuilder for repositories created with the '--separate-git-dir' option specified to 'git init'. Change-Id: I73c538f6d845bdbc0c4e2bce5a77f900cf36e1a9 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Support relative submodule URLs on init/add/syncKevin Sawicki2012-01-171-0/+94
| | | | | | | | | | Interpret submodule URLs that start with './' or '../' as relative to either the configured remote for the HEAD branch, or 'origin', or the parent repository working directory if no remote URL is configured Bug: 368536 Change-Id: Id4985824023b75cd45cd64a4dd9d421166391e10
* Add comand support for git-submoduleKevin Sawicki2011-12-283-0/+614
Adds the following commands: - Add - Init - Status - Sync - Update This also updates AddCommand so that file patterns added that are submodules can be staged in the index. Change-Id: Ie5112aa26430e5a2a3acd65a7b0e1d76067dc545 Signed-off-by: Kevin Sawicki <kevin@github.com> Signed-off-by: Chris Aniszczyk <zx@twitter.com>