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

Re: [PATCH] vcs_info: Use ‘command’ prefix to call version control programs



Hey Daniel,

Daniel Shahaf wrote:
> Frank Terbeck wrote on Wed, Oct 22, 2014 at 11:28:24 +0200:
[...]
>>     I think this is reasonable. I hope, people don't count on
>>     wrapper functions to work to achieve some sort of sinister
>>     hack. :)
>> 
>
> I hate to say this after you already wrote the patch, but:

No worries. Changing those lines took like five minutes. :)

> There are legitimate use-cases for wrapper functions, and your patch
> would break them.  (For example, someone might use a wrapper function
> to dispatch to a different svn binary depending on the working copy they
> are in.)

I was afraid someone might say that. :)

> Alternative solutions include:
>
> - Asking people who write svn() functions that vcs_info cannot use to
>   set the 'command' style to /usr/local/bin/svn, e.g.,
>
>     zstyle ':vcs_info:svn:*' command =svn
>
>   (I assume most svn() wrapper functions out there are compatible with
>   vcs_info.)

That style could also be used to switch to a different binary, depending
on the current working copy. That's kind of what that style was
introduced for.

> - Patching the wrapper function to behave differently when invoked by
>   vcs_info.  The different behaviour could be, for example, adding
>   --non-interactive or dispatching to /usr/local/bin/svn without any
>   wrapping logic.  I'm not sure what the best way to detect "being
>   invoked by vcs_info" would be --- perhaps "[[ ! -t 1 ]]"?

I'd probably check whether $vcs is set. Although, someone else might use
that particular variable output of vcs_info, so I don't know.

> I would also be interested in knowing what the specific problem was in
> the interaction between the OP's wrapper and vcs_info.  (And in the
> value of `svn --version -q`.)

The problem is probably with the wrapper, rather than subversion. But
sure, I would be nice to know.


About resolving this issue, I'm fine either way. I think Daniel has a
point about setting the ‘command’ style, if you're using a wrapper
function that's incompatible with the usual behaviour of a backend's
external program.


Regards, Frank



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