You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Martin von Gagern <Ma...@gmx.net> on 2007/01/16 22:57:52 UTC
slash after dir in bash_completion
Abstract:
bash completion does not append / after dir names; patch attached.
Hi!
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.
Greetings,
Martin von Gagern
Re: [PATCH] Re: slash after dir in bash_completion
Posted by "Hyrum K. Wright" <hy...@mail.utexas.edu>.
Hyrum K. Wright wrote:
> Martin von Gagern wrote:
>> OK, so here we go again. The same patch minus the trunk/ prefix plus the
>> log message, and PATCH in the subject line. Thanks for the hint, Hyrum!
>>
>> For the verbose description of the problem as well as for some
>> discussion of alternatives I'd point readers at my original post:
>> http://subversion.tigris.org/servlets/ReadMsg?listName=dev&msgNo=123044
>> The important thing is in the log message as well, of course.
>
> Has anybody had a chance to look at Martin's patch? If nobody comments in the
> next few days, I'll file it as an issue.
Filed as issue #2714.
-Hyrum
>> ------------------------------------------------------------------------
>>
>> [[[
>> * tools/client-side/bash_completion: Tell besh we are generating filenames
>> so that it puts a slash instead of a space after a directory name.
>> ]]]
>>
>> Index: tools/client-side/bash_completion
>> ===================================================================
>> --- tools/client-side/bash_completion (revision 23051)
>> +++ 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
>
>
Re: [PATCH] Re: slash after dir in bash_completion
Posted by "Hyrum K. Wright" <hy...@mail.utexas.edu>.
Martin von Gagern wrote:
> OK, so here we go again. The same patch minus the trunk/ prefix plus the
> log message, and PATCH in the subject line. Thanks for the hint, Hyrum!
>
> For the verbose description of the problem as well as for some
> discussion of alternatives I'd point readers at my original post:
> http://subversion.tigris.org/servlets/ReadMsg?listName=dev&msgNo=123044
> The important thing is in the log message as well, of course.
Has anybody had a chance to look at Martin's patch? If nobody comments in the
next few days, I'll file it as an issue.
-Hyrum
> ------------------------------------------------------------------------
>
> [[[
> * tools/client-side/bash_completion: Tell besh we are generating filenames
> so that it puts a slash instead of a space after a directory name.
> ]]]
>
> Index: tools/client-side/bash_completion
> ===================================================================
> --- tools/client-side/bash_completion (revision 23051)
> +++ 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
[PATCH] Re: slash after dir in bash_completion
Posted by Martin von Gagern <Ma...@gmx.net>.
Hyrum K. Wright wrote:
> Martin,
> I have not reviewed your patch, however, I do have a suggestion. Your
> patch a much greater probability of being applied if you follow the
> guidelines in HACKING, especially regarding subject lines and log
> messages.
>
> Thanks,
> -Hyrum
OK, so here we go again. The same patch minus the trunk/ prefix plus the
log message, and PATCH in the subject line. Thanks for the hint, Hyrum!
For the verbose description of the problem as well as for some
discussion of alternatives I'd point readers at my original post:
http://subversion.tigris.org/servlets/ReadMsg?listName=dev&msgNo=123044
The important thing is in the log message as well, of course.
Greetings,
Martin
Re: slash after dir in bash_completion
Posted by "Hyrum K. Wright" <hy...@mail.utexas.edu>.
Martin von Gagern wrote:
> Abstract:
> bash completion does not append / after dir names; patch attached.
>
>
> Hi!
>
> 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,
I have not reviewed your patch, however, I do have a suggestion. Your
patch a much greater probability of being applied if you follow the
guidelines in HACKING[1], especially regarding subject lines and log
messages.
[1] http://subversion.tigris.org/hacking.html#patches
Thanks,
-Hyrum
> ------------------------------------------------------------------------
>
> 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
>
>
>