Skip to content

Commit 47fc131

Browse files
authored
Merge pull request #683 from MarkEWaite/skip-centos-6-truncation-test
Skip truncation test on ancient git versions
2 parents c72f2b2 + 569d5e2 commit 47fc131

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/test/java/hudson/plugins/git/GitChangeSetTruncateTest.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818

1919
import hudson.EnvVars;
2020
import hudson.model.TaskListener;
21+
import jenkins.plugins.git.CliGitCommand;
22+
import jenkins.plugins.git.GitSampleRepoRule;
2123
import org.jenkinsci.plugins.gitclient.Git;
2224
import org.jenkinsci.plugins.gitclient.GitClient;
2325

@@ -37,6 +39,9 @@ public class GitChangeSetTruncateTest {
3739
@ClassRule
3840
public static TemporaryFolder tempFolder = new TemporaryFolder();
3941

42+
@ClassRule
43+
public static GitSampleRepoRule versionCheckRepo = new GitSampleRepoRule();
44+
4045
private static File repoRoot = null;
4146

4247
private static final Random random = new Random();
@@ -96,9 +101,12 @@ public GitChangeSetTruncateTest(String gitImpl, String commitSummary, String exp
96101

97102
@Parameterized.Parameters(name = "{0} \"{1}\" --->>> \"{2}\"")
98103
public static Collection gitObjects() {
99-
String[] implementations = {"git", "jgit"};
104+
/* If CLI git is older than 1.8.3, don't test CLI git message truncation */
105+
/* CLI git 1.7.1 (CentOS 6) does not support the message truncation command line flags */
106+
String[] bothGitImplementations = {"git", "jgit"};
107+
String[] jgitImplementation = {"jgit"};
100108
List<Object[]> arguments = new ArrayList<>();
101-
for (String implementation : implementations) {
109+
for (String implementation : versionCheckRepo.gitVersionAtLeast(1, 8, 3) ? bothGitImplementations : jgitImplementation) {
102110
for (TestData sample : TEST_DATA) {
103111
/* Expect truncated message from git, full message from JGit */
104112
String expected = implementation.equals("git") ? sample.testDataExpectedSummary : sample.testDataCommitSummary;

0 commit comments

Comments
 (0)