aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.pgm
diff options
context:
space:
mode:
authorMatthias Sohn <matthias.sohn@sap.com>2022-03-02 21:10:03 +0100
committerMatthias Sohn <matthias.sohn@sap.com>2022-03-02 21:10:03 +0100
commit7a372d1d00644cfa76a3c4a0b3c5e7ab3a7871c2 (patch)
treec14132e05dd80ce3922e116360f3a53f532046a7 /org.eclipse.jgit.pgm
parent8845f2e91b2da2159a326aef576c591fbee7dae7 (diff)
parent6f175ea6c46488d7d301a74ccc87d7472c314c1a (diff)
downloadjgit-7a372d1d00644cfa76a3c4a0b3c5e7ab3a7871c2.tar.gz
jgit-7a372d1d00644cfa76a3c4a0b3c5e7ab3a7871c2.zip
Merge branch 'master' into stable-6.1
* master: Describe: add support for core.abbrev config option Add a typed config getter for integers confined to a range Remove odd prefix of PersonIdent test class PersonIdent: Add ctors that accept Instant in addition to Date Remove ignored potentiallyUnclosedCloseable check Make precedence more explicit [pgm] Add describe --abbrev option Cap describe abbrev option DescribeCommand: Add support for --abbrev=0 Change-Id: I1daa3501a38d57b628800fadb96b6b71eea8cbb3
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/Describe.java6
2 files changed, 7 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 d51daafde3..fda0bf6ff4 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
@@ -229,6 +229,7 @@ unmergedPaths=Unmerged paths:
unsupportedOperation=Unsupported operation: {0}
untrackedFiles=Untracked files:
updating=Updating {0}..{1}
+usage_Abbrev=Instead of using the default number of hexadecimal digits (which will vary according to the number of objects in the repository with a default of 7) of the abbreviated object name, use <n> digits, or as many digits as needed to form a unique object name. An <n> of 0 will suppress long format, only showing the closest tag.
usage_Aggressive=This option will cause gc to more aggressively optimize the repository at the expense of taking much more time
usage_AlwaysFallback=Show uniquely abbreviated commit object as fallback
usage_bareClone=Make a bare Git repository. That is, instead of creating [DIRECTORY] and placing the administrative files in [DIRECTORY]/.git, make the [DIRECTORY] itself the $GIT_DIR.
diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Describe.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Describe.java
index 8aa119a358..116db037d4 100644
--- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Describe.java
+++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Describe.java
@@ -44,6 +44,9 @@ class Describe extends TextBuiltin {
@Option(name = "--match", usage = "usage_Match", metaVar = "metaVar_pattern")
private List<String> patterns = new ArrayList<>();
+ @Option(name = "--abbrev", usage = "usage_Abbrev")
+ private Integer abbrev;
+
/** {@inheritDoc} */
@Override
protected void run() {
@@ -57,6 +60,9 @@ class Describe extends TextBuiltin {
cmd.setTags(useTags);
cmd.setAlways(always);
cmd.setMatch(patterns.toArray(new String[0]));
+ if (abbrev != null) {
+ cmd.setAbbrev(abbrev.intValue());
+ }
String result = null;
try {
result = cmd.call();