aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit/src/org/eclipse/jgit/notes
Commit message (Collapse)AuthorAgeFilesLines
* NoteMapMerger: remove unnecessary castMatthias Sohn2024-10-011-1/+1
| | | | Change-Id: I3be4963f506529bbadc5b6dfc0b625ee85effc1f
* [errorprone] Add missing javadoc summaryMatthias Sohn2023-09-251-1/+5
| | | | | | see https://google.github.io/styleguide/javaguide.html#s7.2-summary-fragment Change-Id: Iaf4a6b55d4e4c59b7a2da3451164abb1bb47d4a1
* Fix all Javadoc warnings and fail on themAntoine Musso2023-06-164-3/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Remove redundant type argumentsThomas Wolf2021-09-302-2/+2
| | | | | | | | In Java 11 type arguments for anonymous subclasses can be inferred and don't need to be specified. This resolves a number of compiler warnings. Change-Id: I55eff3babb7628aa0627085e65a1b45eb12c2cd3 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* Update EDL 1.0 license headers to new short SPDX compliant formatMatthias Sohn2020-01-0412-456/+60
| | | | | | | | | | 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>
* Enable and fix "Statement unnecessarily nested within else clause" warningsDavid Pursehouse2019-10-175-45/+41
| | | | | | | | | | | | | | | 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>
* [error prone] suppress AmbiguousMethodReference in AnyObjectIdMatthias Sohn2019-08-081-2/+2
| | | | | | | | | | Move the implementation of the static equals() method to a new method and suppress the error. Deprecate the old method to signal that we intend to remove it in the next major release. See https://errorprone.info/bugpattern/AmbiguousMethodReference Change-Id: I5e29c97f4db3e11770be589a6ccd785e2c9ac7f2 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Remove 'final' in parameter listsHan-Wen Nienhuys2018-05-151-1/+1
| | | | | Change-Id: Id924f79c8b2c720297ebc49bf9c5d4ddd6d52547 Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
* DefaultNoteMerger: Open UnionInputStream in try-with-resourceDavid Pursehouse2018-03-061-5/+2
| | | | | Change-Id: I035aa89cdbf235992f41e752f49d735be4e5df0a Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* Remove unused importsMatthias Sohn2017-12-201-2/+0
| | | | | | Change-Id: I35370c66e54d93d9b0aa3995e300706956ec0923 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com> Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* Fix javadoc in org.eclipse.jgit nls and notes packageMatthias Sohn2017-12-196-50/+61
| | | | Change-Id: I1b65fba5b4856f98974dc10f549540d401ef916f Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Enable and fix 'Should be tagged with @Override' warningDavid Pursehouse2017-02-194-0/+10
| | | | | | | | | | | | | | | | | | | | | | | Set missingOverrideAnnotation=warning in Eclipse compiler preferences which enables the warning: The method <method> of type <type> should be tagged with @Override since it actually overrides a superclass method Justification for this warning is described in: http://stackoverflow.com/a/94411/381622 Enabling this causes in excess of 1000 warnings across the entire code-base. They are very easy to fix automatically with Eclipse's "Quick Fix" tool. Fix all of them except 2 which cause compilation failure when the project is built with mvn; add TODO comments on those for further investigation. Change-Id: I5772061041fd361fe93137fd8b0ad356e748a29c Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* Paths.pathCompare: Utility to sort paths from byte[]Shawn Pearce2016-01-091-22/+4
| | | | | | | | | Consolidate copies of this function into one location. Add some unit tests to prevent bugs that were accidentally introduced while trying to make this refactoring. Change-Id: I82f64bbb8601ca2d8316ca57ae8119df32bb5c08
* FanoutBucket: Create ObjectInserter.Formatter in try-with-resourceDavid Pursehouse2015-10-011-2/+2
| | | | | | | To prevent potential resource leak. Change-Id: Ife09be2822bc476199f10da8d1eb7ccc8da05b79 Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
* Use AutoClosable to close resources in bundle org.eclipse.jgitMatthias Sohn2015-05-211-1/+4
| | | | | | | - 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>
* Replace deprecated release() methods by close() in NoteMapMergerMatthias Sohn2015-04-041-2/+2
| | | | Change-Id: Iaa76f0e853bb82cd7f231fd2f462a319f4196d8c Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* [findBugs] Ensure streams are closed in a finally blockMatthias Sohn2014-03-111-3/+7
| | | | Change-Id: I3137eba00d6eba96ca9051b6687fcf62e0871bcc Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Mark non-externalizable strings as suchRobin Rosenberg2012-12-274-4/+5
| | | | | | | | | | 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>
* Move JGitText to an internal packageRobin Rosenberg2012-03-121-1/+1
| | | | Change-Id: I763590a45d75f00a09097ab6f89581a3bbd3c797
* Fix ClassCastException in MergeCommandDenys Digtiar2011-08-211-18/+7
| | | | | | | | | | Test was added which reproduce the ClassCastException when ours or theirs merge strategy is set to MergeCommand. Merger and MergeCommand were updated in order to avoid exception. Change-Id: I4c1284b4e80d82638d0677a05e5d38182526d196 Signed-off-by: Denys Digtiar <duemir@gmail.com> Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
* Add shortening of note ref names to NoteMapKevin Sawicki2011-05-231-0/+13
| | | | | Change-Id: I224190bbb41c7cbea38388d0148ecc6dc68f3a14 Signed-off-by: Kevin Sawicki <kevin@github.com>
* Exposed the constructor of Note classSasa Zivkov2011-01-255-9/+25
| | | | | | | | | | | | | | | Additionally, defined the NoteMap.getNote method which returns a Note instance. These changes were necessary to enable implementation of the NoteMerger interface (the merge method needs to instantiate a Note) and to enable direct use of NoteMerger which expects instances of Note class as its paramters. Implementing creation of code review summary notes in Gerrit [1] will make use of both of these features. [1] https://review.source.android.com/#change,20045 Change-Id: I627aefcedcd3434deecd63fa1d3e90e303b385ac Signed-off-by: Sasa Zivkov <sasa.zivkov@sap.com> Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
* Merging Git notesSasa Zivkov2011-01-099-20/+748
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Merging Git notes branches has several differences from merging "normal" branches. Although Git notes are initially stored as one flat tree the tree may fanout when the number of notes becomes too large for efficient access. In this case the first two hex digits of the note name will be used as a subdirectory name and the rest 38 hex digits as the file name under that directory. Similarly, when number of notes decreases a fanout tree may collapse back into a flat tree. The Git notes merge algorithm must take into account possibly different tree structures in different note branches and must properly match them against each other. Any conflict on a Git note is, by default, resolved by concatenating the two conflicting versions of the note. A delete-edit conflict is, by default, resolved by keeping the edit version. The note merge logic is pluggable and the caller may provide custom note merger that will perform different merging strategy. Additionally, it is possible to have non-note entries inside a notes tree. The merge algorithm must also take this fact into account and will try to merge such non-note entries. However, in case of any merge conflicts the merge operation will fail. Git notes merge algorithm is currently not trying to do content merge of non-note entries. Thanks to Shawn Pearce for patiently answering my questions related to this topic, giving hints and providing code snippets. Change-Id: I3b2335c76c766fd7ea25752e54087f9b19d69c88 Signed-off-by: Sasa Zivkov <sasa.zivkov@sap.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* NoteMap implements Iterable<Note>Sasa Zivkov2011-01-052-3/+18
| | | | | | | | | We will need to iterate over all notes of a NoteMap, at least this will be needed for testing purposes. This change also implied making the Note class public. Change-Id: I9b0639f9843f457ee9de43504b2499a673cd0e77 Signed-off-by: Sasa Zivkov <sasa.zivkov@sap.com>
* Simplify NoteParser use of prefix.length()Shawn O. Pearce2010-12-131-9/+9
| | | | | | | | | | Sasa pointed out we only ever use the length here, so instead of holding onto the AbbreviatedObjectId, lets just hold onto the length as a primitive int. Change-Id: I2444f59f9fe5ddcaea4a3537d3f1064736ae3215 Signed-off-by: Shawn O. Pearce <spearce@spearce.org> CC: Sasa Zivkov <zivkov@gmail.com>
* Add insert(TreeFormatter) to ObjectInserterShawn O. Pearce2010-12-032-2/+2
| | | | | | | | | This makes usage of a TreeFormatter more similar to a CommitBuilder or a TagBuilder: populate the formatter and pass to the ObjectInserter. Change-Id: I5a45ef3a35cc73f4905a34bc6f6228510df8eb2c Signed-off-by: Shawn O. Pearce <spearce@spearce.org> Reviewed-by: Chris Aniszczyk <caniszczyk@gmail.com>
* Remove unnecessary note fanout when removing notesShawn O. Pearce2010-11-123-0/+49
| | | | | | | | | | | | | | | Fanout level notes trees are combined back together into a flat leaf level tree if during a removal of a subtree there are less than 3/4 of the fanout subtrees still existing, and the size of the combined leaf is under the 256 split limit noted above. This rule is used because deletes are less common than insertions, and SHA-1's relatively uniform distribution suggests that with only 192 subtrees existing in the fanout, there should be approximately 192 names in the combined replacement leaf tree. Change-Id: Ia9d145ffd5454982509fc40906bc4dbbf2b13952 Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* Split note leaf buckets at 256 elementsShawn O. Pearce2010-11-123-7/+58
| | | | | | | | | | | | | Leaf level notes trees are split into a new fan-out tree if an insertion occurs and the tree already contains >= 256 notes in it. The splitting may occur multiple times if all of the notes have the same prefix; in the worst case this produces a tree path such as "00/00/00/00/00/00/00/00/00/00/00/00/00/00/00/00/00/00/00/be" if all of the notes begin with zeros. Change-Id: I2d7d98f35108def9ec49936ddbdc34b13822a3c7 Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* Add internal API for note iterationShawn O. Pearce2010-11-123-0/+85
| | | | | | | | | | | | | | Some algorithms need to be able to iterate through all notes within a particular bucket, such as when splitting or combining a bucket. Exposing an Iterator<Note> makes this traversal possible. For a LeafBucket the iteration is simple, its over the sorted array of elements. For FanoutBucket its a bit more complex as the iteration needs to union the iterators of each fanout bucket, lazily loading any buckets that aren't already in-memory. Change-Id: I3d5279b11984f44dcf0ddb14a82a4b4e51d4632d Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* Allow writing a NoteMap back to the repositoryShawn O. Pearce2010-11-125-0/+131
| | | | | | | | This is necessary to allow applications to wrap the note tree in a commit and update the note branch with the new state. Change-Id: Idbd7ead4a1b16ae2b64a30a4a01a29cfed548cdf Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* Add in-memory updating support to NoteMapShawn O. Pearce2010-11-124-0/+172
| | | | | | | | | | NoteMap now supports editing in-memory, allowing applications to modify the NoteMap once it has been loaded from the branch. The ability to write the branch back to tree objects is not yet done, so the edits are strictly transient. Change-Id: I63448954abfca2a8e3e95369cd84c0d1176cdb79 Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* Remember non-note tree entries when readingShawn O. Pearce2010-11-113-1/+116
| | | | | | | | | | | | | | In order to safely edit a notes tree, NoteMap needs to retain any non-note tree entries it read from the source tree and put them back out into the modified tree when it commits a new version of the note branch. Remember any tree entries that didn't look like a note during the parsing of the tree, so they can be put into a TreeFormatter later when the tree writes to the repository. Change-Id: Ia284af7e7866da35db35374c6c5869f00c857944 Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* Lazy load note subtrees from fanout levelsShawn O. Pearce2010-11-116-69/+557
| | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of reading a note tree recursively up front when the NoteMap is loaded, read only the root tree and load subtrees on demand when they are accessed by the application. This gives a lower latency to read a note for the recent commits on a branch, as only the paths that are needed get read. Given a 2/38 style fanout, the tree will fully load when 256 objects have been accessed by the application. But unlike the prior version of NoteMap, the NoteMap will load faster and answer lookups sooner, as the loading time for all 256 levels is spread out across each of the get() requests. Given a 2/2/36 style fanout, the tree won't need to fully load until about 65,536 objects are accessed. To simplify the implementation we only support the flat layout (all notes in the top level tree), or a 2/38, 2/2/36, 2/2/2/34, through 2/.../2 style fanout. Unlike C Git we don't support reading the old experimental 4/36 fanout. This is sufficient because C Git won't create the 4/36 style fanout when creating or updating a notes tree, and there really aren't any in the wild today. Change-Id: I6099b35916a8404762f31e9c11f632e43e0c1bfd Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* Define NoteMap, a simple note tree readerShawn O. Pearce2010-11-112-0/+353
The NoteMap makes it easy to read a small notes tree as created by the `git notes` command in C Git. To make the initial implementation simple a notes tree is read recursively into a map in memory. This is reasonable if the application will need to access all notes, or if there are less than 256 notes in the tree, but doesn't behave well when the number of notes exceeds 256 and the application doesn't need to access all of them. We can later add support for lazily loading different subpaths, thus fixing the large note tree problem described above. Currently the implementation only supports reading. Writing notes is more complex because trees need to be expanded or collapsed at the exact 256 entry cut-off in order to retain the same tree SHA-1 that C Git would use for the same content. It also needs to retain non-note tree entries such as ".gitignore" or ".gitattribute" files that might randomly appear within a notes tree. We can also add writing support later. Change-Id: I93704bd84ebf650d51de34da3f1577ef0f7a9144 Signed-off-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>