* Strip message declaration from git arguments
(rawGitArgs)
| 9 | * Strip message declaration from git arguments |
| 10 | */ |
| 11 | function parse (rawGitArgs) { |
| 12 | let result = []; |
| 13 | let skipNext = false; |
| 14 | |
| 15 | for (const arg of rawGitArgs) { |
| 16 | let match; |
| 17 | |
| 18 | if (skipNext) { |
| 19 | skipNext = false; |
| 20 | continue; |
| 21 | } |
| 22 | |
| 23 | match = reShortMessage.exec(arg); |
| 24 | |
| 25 | if (match) { |
| 26 | if (match[1]) { |
| 27 | result.push(`-${match[1]}`); |
| 28 | } |
| 29 | |
| 30 | if (!match[2]) { |
| 31 | skipNext = true; |
| 32 | } |
| 33 | |
| 34 | continue; |
| 35 | } |
| 36 | |
| 37 | match = reLongMessage.exec(arg); |
| 38 | |
| 39 | if (match) { |
| 40 | if (!match[1]) { |
| 41 | skipNext = true; |
| 42 | } |
| 43 | |
| 44 | continue; |
| 45 | } |
| 46 | |
| 47 | result.push(arg); |
| 48 | } |
| 49 | |
| 50 | return result; |
| 51 | } |
no outgoing calls
no test coverage detected