fix(ci): preserve line breaks in Git blob paths (#12227)

This commit is contained in:
ShuaixinHuang authored and GitHub committed 2026-11-19 06:34:57 -05:00
1 parent 1a89383a79
commit fedf33eb59
2 files changed
+21 -3

No files matched your search

+3 -3
View File
@@ -450,11 +450,11 @@ export const gitRepository = (cwd = process.cwd()) => {
git("ls-tree", "-r", "-z", "--name-only", revision, "--", ...directories)
.split("\0")
.filter(Boolean),
// One batch process reads every requested blob.
// NUL-terminate requests so a line break in a path remains part of its name.
readFiles: (revision, paths) => {
const output = execFileSync("git", ["cat-file", "--batch"], {
const output = execFileSync("git", ["cat-file", "--batch", "-z"], {
cwd,
input: paths.map((path) => `${revision}:${path}\n`).join(""),
input: paths.map((path) => `${revision}:${path}\0`).join(""),
maxBuffer: 512 * 1024 * 1024,
});
const contents = new Map();