aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit/src/org/eclipse/jgit/transport/ReceiveCommand.java
Commit message (Collapse)AuthorAgeFilesLines
* Fix all Javadoc warnings and fail on themAntoine Musso2023-06-161-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Merge branch 'stable-5.6'Matthias Sohn2020-02-221-2/+2
|\ | | | | | | | | | | | | | | | | | | | | | | | | * stable-5.6: Revert "Prepend hostname to subsection used to store file timestamp resolution" SimilarityRenameDetector: Fix inconsistent indentation Use indexOf(char) and lastIndexOf(char) rather than String versions Reorder modifiers to follow Java Language Specification GitmoduleEntry: Remove redundant import of class from same package Remove redundant "static" qualifier from enum declarations Change-Id: Ibb66bef7e8373f81e3e653c9843d986243446d68 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| * Remove redundant "static" qualifier from enum declarationsDavid Pursehouse2020-02-191-2/+2
| | | | | | | | | | | | | | Nested enum types are implicitly static. Change-Id: Id3d7886087494fb67bc0d080b4a3491fb4baac19 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* | Update EDL 1.0 license headers to new short SPDX compliant formatMatthias Sohn2020-01-041-38/+5
|/ | | | | | | | | | 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>
* Suppress the API errors introduced by 3e9a5f99Matthias Sohn2019-11-141-1/+1
| | | | | | | | I1ce92869435d5eebb7d671be44561e69c6233134 merged BaseReceivePack into ReceivePack which breaks API but is only affecting the few jgit based servers out in the wild. Change-Id: Iad856a2afaf3cad95d01ad81a0116cebcd9de2d9 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* transport: Merge BaseReceivePack into ReceivePackMasaya Suzuki2019-11-131-4/+4
| | | | | | | | | | | | | Move the BaseReceivePack implementation back into ReceivePack. This is a backward-incompatible change. For example, BaseReceivePack.FirstLine no longer exists and cannot be referenced. However, most of the code should just work by replacing BaseReceivePack with ReceivePack. Although this is an API change, it only affects callers using JGit as a server, and there are very few of those in the wild. Change-Id: I1ce92869435d5eebb7d671be44561e69c6233134 Signed-off-by: Masaya Suzuki <masayasuzuki@google.com>
* [error prone] suppress AmbiguousMethodReference in AnyObjectIdMatthias Sohn2019-08-081-3/+3
| | | | | | | | | | 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 further unnecessary 'final' keywordsHan-Wen Nienhuys2018-05-181-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove it from * package private functions. * try blocks * for loops this was done with the following python script: $ cat f.py import sys import re import os def replaceFinal(m): return m.group(1) + "(" + m.group(2).replace('final ', '') + ")" methodDecl = re.compile(r"^([\t ]*[a-zA-Z_ ]+)\(([^)]*)\)") def subst(fn): input = open(fn) os.rename(fn, fn + "~") dest = open(fn, 'w') for l in input: l = methodDecl.sub(replaceFinal, l) dest.write(l) dest.close() for root, dirs, files in os.walk(".", topdown=False): for f in files: if not f.endswith('.java'): continue full = os.path.join(root, f) print full subst(full) Change-Id: If533a75a417594fc893e7c669d2c1f0f6caeb7ca Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
* Remove 'final' in parameter listsHan-Wen Nienhuys2018-05-151-3/+3
| | | | | Change-Id: Id924f79c8b2c720297ebc49bf9c5d4ddd6d52547 Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
* Fix javadoc in org.eclipse.jgit transport packageMatthias Sohn2017-12-201-22/+68
| | | | Change-Id: Id70e2c27e38bf12f87e66b28fbd0b06908494764 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Add missing @since tags for new API in ReceiveCommandMatthias Sohn2017-10-231-2/+8
| | | | Change-Id: I6e5d29390b71a1c123bc90ec2e3435706ea9211c Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Support symbolic references in ReceiveCommandShawn Pearce2017-10-181-15/+226
| | | | | | | | | | | | | | | | | | | | Allow creating symbolic references with link, and deleting them or switching to ObjectId with unlink. How this happens is up to the individual RefDatabase. The default implementation detaches RefUpdate if a symbolic reference is involved, supporting these command instances on RefDirectory. Unfortunately the packed-refs file does not support storing symrefs, so atomic transactions involving more than one symref command are failed early. Updating InMemoryRepository is deferred until reftable lands, as I plan to switch InMemoryRepository to use reftable for its internal storage representation. Change-Id: Ibcae068b17a2fc6d958f767f402a570ad88d9151 Signed-off-by: Minh Thai <mthai@google.com> Signed-off-by: Terry Parker <tparker@google.com>
* Support force writing reflog on a per-update basisDave Borowitz2017-09-301-2/+30
| | | | | | | | | | Even if a repository has core.logAllRefUpdates=true, ReflogWriter does not create reflog files unless the refs are under a hard-coded list of prefixes, or unless the forceWrite bit is set. Expose the forceWrite bit on a per-update basis in RefUpdate/BatchRefUpdate/ReceiveCommand, creating RefLogWriters as necessary. Change-Id: Ifc851fba00f76bf56d4134f821d0576b37810f80
* Support overriding a batch's reflog on a per-ReceiveCommand basisDave Borowitz2017-07-261-0/+92
| | | | Change-Id: I86a4b8f6b4f85b2bae64c1b121e4ee527d46de83
* Implement atomic BatchRefUpdates for RefDirectoryDave Borowitz2017-07-251-0/+14
| | | | | | | | | | | | | | The existing packed-refs file provides a mechanism for implementing atomic multi-ref updates without any changes to the on-disk format or lockfile protocol. We just need to make sure that there are no loose refs involved in the transaction, which we can achieve by packing the refs while holding locks on all loose refs. Full details of the algorithm are in the PackedBatchRefUpdate javadoc. This change does not implement reflog support, which will come in a later change. Change-Id: I09829544a0d4e8dbb141d28c748c3b96ef66fee1
* Separate RefUpdate.Result.REJECTED_{MISSING_OBJECT,OTHER_REASON}Dave Borowitz2017-07-251-0/+8
| | | | | | | | | | | | | | | | | | | | | | | ReceiveCommand.Result has a slightly richer set of possibilities, so it makes sense for RefUpdate.Result to have more values in order to match. In particular, this allows us to return REJECTED_MISSING_OBJECT from RefUpdate when an object is missing. The comment in RefUpdate#safeParse about expecting some old objects to be missing is only applicable to the old ID, not the new ID. A missing new ID is a bug or programmer error, and we should not update a ref to point to one. Fix various tests that started failing because they depended for no good reason on setting refs to point to nonexistent objects; it's always easy to create a real object when necessary. It is possible that some downstream users of RefUpdate.Result might choose to handle one of the new statuses differently, for example by providing a more user-readable error message; that is not done in this change. Change-Id: I734b1c32d5404752447d9e20329471436ffe05fc
* ReceiveCommand: Explicitly check constructor preconditionsDave Borowitz2017-07-171-4/+43
| | | | | | | | | | | | | | | | | | Some downstream code checks whether a ReceiveCommand is a create or a delete based on the type field. Other downstream code (in particular a good chunk of Gerrit code I wrote) checks the same thing by comparing oldId/newId to zeroId. Unfortunately, there were no strict checks in the constructor that ensures that zeroId is only set for oldId/newId if the type argument corresponds, so a caller that passed mismatched IDs and types would observe completely undefined behavior as a result. This is and always has been a misuse of the API; throw IllegalArgumentException so the caller knows that it is a misuse. Similarly, throw from the constructor if oldId/newId are null. The non-nullness requirement was already documented. Fix RefDirectoryTest to not do the wrong thing. Change-Id: Ie2d0bfed8a2d89e807a41925d548f0f0ce243ecf
* ReceiveCommand.abort(): Utility to mark batch of commands as failedShawn Pearce2016-01-181-0/+22
| | | | | | | | If one or more commands is failing the entire group usually has to also fail with "transaction aborted". Pull this loop into a helper so the idiom can be easily reused in several places throughout JGit. Change-Id: I3b9399b7e26ce2b0dc5f7baa85d585a433b4eaed
* Fix wrong @since tag In ReceiveCommandMatthias Sohn2015-12-021-1/+1
| | | | Change-Id: I58fa657dd4783fed0ffca94020c87c49d99009c6 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* ReceiveCommand.filter: Accept IterableShawn Pearce2015-12-011-7/+28
| | | | | | | | | | PreReceiveHook is given a Collection<ReceiveCommand> and it can be very useful here to call ReceiveCommand.filter(cmds, NOT_ATTEMPTED). Overload filter to accept both Iterable and List. Keep backwards binary compatibility for List by upcasting to Iterable. Change-Id: Ib1341876c703670945ef209edc8259715ee86c26
* Initialise ReceiveCommand status to NOT_ATTEMPTED for all constructorsRoberto Tyley2014-02-131-2/+1
| | | | | | | | | | | | | Formerly the 4-arg constructor did not do this, which was unfortunate as that constructor's the only way for an external user of JGit to set the /type/ of the ref-update - which you might want to do to indicate that the update is expected to be a UPDATE_NONFASTFORWARD, and thus does not require expensive isMergedInto() calculations: http://dev.eclipse.org/mhonarc/lists/jgit-dev/msg02258.html Change-Id: I84c5e4927131e105bed93e31a62da6367c78de32 Signed-off-by: Roberto Tyley <roberto.tyley@gmail.com>
* Mark non-externalizable strings as suchRobin Rosenberg2012-12-271-1/+2
| | | | | | | | | | 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
* Batch reference updates together for storageShawn O. Pearce2012-05-221-3/+13
| | | | | | | | | | | | | | | | | | | | | clone, fetch and push can all update multiple references in a single command invocation. Rather than performing sequential iteration of each reference change inside of the application code, push this down into the reference database where the implementation can take advantage of the batch size and optimize itself. For the local filesystem implementation the obvious optimization is to write a packed-refs file when the repository is completely empty. The initial clone, fetch or push into the destination may have hundreds of new references. Writing all of these as loose files is not efficient. This optimization is not implemented in this commit and is left as an exercise for the reader to supply in a future commit to JGit. To make the API changes simple, define the BatchRefUpdate type and implementation using the existing sequential behavior. Change-Id: I8e1674f091e05e24e3ff56ccbc687a6d18a6a61e
* Expose ReceiveCommand.updateType to check for UPDATE_NONFASTFORWARDShawn O. Pearce2012-05-221-0/+41
| | | | | | | | | | | | | | When a command's type is UPDATE, JGit might not yet be sure if it is a fast-forward or not. Expose a utility method to compute the exact type by performing the merge base test, allowing the type to be switched to UPDATE_NONFASTFORWARD if old ObjectId is not contained in new ObjectId. BaseReceivePack already does this test when validating the incoming command list, so provide a package level backdoor to set the type and avoid needing to redo the merge test later. Change-Id: If5a6fcc50dc4d6f96e9bb0bb7bba15ebe8b86377
* Factor a base class out of ReceivePackDave Borowitz2012-05-141-4/+4
| | | | | | | | | | | | We are working on a publish/subscribe based git protocol, and we want to reuse several parts of the ReceivePack-like code for reading commands and processing a pack. In this new implementation, the connection management will be very different, in particular, there may be multiple packs received on a single open connection. So, hoist out as much as we can from ReceivePack, mostly just leaving behind the single-connection version in that class. Change-Id: I5567aad6ae77951f73f59c1f91996d934ea88334
* Add missing @since tags to mark API added in 2.0Matthias Sohn2012-05-101-2/+5
| | | | | | Change-Id: I0a86ce0e393dfde9bb27f0b29e036e76c856396e Signed-off-by: Matthias Sohn <matthias.sohn@sap.com> Signed-off-by: Chris Aniszczyk <zx@twitter.com>
* Move JGitText to an internal packageRobin Rosenberg2012-03-121-1/+1
| | | | Change-Id: I763590a45d75f00a09097ab6f89581a3bbd3c797
* Extract filterCommands as a static method on ReceiveCommandDave Borowitz2012-02-291-0/+22
| | | | Change-Id: I24501f95185878d09b54562e48cb4e7e45dd3968
* Allow creating ReceiveCommands with a specified typeDave Borowitz2012-02-291-0/+22
| | | | | | | | This allows callers who know in advance whether a command is UPDATE or UPDATE_NONFASTFORWARD to specify this in the constructor rather than with a separate method call. Change-Id: Iae483594a4ff370ff75d17a7b0648c5590b3d1bd
* Execute ReceiveCommands via a method rather than in ReceivePackDave Borowitz2012-02-291-0/+78
| | | | | | | | This allows a PreReceiveHook to easily "take over" all of the ReceiveCommands passed to it, preventing any of them from being handled within the ReceivePack core. Change-Id: I2a8c1fc44e8dcadf22cd97a8ec4ee79d4d9d08f1
* Initial JGit contribution to eclipse.orgGit Development Community2009-09-291-0/+229
Per CQ 3448 this is the initial contribution of the JGit project to eclipse.org. It is derived from the historical JGit repository at commit 3a2dd9921c8a08740a9e02c421469e5b1a9e47cb. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>