Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Bug#315255: zsh: cvs commit completion breaks on spaces



On Jun 21,  1:50pm, Clint Adams wrote:
}
} _cvs_modified_entries() doesn't like filenames with spaces.

That's almost certainly because it's calling "builtin stat" and then
parsing the output with the World's Hairiest Parameter Substitution (TM).

Which is pretty silly given that stat can assign directly to an array
without the need to fork a $(...) substitution.

See if this isn't better.  The substitution isn't that much less hairy,
but it doesn't fork and it doesn't depend on splitting on spaces.

Index: Src/_cvs
===================================================================
RCS file: /extra/cvsroot/zsh/zsh-4.0/Completion/Unix/Command/_cvs,v
retrieving revision 1.17
diff -c -r1.17 _cvs
--- Src/_cvs	28 May 2005 04:32:46 -0000	1.17
+++ Src/_cvs	22 Jun 2005 00:53:00 -0000
@@ -868,8 +868,11 @@
     : ${PREFIX:#(#b)(*/)(*)}
     linedir="$match[1]"
     realdir=${(e)~linedir}
-    [[ -f "$realdir"CVS/Entries ]] &&
-    [[ -n ${pat::="${(@j:|:)${(@)${(@)${(@)${(@)${(@)${(@M)${(@f)"$(<"$realdir"CVS/Entries)"}:#/*}#/}/${slash}[^${slash}]#${slash}//}%/[^/]#/[^/]#}:#${(j:|:)~${${${${(f)"$(LC_ALL=C builtin stat -gn +mtime -F '%a %b %e %T %Y' ${realdir}*(D) 2>/dev/null)"}##*/}/ //}//(#m)[][*?()<|^~#\\]/\\$MATCH}}}%%/*}//(#m)[][*?()<|^~#\\]/\\$MATCH}"} ]] &&
+    [[ -f "$realdir"CVS/Entries ]] && {
+      local -a mtime
+      LC_ALL=C builtin stat -A mtime -gn +mtime -F $'%a %b %e %T %Y\n' ${realdir}*(D) 2>/dev/null
+      [[ -n ${pat::="${(@j:|:)${(@)${(@)${(@)${(@)${(@)${(@M)${(@f)"$(<"$realdir"CVS/Entries)"}:#/*}#/}/${slash}[^${slash}]#${slash}//}%/[^/]#/[^/]#}:#${(j:|:)~${(f)${(j:/:)${mtime##*/}}//(#m)[][*?()<|^~#\\]/\\$MATCH}#/}}%%/*}//(#m)[][*?()<|^~#\\]/\\$MATCH}"} ]]
+    } &&
     _wanted files expl 'modified file' _path_files -g "$pat"
   else
     _cvs_existing_entries



Messages sorted by: Reverse Date, Date, Thread, Author