* Extract target ref from `git merge ` / `git rebase ` command. * Skips flags and keywords — first non-flag argument is the ref.
( command: string, verb: string, )
| 111 | * Skips flags and keywords — first non-flag argument is the ref. |
| 112 | */ |
| 113 | function parseRefFromCommand( |
| 114 | command: string, |
| 115 | verb: string, |
| 116 | ): string | undefined { |
| 117 | const after = command.split(gitCmdRe(verb))[1] |
| 118 | if (!after) return undefined |
| 119 | for (const t of after.trim().split(/\s+/)) { |
| 120 | if (/^[&|;><]/.test(t)) break |
| 121 | if (t.startsWith('-')) continue |
| 122 | return t |
| 123 | } |
| 124 | return undefined |
| 125 | } |
| 126 | |
| 127 | /** |
| 128 | * Scan bash command + output for git operations worth surfacing in the |
no test coverage detected