@@ -294,6 +294,7 @@ impl GitRepo {
294294 "-r" ,
295295 "--name-only" ,
296296 "--no-commit-id" ,
297+ "-z" ,
297298 & valid_from,
298299 to_commit,
299300 ] ;
@@ -311,13 +312,19 @@ impl GitRepo {
311312 // Add untracked files or unstaged changes, i.e. files that are not in git at
312313 // all
313314 let ls_files_output = self . execute_git_command (
314- & [ "ls-files" , "--others" , "--modified" , "--exclude-standard" ] ,
315+ & [
316+ "ls-files" ,
317+ "--others" ,
318+ "--modified" ,
319+ "--exclude-standard" ,
320+ "-z" ,
321+ ] ,
315322 pathspec,
316323 ) ?;
317324 self . add_files_from_stdout ( & mut files, turbo_root, ls_files_output) ;
318325 // Include any files that have been staged, but not committed
319326 let diff_output =
320- self . execute_git_command ( & [ "diff" , "--name-only" , "--cached" ] , pathspec) ?;
327+ self . execute_git_command ( & [ "diff" , "--name-only" , "--cached" , "-z" ] , pathspec) ?;
321328 self . add_files_from_stdout ( & mut files, turbo_root, diff_output) ;
322329 }
323330
@@ -351,8 +358,11 @@ impl GitRepo {
351358 turbo_root : & AbsoluteSystemPath ,
352359 stdout : Vec < u8 > ,
353360 ) {
354- let stdout = String :: from_utf8 ( stdout) . unwrap ( ) ;
355- for line in stdout. lines ( ) {
361+ let stdout = String :: from_utf8_lossy ( & stdout) ;
362+ for line in stdout. split ( '\0' ) {
363+ if line. is_empty ( ) {
364+ continue ;
365+ }
356366 let path = RelativeUnixPath :: new ( line) . unwrap ( ) ;
357367 let anchored_to_turbo_root_file_path = self
358368 . reanchor_path_from_git_root_to_turbo_root ( turbo_root, path)
0 commit comments