[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

slash after dir in bash_completion

From: Martin von Gagern <Martin.vGagern_at_gmx.net>
Date: 2007-01-16 23:57:52 CET

bash completion does not append / after dir names; patch attached.


I'm using svn 1.4.2 on Gentoo, including the bash_completion script that
is bundled with the original source tarball.

This exhibits a behaviour that's been annoying me for some time now:
after directory names there is a trailing space, not a slash. So if I
want to diff a file deep in some working tree, I have to repeatedly type
the beginning of the dir name, press tab, backspace, slash, and then go
on to the next directory level.

The solution I found (after studying the bash_completion script as well
as the output from the "completion" bash builtin) is this:
replace "-o default" with "-o filenames" in the calls to "complete".

This causes minor problems when you have a directory that has the same
name as some command. In this case, the complection function will
complete the command name, but bash will add a slash.

The solution to this would probably be to have the trailing slashes and
spaces managed in the completion function as well, i.e. have something
append a / to all generated dir name completions and so on.

This sounds like much work, and I'd think a person relying on command
name completion in a working copy with a directory of the same name
should be a rare coincidence. Therefore I'd say "-o filenames" is good
enough for 95% of all cases whre it makes a difference at all.

So please apply my patch to the current trunk.

 Martin von Gagern

Index: trunk/tools/client-side/bash_completion
--- trunk/tools/client-side/bash_completion (revision 23051)
+++ trunk/tools/client-side/bash_completion (working copy)
@@ -616,7 +616,7 @@
         COMPREPLY=( $( compgen -W "$cmdOpts" -- $cur ) )
         return 0
-complete -F _svn -o default svn
+complete -F _svn -o filenames svn
 _svnadmin ()
@@ -717,4 +717,4 @@
         return 0
-complete -F _svnadmin -o default svnadmin
+complete -F _svnadmin -o filenames svnadmin

To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Wed Jan 17 00:18:07 2007

This is an archived mail posted to the Subversion Dev mailing list.