summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.pgm
diff options
context:
space:
mode:
authorMatthias Sohn <matthias.sohn@sap.com>2023-04-09 22:49:58 +0200
committerMatthias Sohn <matthias.sohn@sap.com>2023-04-12 13:56:55 +0200
commit0e9708803f8f78efbe53b9b19bd568d50b412b50 (patch)
tree24ba8af5b658e6a596619f4245e5014389254848 /org.eclipse.jgit.pgm
parent060dcf1ccab6c43e4d5cc19524fafa3e82e351e0 (diff)
downloadjgit-0e9708803f8f78efbe53b9b19bd568d50b412b50.tar.gz
jgit-0e9708803f8f78efbe53b9b19bd568d50b412b50.zip
[pgm] Implement git tag --contains option
Change-Id: I390bcd2c2c563d4b27e1369f09548be59ba7c111
Diffstat (limited to 'org.eclipse.jgit.pgm')
-rw-r--r--org.eclipse.jgit.pgm/resources/org/eclipse/jgit/pgm/internal/CLIText.properties1
-rw-r--r--org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Tag.java9
2 files changed, 10 insertions, 0 deletions
diff --git a/org.eclipse.jgit.pgm/resources/org/eclipse/jgit/pgm/internal/CLIText.properties b/org.eclipse.jgit.pgm/resources/org/eclipse/jgit/pgm/internal/CLIText.properties
index 98d711d0ff..7b81af59bc 100644
--- a/org.eclipse.jgit.pgm/resources/org/eclipse/jgit/pgm/internal/CLIText.properties
+++ b/org.eclipse.jgit.pgm/resources/org/eclipse/jgit/pgm/internal/CLIText.properties
@@ -469,6 +469,7 @@ usage_trustExitCode=git-difftool invokes a diff tool individually on each file.
usage_noTrustExitCode=This option can be used to override --trust-exit-code setting.
usage_notags=do not fetch tags
usage_tagAnnotated=create an annotated tag, unsigned unless -s or -u are given, or config tag.gpgSign is true
+usage_tagContains=Only list tags which contain the specified commit
usage_tagDelete=delete tag
usage_tagLocalUser=create a signed annotated tag using the specified GPG key ID
usage_tagMessage=create an annotated tag with the given message, unsigned unless -s or -u are given, or config tag.gpgSign is true, or tar.forceSignAnnotated is true and -a is not given
diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Tag.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Tag.java
index e2cd31d198..0603de18ac 100644
--- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Tag.java
+++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Tag.java
@@ -33,6 +33,7 @@ import org.eclipse.jgit.lib.Ref;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.pgm.internal.CLIText;
import org.eclipse.jgit.pgm.internal.VerificationUtils;
+import org.eclipse.jgit.revwalk.RevCommit;
import org.eclipse.jgit.revwalk.RevTag;
import org.eclipse.jgit.revwalk.RevWalk;
import org.kohsuke.args4j.Argument;
@@ -76,6 +77,11 @@ class Tag extends TextBuiltin {
"--local-user" }, usage = "usage_tagVerify")
private boolean verify;
+ @Option(name = "--contains", forbids = { "--delete", "--force",
+ "--annotate", "-m", "--sign", "--no-sign",
+ "--local-user" }, metaVar = "metaVar_commitish", usage = "usage_tagContains")
+ private RevCommit contains;
+
@Argument(index = 0, metaVar = "metaVar_name")
private String tagName;
@@ -142,6 +148,9 @@ class Tag extends TextBuiltin {
}
} else {
ListTagCommand command = git.tagList();
+ if (contains != null) {
+ command.setContains(contains);
+ }
List<Ref> list = command.call();
for (Ref ref : list) {
outw.println(Repository.shortenRefName(ref.getName()));