File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed
Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -339,8 +339,11 @@ pub(crate) fn apply_diff(
339339 if first_dir != path {
340340 path_tmp = Utf8Path :: new ( & first_dir_tmp) . join ( path. strip_prefix ( & first_dir) ?) ;
341341 // copy to temp dir and remember
342- if !destdir. exists ( & first_dir_tmp) ? {
343- copy_dir ( destdir, first_dir. as_str ( ) , & first_dir_tmp) ?;
342+ // skip copying if dir not existed in dest
343+ if !destdir. exists ( & first_dir_tmp) ? && destdir. exists ( first_dir. as_std_path ( ) ) ? {
344+ copy_dir ( destdir, first_dir. as_str ( ) , & first_dir_tmp) . with_context ( || {
345+ format ! ( "copy {first_dir} to {first_dir_tmp} before removing {pathstr}" )
346+ } ) ?;
344347 updates. insert ( first_dir, first_dir_tmp) ;
345348 }
346349 } else {
@@ -359,7 +362,9 @@ pub(crate) fn apply_diff(
359362 if first_dir != path {
360363 if !destdir. exists ( & first_dir_tmp) ? && destdir. exists ( first_dir. as_std_path ( ) ) ? {
361364 // copy to temp dir if not exists
362- copy_dir ( destdir, first_dir. as_str ( ) , & first_dir_tmp) ?;
365+ copy_dir ( destdir, first_dir. as_str ( ) , & first_dir_tmp) . with_context ( || {
366+ format ! ( "copy {first_dir} to {first_dir_tmp} before updating {pathstr}" )
367+ } ) ?;
363368 }
364369 path_tmp = path_tmp. join ( path. strip_prefix ( & first_dir) ?) ;
365370 // ensure new additions dir exists
You can’t perform that action at this time.
0 commit comments