fix(local): shell-quote git args in the auto-patch push and trial-build gate
The autonomous --open-pr run failed at `git commit` with
`sh: syntax error: unexpected "("`: R's system2() with captured output runs the
command through /bin/sh, and the commit message `feat(patches): ...` (and the
`^{commit}` / `ref:path` git refs in the trial-build gate) contain shell
metacharacters that were passed unquoted.
shQuote() every git argument in propose-patches.R's git() helper and in
trial-build-registry.R's base-ref reads. Reproduced the failure and verified the
fix against a real git repo (commit with "()" in the message now succeeds; a
`HEAD^{commit}` rev-parse resolves).
This commit is contained in:
parent
ed1485c542
commit
0ee4aa7670
1 changed files with 13 additions and 4 deletions
|
|
@ -435,7 +435,9 @@ if (do_write) {
|
|||
save_ledger(merge_ledger(load_ledger(), new_ledger_records))
|
||||
|
||||
git <- function(...) {
|
||||
st <- system2("git", c(...), stdout = TRUE, stderr = TRUE)
|
||||
# system2() with captured output runs via /bin/sh, so shell-quote every arg
|
||||
# (commit messages contain "()", refs contain "^{}", etc.).
|
||||
st <- system2("git", shQuote(c(...)), stdout = TRUE, stderr = TRUE)
|
||||
if (!identical(attr(st, "status"), NULL)) {
|
||||
stop(sprintf(
|
||||
"git %s failed:\n%s",
|
||||
|
|
|
|||
Loading…
Reference in a new issue