@@ -287,6 +287,13 @@ pub struct Options {
287287 pub progress_bar : bool ,
288288}
289289
290+ /// Enum representing if a file has been skipped.
291+ #[ derive( Clone , Copy , Debug , PartialEq , Eq ) ]
292+ enum PerformedAction {
293+ Copied ,
294+ Skipped ,
295+ }
296+
290297/// Enum representing various debug states of the offload and reflink actions.
291298#[ derive( Debug ) ]
292299#[ allow( dead_code) ] // All of them are used on Linux
@@ -1974,7 +1981,7 @@ fn handle_copy_mode(
19741981 source_in_command_line : bool ,
19751982 source_is_fifo : bool ,
19761983 #[ cfg( unix) ] source_is_stream : bool ,
1977- ) -> CopyResult < ( ) > {
1984+ ) -> CopyResult < PerformedAction > {
19781985 let source_is_symlink = source_metadata. is_symlink ( ) ;
19791986
19801987 match options. copy_mode {
@@ -2043,7 +2050,7 @@ fn handle_copy_mode(
20432050 println ! ( "skipped {}" , dest. quote( ) ) ;
20442051 }
20452052
2046- return Ok ( ( ) ) ;
2053+ return Ok ( PerformedAction :: Skipped ) ;
20472054 }
20482055 update_control:: UpdateMode :: ReplaceNoneFail => {
20492056 return Err ( Error :: Error ( format ! ( "not replacing '{}'" , dest. display( ) ) ) ) ;
@@ -2054,7 +2061,7 @@ fn handle_copy_mode(
20542061 let src_time = source_metadata. modified ( ) ?;
20552062 let dest_time = dest_metadata. modified ( ) ?;
20562063 if src_time <= dest_time {
2057- return Ok ( ( ) ) ;
2064+ return Ok ( PerformedAction :: Skipped ) ;
20582065 } else {
20592066 options. overwrite . verify ( dest, options. debug ) ?;
20602067
@@ -2096,7 +2103,7 @@ fn handle_copy_mode(
20962103 }
20972104 } ;
20982105
2099- Ok ( ( ) )
2106+ Ok ( PerformedAction :: Copied )
21002107}
21012108
21022109/// Calculates the permissions for the destination file in a copy operation.
@@ -2322,7 +2329,7 @@ fn copy_file(
23222329 #[ cfg( not( unix) ) ]
23232330 let source_is_stream = false ;
23242331
2325- handle_copy_mode (
2332+ let performed_action = handle_copy_mode (
23262333 source,
23272334 dest,
23282335 options,
@@ -2335,7 +2342,7 @@ fn copy_file(
23352342 source_is_stream,
23362343 ) ?;
23372344
2338- if options. verbose {
2345+ if options. verbose && performed_action != PerformedAction :: Skipped {
23392346 print_verbose_output ( options. parents , progress_bar, source, dest) ;
23402347 }
23412348
0 commit comments