diff options
author | alerthak <a2terminator@mail.ru> | 2022-11-19 05:56:02 +0300 |
---|---|---|
committer | Matthias Sohn <matthias.sohn@sap.com> | 2022-11-23 16:12:54 +0100 |
commit | c14e6f5c6cd7634c9ebcd9c4858f9653e199c875 (patch) | |
tree | ace1fcdfaa7755ca2ac654e1c2cc4e6a81875d5d /org.eclipse.jgit | |
parent | 3d522c6900f73f2d6d9741d987e2db2c68387a35 (diff) | |
download | jgit-c14e6f5c6cd7634c9ebcd9c4858f9653e199c875.tar.gz jgit-c14e6f5c6cd7634c9ebcd9c4858f9653e199c875.zip |
[pgm] Add options --name-only, --name-status to diff, log, show
Change-Id: Ib218bd2ccbd7990feca4c35d8c8dc34d4a8291e6
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/api/DiffCommand.java | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/DiffCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/DiffCommand.java index a925a08e33..040b29d8e3 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/DiffCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/DiffCommand.java @@ -51,6 +51,8 @@ public class DiffCommand extends GitCommand<List<DiffEntry>> { private boolean showNameAndStatusOnly; + private boolean showNameOnly; + private OutputStream out; private int contextLines = -1; @@ -72,7 +74,7 @@ public class DiffCommand extends GitCommand<List<DiffEntry>> { } private DiffFormatter getDiffFormatter() { - return out != null && !showNameAndStatusOnly + return out != null && !showNameAndStatusOnly && !showNameOnly ? new DiffFormatter(new BufferedOutputStream(out)) : new DiffFormatter(NullOutputStream.INSTANCE); } @@ -114,7 +116,7 @@ public class DiffCommand extends GitCommand<List<DiffEntry>> { diffFmt.setPathFilter(pathFilter); List<DiffEntry> result = diffFmt.scan(oldTree, newTree); - if (showNameAndStatusOnly) { + if (showNameAndStatusOnly || showNameOnly) { return result; } if (contextLines >= 0) { @@ -195,6 +197,19 @@ public class DiffCommand extends GitCommand<List<DiffEntry>> { } /** + * Set whether to return only names of changed files + * + * @param showNameOnly + * whether to return only names files + * @return this instance + * @since 6.4 + */ + public DiffCommand setShowNameOnly(boolean showNameOnly) { + this.showNameOnly = showNameOnly; + return this; + } + + /** * Set output stream * * @param out |