aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.pgm.test
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.jgit.pgm.test')
-rw-r--r--org.eclipse.jgit.pgm.test/.classpath2
-rw-r--r--org.eclipse.jgit.pgm.test/.settings/org.eclipse.jdt.core.prefs6
-rw-r--r--org.eclipse.jgit.pgm.test/BUILD1
-rw-r--r--org.eclipse.jgit.pgm.test/META-INF/MANIFEST.MF43
-rw-r--r--org.eclipse.jgit.pgm.test/org.eclipse.jgit.pgm--All-Tests (Java17) (de).launch (renamed from org.eclipse.jgit.pgm.test/org.eclipse.jgit.pgm--All-Tests (Java11) (de).launch)2
-rw-r--r--org.eclipse.jgit.pgm.test/org.eclipse.jgit.pgm--All-Tests (Java17).launch (renamed from org.eclipse.jgit.pgm.test/org.eclipse.jgit.pgm--All-Tests (Java11).launch)2
-rw-r--r--org.eclipse.jgit.pgm.test/pom.xml2
-rw-r--r--org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/AddTest.java55
-rw-r--r--org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/CheckoutTest.java14
-rw-r--r--org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/CloneTest.java8
-rw-r--r--org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/ConfigTest.java5
-rw-r--r--org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/DescribeTest.java20
-rw-r--r--org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/MergeToolTest.java4
-rw-r--r--org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/PackRefsTest.java81
14 files changed, 201 insertions, 44 deletions
diff --git a/org.eclipse.jgit.pgm.test/.classpath b/org.eclipse.jgit.pgm.test/.classpath
index 855f717cac..02bc21c1a7 100644
--- a/org.eclipse.jgit.pgm.test/.classpath
+++ b/org.eclipse.jgit.pgm.test/.classpath
@@ -10,7 +10,7 @@
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11">
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-17">
<attributes>
<attribute name="module" value="true"/>
</attributes>
diff --git a/org.eclipse.jgit.pgm.test/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.jgit.pgm.test/.settings/org.eclipse.jdt.core.prefs
index 69e9221102..362915de03 100644
--- a/org.eclipse.jgit.pgm.test/.settings/org.eclipse.jdt.core.prefs
+++ b/org.eclipse.jgit.pgm.test/.settings/org.eclipse.jdt.core.prefs
@@ -7,9 +7,9 @@ org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nul
org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=11
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=17
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=11
+org.eclipse.jdt.core.compiler.compliance=17
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
@@ -115,7 +115,7 @@ org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=error
org.eclipse.jdt.core.compiler.release=enabled
-org.eclipse.jdt.core.compiler.source=11
+org.eclipse.jdt.core.compiler.source=17
org.eclipse.jdt.core.formatter.align_assignment_statements_on_columns=false
org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines=2147483647
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
diff --git a/org.eclipse.jgit.pgm.test/BUILD b/org.eclipse.jgit.pgm.test/BUILD
index 539d666883..b8ffa69594 100644
--- a/org.eclipse.jgit.pgm.test/BUILD
+++ b/org.eclipse.jgit.pgm.test/BUILD
@@ -15,6 +15,7 @@ junit_tests(
deps = [
":helpers",
"//lib:args4j",
+ "//lib:commons-io",
"//lib:commons-compress",
"//lib:javaewah",
"//lib:junit",
diff --git a/org.eclipse.jgit.pgm.test/META-INF/MANIFEST.MF b/org.eclipse.jgit.pgm.test/META-INF/MANIFEST.MF
index 181e19f951..b2401f39d8 100644
--- a/org.eclipse.jgit.pgm.test/META-INF/MANIFEST.MF
+++ b/org.eclipse.jgit.pgm.test/META-INF/MANIFEST.MF
@@ -3,30 +3,31 @@ Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Automatic-Module-Name: org.eclipse.jgit.pgm.test
Bundle-SymbolicName: org.eclipse.jgit.pgm.test
-Bundle-Version: 6.6.0.qualifier
+Bundle-Version: 7.4.0.qualifier
Bundle-Vendor: %Bundle-Vendor
Bundle-Localization: plugin
Bundle-ActivationPolicy: lazy
-Bundle-RequiredExecutionEnvironment: JavaSE-11
-Import-Package: org.eclipse.jgit.api;version="[6.6.0,6.7.0)",
- org.eclipse.jgit.api.errors;version="[6.6.0,6.7.0)",
- org.eclipse.jgit.diff;version="[6.6.0,6.7.0)",
- org.eclipse.jgit.dircache;version="[6.6.0,6.7.0)",
- org.eclipse.jgit.internal.diffmergetool;version="6.6.0",
- org.eclipse.jgit.internal.storage.file;version="6.6.0",
- org.eclipse.jgit.junit;version="[6.6.0,6.7.0)",
- org.eclipse.jgit.lib;version="[6.6.0,6.7.0)",
- org.eclipse.jgit.lib.internal;version="[6.6.0,6.7.0)",
- org.eclipse.jgit.merge;version="[6.6.0,6.7.0)",
- org.eclipse.jgit.pgm;version="[6.6.0,6.7.0)",
- org.eclipse.jgit.pgm.internal;version="[6.6.0,6.7.0)",
- org.eclipse.jgit.pgm.opt;version="[6.6.0,6.7.0)",
- org.eclipse.jgit.revwalk;version="[6.6.0,6.7.0)",
- org.eclipse.jgit.storage.file;version="[6.6.0,6.7.0)",
- org.eclipse.jgit.transport;version="[6.6.0,6.7.0)",
- org.eclipse.jgit.treewalk;version="[6.6.0,6.7.0)",
- org.eclipse.jgit.util;version="[6.6.0,6.7.0)",
- org.eclipse.jgit.util.io;version="[6.6.0,6.7.0)",
+Bundle-RequiredExecutionEnvironment: JavaSE-17
+Bundle-SCM: url=https://github.com/eclipse-jgit/jgit, connection=scm:git:https://eclipse.gerrithub.io/eclipse-jgit/jgit.git, developerConnection=scm:git:https://eclipse.gerrithub.io/a/eclipse-jgit/jgit.git
+Import-Package: org.eclipse.jgit.api;version="[7.4.0,7.5.0)",
+ org.eclipse.jgit.api.errors;version="[7.4.0,7.5.0)",
+ org.eclipse.jgit.diff;version="[7.4.0,7.5.0)",
+ org.eclipse.jgit.dircache;version="[7.4.0,7.5.0)",
+ org.eclipse.jgit.internal.diffmergetool;version="[7.4.0,7.5.0)",
+ org.eclipse.jgit.internal.storage.file;version="[7.4.0,7.5.0)",
+ org.eclipse.jgit.junit;version="[7.4.0,7.5.0)",
+ org.eclipse.jgit.lib;version="[7.4.0,7.5.0)",
+ org.eclipse.jgit.lib.internal;version="[7.4.0,7.5.0)",
+ org.eclipse.jgit.merge;version="[7.4.0,7.5.0)",
+ org.eclipse.jgit.pgm;version="[7.4.0,7.5.0)",
+ org.eclipse.jgit.pgm.internal;version="[7.4.0,7.5.0)",
+ org.eclipse.jgit.pgm.opt;version="[7.4.0,7.5.0)",
+ org.eclipse.jgit.revwalk;version="[7.4.0,7.5.0)",
+ org.eclipse.jgit.storage.file;version="[7.4.0,7.5.0)",
+ org.eclipse.jgit.transport;version="[7.4.0,7.5.0)",
+ org.eclipse.jgit.treewalk;version="[7.4.0,7.5.0)",
+ org.eclipse.jgit.util;version="[7.4.0,7.5.0)",
+ org.eclipse.jgit.util.io;version="[7.4.0,7.5.0)",
org.hamcrest.core;bundle-version="[1.1.0,3.0.0)",
org.junit;version="[4.13,5.0.0)",
org.junit.rules;version="[4.13,5.0.0)",
diff --git a/org.eclipse.jgit.pgm.test/org.eclipse.jgit.pgm--All-Tests (Java11) (de).launch b/org.eclipse.jgit.pgm.test/org.eclipse.jgit.pgm--All-Tests (Java17) (de).launch
index b860abbf63..c64458cd19 100644
--- a/org.eclipse.jgit.pgm.test/org.eclipse.jgit.pgm--All-Tests (Java11) (de).launch
+++ b/org.eclipse.jgit.pgm.test/org.eclipse.jgit.pgm--All-Tests (Java17) (de).launch
@@ -24,7 +24,7 @@
<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#10;&lt;runtimeClasspathEntry id=&quot;org.eclipse.jdt.launching.classpathentry.defaultClasspath&quot;&gt;&#10;&lt;memento exportedEntriesOnly=&quot;false&quot; project=&quot;org.eclipse.jgit.pgm.test&quot;/&gt;&#10;&lt;/runtimeClasspathEntry&gt;&#10;"/>
</listAttribute>
<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="false"/>
-<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11"/>
+<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-17"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value=""/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.eclipse.jgit.pgm.test"/>
</launchConfiguration>
diff --git a/org.eclipse.jgit.pgm.test/org.eclipse.jgit.pgm--All-Tests (Java11).launch b/org.eclipse.jgit.pgm.test/org.eclipse.jgit.pgm--All-Tests (Java17).launch
index 02a4dab02e..48040cc450 100644
--- a/org.eclipse.jgit.pgm.test/org.eclipse.jgit.pgm--All-Tests (Java11).launch
+++ b/org.eclipse.jgit.pgm.test/org.eclipse.jgit.pgm--All-Tests (Java17).launch
@@ -21,7 +21,7 @@
<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#10;&lt;runtimeClasspathEntry id=&quot;org.eclipse.jdt.launching.classpathentry.defaultClasspath&quot;&gt;&#10;&lt;memento exportedEntriesOnly=&quot;false&quot; project=&quot;org.eclipse.jgit.pgm.test&quot;/&gt;&#10;&lt;/runtimeClasspathEntry&gt;&#10;"/>
</listAttribute>
<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="false"/>
-<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11"/>
+<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-17"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value=""/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.eclipse.jgit.pgm.test"/>
</launchConfiguration>
diff --git a/org.eclipse.jgit.pgm.test/pom.xml b/org.eclipse.jgit.pgm.test/pom.xml
index f035294531..d242156ccb 100644
--- a/org.eclipse.jgit.pgm.test/pom.xml
+++ b/org.eclipse.jgit.pgm.test/pom.xml
@@ -17,7 +17,7 @@
<parent>
<groupId>org.eclipse.jgit</groupId>
<artifactId>org.eclipse.jgit-parent</artifactId>
- <version>6.6.0-SNAPSHOT</version>
+ <version>7.4.0-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.jgit.pgm.test</artifactId>
diff --git a/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/AddTest.java b/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/AddTest.java
index 6d6374f172..a48fcbcd5a 100644
--- a/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/AddTest.java
+++ b/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/AddTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012 Google Inc. and others
+ * Copyright (C) 2012, 2025 Google Inc. and others
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Distribution License v. 1.0 which is available at
@@ -12,7 +12,10 @@ package org.eclipse.jgit.pgm;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.fail;
+import static org.junit.Assert.assertThrows;
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
import org.eclipse.jgit.api.Git;
import org.eclipse.jgit.dircache.DirCache;
@@ -32,12 +35,7 @@ public class AddTest extends CLIRepositoryTestCase {
@Test
public void testAddNothing() throws Exception {
- try {
- execute("git add");
- fail("Must die");
- } catch (Die e) {
- // expected, requires argument
- }
+ assertThrows(Die.class, () -> execute("git add"));
}
@Test
@@ -46,6 +44,17 @@ public class AddTest extends CLIRepositoryTestCase {
}
@Test
+ public void testAddInvalidOptionCombinations() throws Exception {
+ writeTrashFile("greeting", "Hello, world!");
+ assertThrows(Die.class, () -> execute("git add -u -A greeting"));
+ assertThrows(Die.class,
+ () -> execute("git add -u --ignore-removed greeting"));
+ // --renormalize implies -u
+ assertThrows(Die.class,
+ () -> execute("git add --renormalize --all greeting"));
+ }
+
+ @Test
public void testAddAFile() throws Exception {
writeTrashFile("greeting", "Hello, world!");
assertArrayEquals(new String[] { "" }, //
@@ -78,4 +87,34 @@ public class AddTest extends CLIRepositoryTestCase {
assertNotNull(cache.getEntry("greeting"));
assertEquals(1, cache.getEntryCount());
}
+
+ @Test
+ public void testAddDeleted() throws Exception {
+ File greeting = writeTrashFile("greeting", "Hello, world!");
+ git.add().addFilepattern("greeting").call();
+ DirCache cache = db.readDirCache();
+ assertNotNull(cache.getEntry("greeting"));
+ assertEquals(1, cache.getEntryCount());
+ assertTrue(greeting.delete());
+ assertArrayEquals(new String[] { "" }, //
+ execute("git add greeting"));
+
+ cache = db.readDirCache();
+ assertEquals(0, cache.getEntryCount());
+ }
+
+ @Test
+ public void testAddDeleted2() throws Exception {
+ File greeting = writeTrashFile("greeting", "Hello, world!");
+ git.add().addFilepattern("greeting").call();
+ DirCache cache = db.readDirCache();
+ assertNotNull(cache.getEntry("greeting"));
+ assertEquals(1, cache.getEntryCount());
+ assertTrue(greeting.delete());
+ assertArrayEquals(new String[] { "" }, //
+ execute("git add -A"));
+
+ cache = db.readDirCache();
+ assertEquals(0, cache.getEntryCount());
+ }
}
diff --git a/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/CheckoutTest.java b/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/CheckoutTest.java
index 999bf434ce..d533829d52 100644
--- a/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/CheckoutTest.java
+++ b/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/CheckoutTest.java
@@ -96,6 +96,20 @@ public class CheckoutTest extends CLIRepositoryTestCase {
}
@Test
+ public void testCheckoutWithNoRef() throws Exception {
+ assertStringArrayEquals(
+ "a valid ref is expected",
+ executeExpectingException("git checkout"));
+ }
+
+ @Test
+ public void testCheckoutWithInvalidRef() throws Exception {
+ assertStringArrayEquals(
+ ".feature is not a valid ref name",
+ executeExpectingException("git checkout .feature"));
+ }
+
+ @Test
public void testCheckoutNewBranchThatAlreadyExists() throws Exception {
try (Git git = new Git(db)) {
git.commit().setMessage("initial commit").call();
diff --git a/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/CloneTest.java b/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/CloneTest.java
index cbb5bbb9cc..c56cc6bf3c 100644
--- a/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/CloneTest.java
+++ b/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/CloneTest.java
@@ -126,7 +126,7 @@ public class CloneTest extends CLIRepositoryTestCase {
JGitTestUtil.writeTrashFile(db, "Test.txt", "Some change");
git.add().addFilepattern("Test.txt").call();
return git.commit()
- .setCommitter(new PersonIdent(this.committer, tr.getDate()))
+ .setCommitter(new PersonIdent(this.committer, tr.getInstant()))
.setMessage("Second commit").call();
}
@@ -134,7 +134,7 @@ public class CloneTest extends CLIRepositoryTestCase {
JGitTestUtil.writeTrashFile(db, "change.txt", "another change");
git.add().addFilepattern("change.txt").call();
return git.commit()
- .setCommitter(new PersonIdent(this.committer, tr.getDate()))
+ .setCommitter(new PersonIdent(this.committer, tr.getInstant()))
.setMessage("Third commit").call();
}
@@ -183,7 +183,7 @@ public class CloneTest extends CLIRepositoryTestCase {
File gitDir = db.getDirectory();
String sourcePath = gitDir.getAbsolutePath();
- String targetPath = (new File(sourcePath)).getParentFile()
+ String targetPath = new File(sourcePath).getParentFile()
.getParentFile().getAbsolutePath()
+ File.separator + "target.git";
String cmd = "git clone --bare " + shellQuote(sourcePath) + " "
@@ -207,7 +207,7 @@ public class CloneTest extends CLIRepositoryTestCase {
File gitDir = db.getDirectory();
String sourcePath = gitDir.getAbsolutePath();
- String targetPath = (new File(sourcePath)).getParentFile()
+ String targetPath = new File(sourcePath).getParentFile()
.getParentFile().getAbsolutePath() + File.separator
+ "target.git";
String cmd = "git clone --mirror " + shellQuote(sourcePath) + " "
diff --git a/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/ConfigTest.java b/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/ConfigTest.java
index 005215f443..0af310c497 100644
--- a/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/ConfigTest.java
+++ b/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/ConfigTest.java
@@ -45,10 +45,9 @@ public class ConfigTest extends CLIRepositoryTestCase {
Map<String, String> options = parseOptions(output);
assertEquals(!isWindows, Boolean.valueOf(options.get("core.filemode")));
- assertTrue((Boolean.valueOf(options.get("core.logallrefupdates"))));
+ assertTrue(Boolean.valueOf(options.get("core.logallrefupdates")));
if (isMac) {
- assertTrue(
- (Boolean.valueOf(options.get("core.precomposeunicode"))));
+ assertTrue(Boolean.valueOf(options.get("core.precomposeunicode")));
}
assertEquals(Integer.valueOf(0),
Integer.valueOf(options.get("core.repositoryformatversion")));
diff --git a/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/DescribeTest.java b/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/DescribeTest.java
index c78544309b..595767d3a0 100644
--- a/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/DescribeTest.java
+++ b/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/DescribeTest.java
@@ -123,6 +123,15 @@ public class DescribeTest extends CLIRepositoryTestCase {
}
@Test
+ public void testDescribeExclude() throws Exception {
+ initialCommitAndTag();
+ secondCommit();
+ git.tag().setName("v2.0").call();
+ assertArrayEquals(new String[] { "v1.0-1-g56f6ceb", "" },
+ execute("git describe --exclude v2.*"));
+ }
+
+ @Test
public void testDescribeCommitMultiMatch() throws Exception {
initialCommitAndTag();
secondCommit();
@@ -133,6 +142,17 @@ public class DescribeTest extends CLIRepositoryTestCase {
}
@Test
+ public void testDescribeCommitMultiExclude() throws Exception {
+ initialCommitAndTag();
+ secondCommit();
+ git.tag().setName("v2.0.0").call();
+ git.tag().setName("v2.1.1").call();
+ git.tag().setName("v2.2").call();
+ assertArrayEquals("git yields v2.2", new String[] { "v2.2", "" },
+ execute("git describe --exclude v2.0* --exclude v2.1.*"));
+ }
+
+ @Test
public void testDescribeCommitNoMatch() throws Exception {
initialCommitAndTag();
writeTrashFile("greeting", "Hello, world!");
diff --git a/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/MergeToolTest.java b/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/MergeToolTest.java
index 54c4f26099..6339831a40 100644
--- a/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/MergeToolTest.java
+++ b/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/MergeToolTest.java
@@ -27,6 +27,7 @@ import org.eclipse.jgit.internal.diffmergetool.ExternalMergeTool;
import org.eclipse.jgit.internal.diffmergetool.MergeTools;
import org.eclipse.jgit.lib.StoredConfig;
import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Test;
/**
@@ -77,6 +78,7 @@ public class MergeToolTest extends ToolTestCase {
+ errorReturnCode);
}
+ @Ignore
@Test
public void testEmptyToolName() throws Exception {
assumeLinuxPlatform();
@@ -91,7 +93,7 @@ public class MergeToolTest extends ToolTestCase {
createMergeConflict();
- String araxisErrorLine = "compare: unrecognized option `-wait' @ error/compare.c/CompareImageCommand/1123.";
+ String araxisErrorLine = "compare-im6.q16: unrecognized option `-wait' @ error/compare.c/CompareImageCommand/1131.";
String[] expectedErrorOutput = { araxisErrorLine, araxisErrorLine, };
runAndCaptureUsingInitRaw(Arrays.asList(expectedErrorOutput),
MERGE_TOOL, "--no-prompt");
diff --git a/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/PackRefsTest.java b/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/PackRefsTest.java
new file mode 100644
index 0000000000..b4d4ea9e56
--- /dev/null
+++ b/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/PackRefsTest.java
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 2024 Qualcomm Innovation Center, Inc.
+ * and other copyright owners as documented in the project's IP log.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Distribution License v. 1.0 which is available at
+ * https://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+package org.eclipse.jgit.pgm;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+
+import org.eclipse.jgit.api.Git;
+import org.eclipse.jgit.internal.storage.file.FileRepository;
+import org.eclipse.jgit.lib.CLIRepositoryTestCase;
+import org.eclipse.jgit.lib.ConfigConstants;
+import org.eclipse.jgit.lib.Constants;
+import org.eclipse.jgit.lib.Ref;
+import org.junit.Before;
+import org.junit.Test;
+
+public class PackRefsTest extends CLIRepositoryTestCase {
+ private Git git;
+
+ @Override
+ @Before
+ public void setUp() throws Exception {
+ super.setUp();
+ git = new Git(db);
+ git.commit().setMessage("initial commit").call();
+ }
+
+ @Test
+ public void tagPacked() throws Exception {
+ git.tag().setName("test").call();
+ git.packRefs().call();
+ assertEquals(Ref.Storage.PACKED,
+ git.getRepository().exactRef("refs/tags/test").getStorage());
+ }
+
+ @Test
+ public void nonTagRefNotPackedWithoutAll() throws Exception {
+ git.branchCreate().setName("test").call();
+ git.packRefs().call();
+ assertEquals(Ref.Storage.LOOSE,
+ git.getRepository().exactRef("refs/heads/test").getStorage());
+ }
+
+ @Test
+ public void nonTagRefPackedWithAll() throws Exception {
+ git.branchCreate().setName("test").call();
+ git.packRefs().setAll(true).call();
+ assertEquals(Ref.Storage.PACKED,
+ git.getRepository().exactRef("refs/heads/test").getStorage());
+ }
+
+ @Test
+ public void refTableCompacted() throws Exception {
+ ((FileRepository) git.getRepository()).convertRefStorage(
+ ConfigConstants.CONFIG_REF_STORAGE_REFTABLE, false, false);
+
+ git.commit().setMessage("test commit").call();
+ File tableDir = new File(db.getDirectory(), Constants.REFTABLE);
+ File[] reftables = tableDir.listFiles();
+ assertNotNull(reftables);
+ assertTrue(reftables.length > 2);
+
+ git.packRefs().call();
+
+ reftables = tableDir.listFiles();
+ assertNotNull(reftables);
+ assertEquals(2, reftables.length);
+ }
+}