From aec046cd74656bbba6da078cd4d5d45290e572a7 Mon Sep 17 00:00:00 2001 From: hahnlee Date: Sat, 13 Sep 2025 14:19:44 +0900 Subject: [PATCH 1/2] fix: Add -z option to git commands to handle Unicode file paths --- crates/turborepo-scm/src/git.rs | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/crates/turborepo-scm/src/git.rs b/crates/turborepo-scm/src/git.rs index 71337f1506a46..4c9dd933709d0 100644 --- a/crates/turborepo-scm/src/git.rs +++ b/crates/turborepo-scm/src/git.rs @@ -294,6 +294,7 @@ impl GitRepo { "-r", "--name-only", "--no-commit-id", + "-z", &valid_from, to_commit, ]; @@ -311,13 +312,19 @@ impl GitRepo { // Add untracked files or unstaged changes, i.e. files that are not in git at // all let ls_files_output = self.execute_git_command( - &["ls-files", "--others", "--modified", "--exclude-standard"], + &[ + "ls-files", + "--others", + "--modified", + "--exclude-standard", + "-z", + ], pathspec, )?; self.add_files_from_stdout(&mut files, turbo_root, ls_files_output); // Include any files that have been staged, but not committed let diff_output = - self.execute_git_command(&["diff", "--name-only", "--cached"], pathspec)?; + self.execute_git_command(&["diff", "--name-only", "--cached", "-z"], pathspec)?; self.add_files_from_stdout(&mut files, turbo_root, diff_output); } @@ -351,8 +358,8 @@ impl GitRepo { turbo_root: &AbsoluteSystemPath, stdout: Vec, ) { - let stdout = String::from_utf8(stdout).unwrap(); - for line in stdout.lines() { + let stdout = String::from_utf8_lossy(&stdout); + for line in stdout.split('\0') { let path = RelativeUnixPath::new(line).unwrap(); let anchored_to_turbo_root_file_path = self .reanchor_path_from_git_root_to_turbo_root(turbo_root, path) From 0d1246de0bd593151f2f6139eea1b13743e5b1e3 Mon Sep 17 00:00:00 2001 From: hahnlee Date: Sat, 13 Sep 2025 15:05:53 +0900 Subject: [PATCH 2/2] fix: empty string --- crates/turborepo-scm/src/git.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/crates/turborepo-scm/src/git.rs b/crates/turborepo-scm/src/git.rs index 4c9dd933709d0..2a9d79a612b5e 100644 --- a/crates/turborepo-scm/src/git.rs +++ b/crates/turborepo-scm/src/git.rs @@ -360,6 +360,9 @@ impl GitRepo { ) { let stdout = String::from_utf8_lossy(&stdout); for line in stdout.split('\0') { + if line.is_empty() { + continue; + } let path = RelativeUnixPath::new(line).unwrap(); let anchored_to_turbo_root_file_path = self .reanchor_path_from_git_root_to_turbo_root(turbo_root, path)