mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-23 09:01:16 +00:00
fix(shared): classify trailing-space ignore rules
This commit is contained in:
@@ -134,7 +134,7 @@ describe("DefaultPackageManager", () => {
|
||||
await writeFile(insideSkill, "# Inside\n", "utf-8");
|
||||
await writeFile(ignoredSkill, "# Ignored\n", "utf-8");
|
||||
await writeFile(escapedSkill, "# Ignored\n", "utf-8");
|
||||
await writeFile(join(agentsSkillsRoot, "group", ".gitignore"), "ignored/\n\\!literal/\n");
|
||||
await writeFile(join(agentsSkillsRoot, "group", ".gitignore"), "ignored/ \n\\!literal/\n");
|
||||
await writeFile(join(outsideRoot, "SKILL.md"), "# Outside\n", "utf-8");
|
||||
|
||||
try {
|
||||
|
||||
@@ -36,7 +36,8 @@ function prefixIgnorePattern(line: string, prefix: string): string {
|
||||
const pattern = negated ? line.slice(1) : line;
|
||||
const anchored = pattern.startsWith("/");
|
||||
const normalized = anchored ? pattern.slice(1) : pattern;
|
||||
const depthGlob = prefix && !anchored && !normalized.slice(0, -1).includes("/") ? "**/" : "";
|
||||
const matchPattern = normalized.replace(/ +$/, "");
|
||||
const depthGlob = prefix && !anchored && !matchPattern.slice(0, -1).includes("/") ? "**/" : "";
|
||||
const prefixed = `${prefix}${depthGlob}${normalized}`;
|
||||
return negated ? `!${prefixed}` : prefixed;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user