zsh-workers
 help / color / mirror / code / Atom feed
* [BUG] vcs_info_msg_[01]_ is not set correctly in a hg repository which is in a subdirectory of a git repository
@ 2015-05-30  9:20 Hong Xu
  2015-05-30 11:13 ` Frank Terbeck
  0 siblings, 1 reply; 2+ messages in thread
From: Hong Xu @ 2015-05-30  9:20 UTC (permalink / raw)
  To: zsh-workers

[-- Attachment #1: Type: text/plain, Size: 931 bytes --]


If we have a directory tree like the following:

- .git
|
 -- .hg

vcs_info_msg_[01]_ are not set correctly. The hg repository is ignored
and only the git repository is recognized. I have enabled both git and
hg for vcs_info.

It seems that in vcs_info, the detection of each VCS is called:

    (( found = 0 ))
    for vcs in ${enabled} ; do
        [[ -n ${(M)disabled:#${vcs}} ]] && continue
        if (( ${+functions[VCS_INFO_detect_${vcs}]} == 0 )) ; then
            printf 'vcs_info: configured unknown backend: '\''%s'\''\n' ${vcs}
            printf 'vcs_info: use '\''vcs_info_printsys'\'' to find supported systems.\n'
            continue
        fi
        vcs_comm=()
        VCS_INFO_get_cmd
        VCS_INFO_detect_${vcs} && (( found = 1 )) && break
    done

Instead, to get the correct result, one should detect current directory
for all VCS, then one level up and detect all VCS again, until '/' is
met.

Hong

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 818 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [BUG] vcs_info_msg_[01]_ is not set correctly in a hg repository which is in a subdirectory of a git repository
  2015-05-30  9:20 [BUG] vcs_info_msg_[01]_ is not set correctly in a hg repository which is in a subdirectory of a git repository Hong Xu
@ 2015-05-30 11:13 ` Frank Terbeck
  0 siblings, 0 replies; 2+ messages in thread
From: Frank Terbeck @ 2015-05-30 11:13 UTC (permalink / raw)
  To: Hong Xu; +Cc: zsh-workers

Hong Xu wrote:
> If we have a directory tree like the following:
>
> - .git
> |
>  -- .hg
>
> vcs_info_msg_[01]_ are not set correctly. The hg repository is ignored
> and only the git repository is recognized. I have enabled both git and
> hg for vcs_info.
[...]
> Instead, to get the correct result, one should detect current directory
> for all VCS, then one level up and detect all VCS again, until '/' is
> met.

Sorry, to gain the best possible performance, vcs_info elects to take
shortcuts with systems that allow it. Git for example provides such a
shortcut, in that you can ask it if the current directory is a git
working directory.

In order to make this work, you can put hg before git in the "enable"
style in your configuration. You can even have "enable" be an
"evaluated" style to set its value depending in your current directory.

I am firmly against performing possibly complex and expensive detection
to support nested version control situations.


Regards, Frank


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-05-30 11:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-30  9:20 [BUG] vcs_info_msg_[01]_ is not set correctly in a hg repository which is in a subdirectory of a git repository Hong Xu
2015-05-30 11:13 ` Frank Terbeck

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).