From 65bb2765646df18488b266e6c1851593d3f9c966 Mon Sep 17 00:00:00 2001 From: =?utf8?q?P=C3=A1draig=20Brady?= Date: Fri, 24 Feb 2023 15:15:20 +0000 Subject: [PATCH] cp,install,mv: --debug: output debug info when reflinking * src/copy.c (copy_reg): Always check whether to output debug info. (emit_debug): Restrict output with `cp --attributes-only`. --- src/copy.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/copy.c b/src/copy.c index ca43faac25..39197872c9 100644 --- a/src/copy.c +++ b/src/copy.c @@ -187,7 +187,7 @@ copy_debug_sparse_string (enum copy_debug_val debug_val) static void emit_debug (const struct cp_options *x) { - if (! x->hard_link && ! x->symbolic_link) + if (! x->hard_link && ! x->symbolic_link && x->data_copy_required) printf ("copy offload: %s, reflink: %s, sparse detection: %s\n", copy_debug_string (copy_debug.offload), copy_debug_string (copy_debug.reflink), @@ -1608,10 +1608,6 @@ copy_reg (char const *src_name, char const *dst_name, return_val = false; goto close_src_and_dst_desc; } - - /* Output debug info for data copying operations. */ - if (x->debug) - emit_debug (x); } if (x->preserve_timestamps) @@ -1707,6 +1703,10 @@ close_src_desc: return_val = false; } + /* Output debug info for data copying operations. */ + if (x->debug) + emit_debug (x); + alignfree (buf); return return_val; } -- 2.47.2