* Build a regex that matches `git ` while tolerating git's global * options between `git` and the subcommand (e.g. `-c key=val`, `-C path`, * `--git-dir=path`). Common when the model retries with * `git -c commit.gpgsign=false commit` after a signing failure.
(subcmd: string, suffix = '')
| 21 | * `git -c commit.gpgsign=false commit` after a signing failure. |
| 22 | */ |
| 23 | function gitCmdRe(subcmd: string, suffix = ''): RegExp { |
| 24 | return new RegExp( |
| 25 | `\\bgit(?:\\s+-[cC]\\s+\\S+|\\s+--\\S+=\\S+)*\\s+${subcmd}\\b${suffix}`, |
| 26 | ) |
| 27 | } |
| 28 | |
| 29 | const GIT_COMMIT_RE = gitCmdRe('commit') |
| 30 | const GIT_PUSH_RE = gitCmdRe('push') |
no outgoing calls
no test coverage detected