git-plugin
git-plugin copied to clipboard
Ensure backslashes in windows filename
cmd.exe doesn't work with '/' as path separator.
JENKINS-72044 - Fix filepath on windows
With #1443 the GIT_ASKPASS script was changed. Unfortunately the .bat script contains / instead of \ on Windows. While / generally works as path separator on Windows, it does not work with cmd.exe.
Checklist
- [x] I have read the CONTRIBUTING doc
- [x] I have referenced the Jira issue related to my changes in one or more commit messages
- [x] No Javadoc warnings were introduced with my changes
- [x] No spotbugs warnings were introduced with my changes
- [x] I have interactively tested my changes
Types of changes
What types of changes does your code introduce? Put an x in the boxes that apply. Delete the items in the list that do not apply
- [x] Bug fix (non-breaking change which fixes an issue)
Further comments
This is a small change that fixes a bug introduced in 5.2.0 making the gitUsernamePassword binding unuseable on windows agents.
@jenkinsci/git-plugin-developers any timeline when this will be looked at and merged? Maybe @MarkEWaite ?
I am out of the country currently. Once I return there are several reviews that will precede this one
workaround until this PR is merged
withCredentials([gitUsernamePassword(credentialsId: 'myUsernameTokenCredentialsID', gitToolName: 'git-tool')]) {
// (ugly) workaround for https://issues.jenkins.io/browse/JENKINS-72044
// until this PR is merged https://github.com/jenkinsci/git-plugin/pull/1555
powershell("""
(Get-Content \$Env:GIT_ASKPASS).Replace('/', '\\') | Set-Content \$Env:GIT_ASKPASS
""")
powershell("""
git clone https://my/orga/repo.git
"""
)
}