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

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



> 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.

It certainly looks better, but the filenames are still being split on
spaces, so if one touches "blah argh" and "blah", and cvs add's them,
then cvs commit <TAB> will complete "blah" and "argh".

$pat will be something like "blah argh|blah"

Adding the parens makes it do the right thing in this particular case.
What's the correct fix?

Index: _cvs
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_cvs,v
retrieving revision 1.25
diff -u -r1.25 _cvs
--- _cvs	11 May 2005 09:27:10 -0000	1.25
+++ _cvs	22 Jun 2005 01:26:49 -0000
@@ -868,9 +868,12 @@
     : ${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}"} ]] &&
-    _wanted files expl 'modified file' _path_files -g "$pat"
+    [[ -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
   fi



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