-
Bug
-
Resolution: Won't Fix
-
Minor
-
None
-
Git plugin 4.7.2
Description
I got a problem using this plugin with `refspec` not escaping the dollar sign (dollar sign is a valid character for naming git branch). See log below
```
09:49:28 hudson.plugins.git.GitException: Command "git fetch --no-tags --force --progress --depth=1 – git@github.com:lyft/LYFT-REPO.git +refs/heads/use-install-go-from$PATH:refs/remotes/origin/use-install-go-from$PATH" returned status code 128:
09:49:28 stdout:
09:49:28 stderr: fatal: invalid refspec '+refs/heads/use-install-go-from-/usr/local/openjdk-11/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:refs/remotes/origin/use-install-go-from-/usr/local/openjdk-11/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'
```
The command I ran is something along the lines of
```
checkout scm: [
$class: 'GitSCM',
branches: branches,
extensions: [
[$class: 'GitLFSPull'],
clone_option,
[$class: 'RelativeTargetDirectory', relativeTargetDir: 'target']
],
userRemoteConfigs: [[
credentialsId: 'ssh-key',
url: "git@${github_url}:${repo_full_name}.git",
refspec: "${refspec}"
]]
```
What did I try
I tried to escape the value before passing into the call (e.g. `refspec.replace('$', '\$')`), but that didn't help regardless of how many backslashes I used.