* Re: Bug#315255: zsh: cvs commit completion breaks on spaces
[not found] <20050621142441.GA32423@larve.net>
@ 2005-06-21 17:50 ` Clint Adams
2005-06-22 0:57 ` Bart Schaefer
0 siblings, 1 reply; 4+ messages in thread
From: Clint Adams @ 2005-06-21 17:50 UTC (permalink / raw)
To: zsh-workers; +Cc: Hugo Haas, Debian Bug Tracking System
_cvs_modified_entries() doesn't like filenames with spaces.
> cvs commit completion doesn't work on file names containing spaces,
> while cvs status completion does.
>
> hugo@jibboom ~/foo% ls
> CVS/ foo bar.eee
>
> When trying to complete cvs status, I get as expected:
>
> hugo@jibboom ~/foo% cvs status <TAB>
> CVS/ foo\ bar.eee
>
> However, for cvs commit:
>
> hugo@jibboom ~/foo% cvs commit <TAB>
> foo bar.eee
>
> If I hit <TAB> again:
>
> hugo@jibboom ~/foo% cvs commit foo
>
> and then:
>
> hugo@jibboom ~/foo% cvs commit bar.eee
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Bug#315255: zsh: cvs commit completion breaks on spaces
2005-06-21 17:50 ` Bug#315255: zsh: cvs commit completion breaks on spaces Clint Adams
@ 2005-06-22 0:57 ` Bart Schaefer
2005-06-22 1:30 ` Clint Adams
0 siblings, 1 reply; 4+ messages in thread
From: Bart Schaefer @ 2005-06-22 0:57 UTC (permalink / raw)
To: Clint Adams, zsh-workers; +Cc: Hugo Haas, Debian Bug Tracking System
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Bug#315255: zsh: cvs commit completion breaks on spaces
2005-06-22 0:57 ` Bart Schaefer
@ 2005-06-22 1:30 ` Clint Adams
2005-06-22 23:57 ` Bart Schaefer
0 siblings, 1 reply; 4+ messages in thread
From: Clint Adams @ 2005-06-22 1:30 UTC (permalink / raw)
To: Bart Schaefer; +Cc: zsh-workers, Hugo Haas, Debian Bug Tracking System
> 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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Bug#315255: zsh: cvs commit completion breaks on spaces
2005-06-22 1:30 ` Clint Adams
@ 2005-06-22 23:57 ` Bart Schaefer
0 siblings, 0 replies; 4+ messages in thread
From: Bart Schaefer @ 2005-06-22 23:57 UTC (permalink / raw)
To: Clint Adams; +Cc: Debian Bug Tracking System, zsh-workers
On Jun 21, 9:30pm, Clint Adams wrote:
} Subject: Re: Bug#315255: zsh: cvs commit completion breaks on spaces
}
} Adding the parens makes it do the right thing in this particular case.
I'm concerned that the parens will be confused for a glob qualifier if
there is only one possible match. If that doesn't happen, then this
would be OK.
} What's the correct fix?
I would have expected _path_files to do the right thing, so maybe the fix
is somewhere there. Or might it be _wanted ...?
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2005-06-22 23:58 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <20050621142441.GA32423@larve.net>
2005-06-21 17:50 ` Bug#315255: zsh: cvs commit completion breaks on spaces Clint Adams
2005-06-22 0:57 ` Bart Schaefer
2005-06-22 1:30 ` Clint Adams
2005-06-22 23:57 ` Bart Schaefer
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).