(pattern: string, cwd: string)
| 486 | } |
| 487 | |
| 488 | export async function resolveIncludeLocal (pattern: string, cwd: string) { |
| 489 | const repoFiles = await ParserIncludes.memoLocalRepoFiles(cwd); |
| 490 | |
| 491 | if (!pattern.startsWith("/")) pattern = `/${pattern}`; // Ensure pattern starts with `/` |
| 492 | pattern = `${cwd}${pattern}`; |
| 493 | |
| 494 | // escape all special regex metacharacters |
| 495 | pattern = pattern.replaceAll(/[.*+?^${}()|[\]\\]/g, String.raw`\$&`); |
| 496 | |
| 497 | // `**` matches anything |
| 498 | const anything = ".*?"; |
| 499 | pattern = pattern.replaceAll(String.raw`\*\*`, anything); |
| 500 | |
| 501 | // `*` matches anything except for `/` |
| 502 | const anything_but_not_slash = "([^/])*?"; |
| 503 | pattern = pattern.replaceAll(String.raw`\*`, anything_but_not_slash); |
| 504 | |
| 505 | const re2js = RE2JS.compile(`^${pattern}`); |
| 506 | return repoFiles.filter((f: any) => re2js.matches(f)); |
| 507 | } |
| 508 | |
| 509 | export function getGitRemoteInfo (ctx: GitRemoteInfoContext, ...args: string[]) { |
| 510 | const cmdArgs = ["git", "ls-remote", ...args]; |
no outgoing calls
no test coverage detected