Exercise List bugged with git for windows
Closed this issue · 0 comments
milamer commented
Running git 2.28.0.windows.1. Tested with cmd, powershell and git bash.
Somehow the --format
option does not remove the '
character.
Original code:
const branches = spawnSync(
`git for-each-ref --format='%(refname:short)'`,
).split('\n')
If this also works on linux/mac, a good fix would be to replace '
with "
:
const branches = spawnSync(
`git for-each-ref --format="%(refname:short)"`,
).split('\n')
If that does not work an alternative would be to remove '
if present:
const branches = spawnSync(`git for-each-ref --format='%(refname:short)'`)
.split('\n')
.map(b => b.replace(/(^')|('$)/g, ''))