aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit/src/org/eclipse/jgit/api/CreateBranchCommand.java
Commit message (Collapse)AuthorAgeFilesLines
* Fix branch ref exist checkflorian.signoret2023-11-181-3/+1
| | | | | | | | | When a tag with the same name as the branch exists, the branch creation process should work too. We should detect that the branch already exists, and allow to force create it when the force option is used. Bug: 582538 Change-Id: I3b350d03be8edcde10e97b2318343240ca896cb0
* 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>
* 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>
* Validate branch names on branch creationMatthias Sohn2018-06-091-6/+26
| | | | | | | | | | | Since v2.16.0-rc0~89^2~1 (branch: correctly reject refs/heads/{-dash,HEAD}, 2017-11-14), native git does not allow branch names - refs/heads/HEAD - starting with '-' Bug: 535655 Change-Id: Ib1c4ec9ea844073901a4ebe6a29ff6cc8ae58e93 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Fix javadoc in org.eclipse.jgit annotations and api packagesMatthias Sohn2017-12-181-11/+14
| | | | Change-Id: I2761ea91f8dfed16ea54e7a6646af03a30c15ec9 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Enable and fix 'Should be tagged with @Override' warningDavid Pursehouse2017-02-191-0/+1
| | | | | | | | | | | | | | | | | | | | | | | 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>
* Replace use of deprecated method Repository.getRef()Matthias Sohn2016-05-311-3/+3
| | | | Change-Id: Iecf2b8deafc4991cc3333702fb9fa0638be7b914 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Use AutoClosable to close resources in bundle org.eclipse.jgitMatthias Sohn2015-05-211-4/+1
| | | | | | | - 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>
* Fix CheckoutCommand not setting up trackingRobin Stocker2014-08-051-12/+10
| | | | | | | | | | | | | Instead of passing on the start point as is to CreateBranchCommand, the resolved ObjectId was used. Given this, CreateBranchCommand did not set up tracking. This also fixes CreateBranchCommand with setStartPoint(null) to use HEAD (instead of NPEing), as documented in the Javadoc. Bug: 441153 Change-Id: I5ed82b4a4b4a32a81a7fa2854636b921bcb3d471 Signed-off-by: Robin Stocker <robin@nibor.org>
* Fix ArrayIndexOutOfBoundsException in CreateBranchCommandRobin Rosenberg2014-04-271-6/+5
| | | | | | | | | | | | | | If remote name contains / or there was a branch directly under the refs/remotes namespace (wrong) the computation of remote name and suggested local branch name would fail. Fix this by looking at the configured remotes. A ref under refs/remotes that does not match a remote configuration is not considered a remote tracking branch anymore. This patch does not fix all similar errors in EGit/JGit. Bug: 411002 Bug: 400414 Change-Id: I2515a6ed05f9104c387ce4e43b24dae942ae2473
* Mark non-externalizable strings as suchRobin Rosenberg2012-12-271-13/+13
| | | | | | | | | | 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
* Simplify push error message when ref already existsShawn O. Pearce2012-10-171-1/+1
| | | | | | | | | | | | | | If a client attempts to create a branch that already exists on the remote side, tell them "already exists" rather than repeat lots of information about the reference. Previously the error looked like: ! [remote rejected] tags/1.3.1 -> 1.3.1 (Ref Ref[refs/tags/1.3.1=e3857ee05...] already exists) Now it will simply say: ! [remote rejected] tags/1.3.1 -> 1.3.1 (already exists) Change-Id: I96fc67ca8b650052de6e662449a3c5bc8bbc010b
* Git API does not declare GitAPIException call() and related cleanupsRobin Rosenberg2012-05-301-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | All commands should throw a GitAPIException so new exceptions can be added without breaking the builds of old code, i.e. anyone that calls a Git API should catch GitAPIException and not just the currently known exceptions. Now the only checked exceptions on Git API calls are GitException and subclasses of it. New checked exceptions that are subclasses of GitException may be added without breaking the API. Javadoc for GitAPIException is declared on GitCommand and inherited to subclasses. JGitInternalException is not explicitly documented anymore. Unfortunately this change itself breaks the API. The intention is that it shall be possible to add new checked subclasses of GitAPIException without breaking the API. Bug: 366914 EGit-Change-Id: I50380f13fc82c22d0036f47c7859cc3a77e767c5 Change-Id: I50380f13fc82c22d0036f47c7859cc3a77e767c5 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Move JGitText to an internal packageRobin Rosenberg2012-03-121-1/+1
| | | | Change-Id: I763590a45d75f00a09097ab6f89581a3bbd3c797
* Use JGitText.refAlreadyExists instead of "ref exists"Tomasz Zarna2011-08-241-1/+1
| | | | Change-Id: I113bcf82c6292db5269271f799d09c80acc40bcd
* Fixed creation of branch from a tagSasa Zivkov2011-07-121-1/+5
| | | | | | | | | | | | | Creation of a branch X from an annotated tag, as the starting point, resulted into .git/refs/heads/X containing the ID of the annotated tag instead of the ID of the tagged commit. This fix peels the tag ref before using it as the starting point for the newly created branch. Bug: 340836 Change-Id: I01c7325770ecb37f5bf8ddb2a22f802466524f24 Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
* CreateBranchCommand: Wrong existence checkMathias Kinzler2011-02-141-1/+3
| | | | | | Bug: 337044 Change-Id: I3bc42fea1f552f10d4729999cab6fb4241b70325 Signed-off-by: Mathias Kinzler <mathias.kinzler@sap.com>
* Fix NPE when calling CreateBranch without explict startpointChristian Halstrick2010-10-121-4/+3
| | | | | | | | | When creating a branch with CreateBranchCommand.call() without specifying an explicit startPoint HEAD should be used as startPoint. There was a bug leading to an NPE in such a case. Change-Id: Ic0a5dc1f33a0987d66c09996c8012c45785500ff Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
* Remove AmbiguousObjectException from BranchCreateCommand.call()Christian Halstrick2010-10-121-6/+1
| | | | | | | | | | | We wanted to wrap all LowLevel JGit excpetions into a JGitInternalException so that users of this high-level interface don't have to explicitly catch all of them. This was forgotten on BranchCreateCommand.call() and I added it. Change-Id: Ie140e99574fb004137c66e80fb92eb6c6d0fa5e1 Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
* Add "Branch" commandMathias Kinzler2010-10-101-0/+365
The need for branching becomes more pressing with pull support: we need to make sure the upstream configuration entries are written correctly when creating and renaming branches (and of course are cleaned up when deleting them). This adds support for listing, adding, deleting and renaming branches including the more common options. Bug: 326938 Change-Id: I00bcc19476e835d6fd78fd188acde64946c1505c Signed-off-by: Mathias Kinzler <mathias.kinzler@sap.com> Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>