MCPcopy Create free account
hub / github.com/FastLED/FastLED / _parse_porcelain_paths

Function _parse_porcelain_paths

ci/hooks/check-on-stop.py:116–137  ·  view source on GitHub ↗

Extract file paths from `git status --porcelain` output. Handles rename entries ("R old -> new") by returning the new path, and strips the leading 3-character status field.

(porcelain: str)

Source from the content-addressed store, hash-verified

114
115
116def _parse_porcelain_paths(porcelain: str) -> list[str]:
117 """Extract file paths from `git status --porcelain` output.
118
119 Handles rename entries ("R old -> new") by returning the new path, and
120 strips the leading 3-character status field.
121 """
122 paths: list[str] = []
123 for line in porcelain.splitlines():
124 if len(line) < 4:
125 continue
126 # Format: XY <path> (or "R old -> new" for renames)
127 rest = line[3:]
128 if " -> " in rest:
129 rest = rest.split(" -> ", 1)[1]
130 # Strip optional surrounding quotes that git uses for paths with
131 # special characters
132 rest = rest.strip()
133 if rest.startswith('"') and rest.endswith('"'):
134 rest = rest[1:-1]
135 if rest:
136 paths.append(rest)
137 return paths
138
139
140def classify_changes(porcelain: str) -> ChangeBuckets:

Callers 1

classify_changesFunction · 0.85

Calls 1

appendMethod · 0.45

Tested by

no test coverage detected