summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.pgm.test
diff options
context:
space:
mode:
authorAndre Bossert <andre.bossert@siemens.com>2020-01-19 20:41:23 +0100
committerSimeon Andreev <simeon.danailov.andreev@gmail.com>2021-12-08 10:43:00 +0100
commit14a59bdc7b37c85591eed07bc60c3f4fdcde2a8a (patch)
treefea19991aa9b034079a8e0acf437aadb750fb076 /org.eclipse.jgit.pgm.test
parentcaea5a26f08c6cf969607a178bc54896120d0940 (diff)
downloadjgit-14a59bdc7b37c85591eed07bc60c3f4fdcde2a8a.tar.gz
jgit-14a59bdc7b37c85591eed07bc60c3f4fdcde2a8a.zip
Add config reader for user-defined difftools
see: http://git-scm.com/docs/git-difftool * add config reader for user-defined difftools * diff.tool * diff.guitool * difftool.prompt * difftool.trustExitCode * difftool.<tool>.path * difftool.<tool>.cmd * add pre-defined difftools * implemented "git difftool --tool-help" to verify config reader and pre-defined difftools Bug: 356832 Change-Id: Idde8fddbef61f3378ee565c6321570b3962d0e1d Signed-off-by: Andre Bossert <andre.bossert@siemens.com> Signed-off-by: Simeon Andreev <simeon.danailov.andreev@gmail.com>
Diffstat (limited to 'org.eclipse.jgit.pgm.test')
-rw-r--r--org.eclipse.jgit.pgm.test/META-INF/MANIFEST.MF1
-rw-r--r--org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/DiffToolTest.java18
2 files changed, 15 insertions, 4 deletions
diff --git a/org.eclipse.jgit.pgm.test/META-INF/MANIFEST.MF b/org.eclipse.jgit.pgm.test/META-INF/MANIFEST.MF
index 3e0a4eaf20..3d6e909adf 100644
--- a/org.eclipse.jgit.pgm.test/META-INF/MANIFEST.MF
+++ b/org.eclipse.jgit.pgm.test/META-INF/MANIFEST.MF
@@ -12,6 +12,7 @@ Import-Package: org.eclipse.jgit.api;version="[6.1.0,6.2.0)",
org.eclipse.jgit.api.errors;version="[6.1.0,6.2.0)",
org.eclipse.jgit.diff;version="[6.1.0,6.2.0)",
org.eclipse.jgit.dircache;version="[6.1.0,6.2.0)",
+ org.eclipse.jgit.internal.diffmergetool;version="6.1.0",
org.eclipse.jgit.internal.storage.file;version="6.1.0",
org.eclipse.jgit.junit;version="[6.1.0,6.2.0)",
org.eclipse.jgit.lib;version="[6.1.0,6.2.0)",
diff --git a/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/DiffToolTest.java b/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/DiffToolTest.java
index 2ce50c7827..e7bf48417d 100644
--- a/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/DiffToolTest.java
+++ b/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/DiffToolTest.java
@@ -12,10 +12,12 @@ package org.eclipse.jgit.pgm;
import static org.junit.Assert.assertEquals;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.List;
import org.eclipse.jgit.api.Git;
import org.eclipse.jgit.diff.DiffEntry;
+import org.eclipse.jgit.internal.diffmergetool.CommandLineDiffTool;
import org.eclipse.jgit.lib.CLIRepositoryTestCase;
import org.eclipse.jgit.pgm.opt.CmdLineParser;
import org.eclipse.jgit.pgm.opt.SubcommandHandler;
@@ -135,16 +137,24 @@ public class DiffToolTest extends CLIRepositoryTestCase {
@Test
public void testToolHelp() throws Exception {
- String[] expectedOutput = {
- "git difftool --tool=<tool> may be set to one of the following:",
+ CommandLineDiffTool[] defaultTools = CommandLineDiffTool.values();
+ List<String> expectedOutput = new ArrayList<>();
+ expectedOutput.add("git difftool --tool=<tool> may be set to one of the following:");
+ for (CommandLineDiffTool defaultTool : defaultTools) {
+ String toolName = defaultTool.name();
+ expectedOutput.add(toolName);
+ }
+ String[] userDefinedToolsHelp = {
"user-defined:",
"The following tools are valid, but not currently available:",
"Some of the tools listed above only work in a windowed",
- "environment. If run in a terminal-only session, they will fail.", };
+ "environment. If run in a terminal-only session, they will fail.",
+ };
+ expectedOutput.addAll(Arrays.asList(userDefinedToolsHelp));
String option = "--tool-help";
assertArrayOfLinesEquals("Incorrect output for option: " + option,
- expectedOutput, runAndCaptureUsingInitRaw("difftool", option));
+ expectedOutput.toArray(new String[0]), runAndCaptureUsingInitRaw("difftool", option));
}
private RevCommit createUnstagedChanges() throws Exception {