about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog3
-rw-r--r--Functions/Misc/zmv9
2 files changed, 5 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index 37daf3cdd..4615da3da 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2007-05-14  Peter Stephenson  <pws@csr.com>
 
+	* users/11484: Functions/Misc/zmv: allow renaming $f to $g
+	to work if the files are really the same.
+
 	* 23438 (slightly improved to use _call_program):
 	Completion/Unix/Type/_printers: improve finding of network
 	printers.
diff --git a/Functions/Misc/zmv b/Functions/Misc/zmv
index 553579232..e85b0b5ae 100644
--- a/Functions/Misc/zmv
+++ b/Functions/Misc/zmv
@@ -262,13 +262,8 @@ for f in $files; do
     continue
   elif [[ -n $from[$g] && ! -d $g ]]; then
     errs=($errs "$f and $from[$g] both map to $g")
-  elif [[ -f $g && -z $opt_f ]]; then
-    if [[ $f != $g && $f -ef $g ]]; then
-      errs=($errs "file exists: $g
-(Probably the same file, owing to file system limitations.)")
-    else
-      errs=($errs "file exists: $g")
-    fi
+  elif [[ -f $g && -z $opt_f && ! ($f -ef $g && $action = mv) ]]; then
+    errs=($errs "file exists: $g")
   fi
   from[$g]=$f
   to[$f]=$g