diff options
author | Thomas Wolf <thomas.wolf@paranor.ch> | 2020-12-08 14:52:00 +0100 |
---|---|---|
committer | Matthias Sohn <matthias.sohn@sap.com> | 2020-12-08 22:20:45 +0100 |
commit | 29e1270768f217f7c8471d771d90ff43135d7c26 (patch) | |
tree | 35ab0c407f764de747b6f522d975f0659fc8802d /org.eclipse.jgit/src/org/eclipse/jgit | |
parent | dc8a927ce40c801a0c777cfb477cfad4aab5c1c3 (diff) | |
download | jgit-29e1270768f217f7c8471d771d90ff43135d7c26.tar.gz jgit-29e1270768f217f7c8471d771d90ff43135d7c26.zip |
TagCommand: make -f work with lightweight tags for NO_CHANGE
JGit treated a NO_CHANGE RefUpdate as an error in all cases. But when
updating a lightweight tag, this is a successful result if -f was
specified.
Change-Id: Iddfa6d6a6dc8bf8fed81138a008ebc32d5f960bd
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
Diffstat (limited to 'org.eclipse.jgit/src/org/eclipse/jgit')
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/api/TagCommand.java | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/TagCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/TagCommand.java index c8d4e413fb..0f7fda01b9 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/TagCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/TagCommand.java @@ -175,6 +175,12 @@ public class TagCommand extends GitCommand<Ref> { throw new ConcurrentRefUpdateException( JGitText.get().couldNotLockHEAD, tagRef.getRef(), updateResult); + case NO_CHANGE: + if (forceUpdate) { + return repo.exactRef(refName); + } + throw new RefAlreadyExistsException(MessageFormat + .format(JGitText.get().tagAlreadyExists, newTagToString)); case REJECTED: throw new RefAlreadyExistsException(MessageFormat.format( JGitText.get().tagAlreadyExists, newTagToString)); |