Skip to content

Commit

Permalink
Merge pull request #1324 from MarkEWaite/fix-tests-on-older-git-versions
Browse files Browse the repository at this point in the history
Fix tests on older CLI git versions
  • Loading branch information
MarkEWaite authored Sep 3, 2022
2 parents 3c11517 + 234187b commit ede7d48
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/test/java/jenkins/plugins/git/GitSampleRepoRule.java
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,12 @@ public void init() throws Exception {
run(true, tmp.getRoot(), "git", "version");
checkGlobalConfig();
git("init", "--template="); // initialize without copying the installation defaults to ensure a vanilla repo that behaves the same everywhere
git("branch", "-m", "master");
if (gitVersionAtLeast(2, 30)) {
// Force branch name to master even if system default is not master
// Fails on git 2.25, 2.20, 2.17, and 1.8
// Works on git 2.30 and later
git("branch", "-m", "master");
}
write("file", "");
git("add", "file");
git("config", "user.name", "Git SampleRepoRule");
Expand Down

0 comments on commit ede7d48

Please sign in to comment.