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

Re[2]: svn completion under Cygwin



On Mon, 22 Sep 2008 19:23:57 +0100 Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx> wrote:

PS> On Fri, 19 Sep 2008 12:32:25 +0200
PS> Vadim Zeitlin <vz-zsh@xxxxxxxxxxxx> wrote:
PS> >  Sorry, I couldn't find anything about it at 
PS> > 
PS> > 	http://www.zsh.org/mla/workers/2008/threads.html
PS> > 
PS> > and I also have no idea how to make Cygwin to translate the Windows-style
PS> > filenames to POSIX ones automatically (and to be honest would be rather
PS> > surprised if it were possible). Could you have meant using cygpath to do
PS> > the conversion instead of a simple tr?
PS> 
PS> No, it's internal to the programme.  We already have the following code,
PS> 
PS> /**/
PS> mod_export void
PS> cygwin_premain0 (int argc, char **argv, void *myself)
PS> {
PS>     static struct __cygwin_perfile pf[] =
PS>     {
PS>         {"", O_RDONLY | O_TEXT},
PS>         {NULL, 0}
PS>     };
PS>     cygwin_internal (CW_PERFILE, pf);
PS> }
PS> 
PS> to do something of the kind for some files opened by the shell, but it
PS> apparently doesn't cover everything we might need.  That's all I know on
PS> the subject.

 I'm afraid I'm missing something obvious but does this really have
anything to do with replacing backslashes with slashes? I'd naively expect
the above to help with DOS/Unix EOL conversion and while the official
documentation (http://www.cygwin.com/cygwin-api/func-cygwin-internal.html)
doesn't say anything else than "Stay away unless you know what you're
doing." (good advice but not very useful), it looks like a lot of programs
use it for this.

 But, once again, the problem with svn completion under Cygwin is *not* due
to CR LF trouble but to the fact that the native Win32 svn.exe outputs the
file paths with backslashes and not slashes as the completion code expects.
Let me repost my trivial patch which fixes the completion for me:

--- _subversion.orig    2008-09-15 18:29:24.788071400 +0200
+++ _subversion 2008-09-15 18:29:33.412740200 +0200
@@ -194,7 +194,7 @@
   local pat="${1:-([ADMR~]|?M)}"

   if (( ! $+_cache_svn_status[$dir] )); then
-    _cache_svn_status[$dir]="$(_call_program files svn status -N $dir)"
+    _cache_svn_status[$dir]="$(_call_program files svn status -N $dir) | tr '\\' '/'"
   fi

   (( ${(M)#${(f)_cache_svn_status[$dir]}:#(#s)${~pat}*$REPLY} ))


 As you can see it simply forces the paths to use slashes and I've never
heard about Cygwin doing this automatically. This doesn't mean it can't,
it's full of black magic, but I couldn't find any mention of it.

 Regards, 
VZ

Attachment: pgpkmgMpP7bGM.pgp
Description: PGP signature



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