Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix tests on older CLI git versions #1324

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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