From: Daniel Shahaf <d.s@daniel.shahaf.name>
To: Zsh hackers list <zsh-workers@zsh.org>
Cc: Aleksandr Mezin <mezin.alexander@gmail.com>
Subject: Re: [PATCH 2/3] vcs_info/cvs: set vcs_comm[basedir] in VCS_INFO_detect_cvs
Date: Mon, 25 Nov 2019 18:22:16 +0000 [thread overview]
Message-ID: <20191125182216.qurp3zdwsmv6i5md@tarpaulin.shahaf.local2> (raw)
In-Reply-To: <CAH+w=7a0beiAQ5Nbgu8A4u=5zoPMf4NPftEDj7yQsL_sb8bO6Q@mail.gmail.com>
Bart Schaefer wrote on Mon, Nov 25, 2019 at 01:13:21 -0800:
> I have several directories that are BOTH git and CVS repositories, used for
> keeping two different origins in sync.
>
> This is admittedly an unusual situation -- we have a legacy process that
> expects to fetch sources from CVS, and developers collaborating through git
> -- but I would be annoyed if vcs didn't find the git data because of the
> CVS subdir.
Doesn't my proposal address this? In my proposal, if {foo,foo/bar,foo/bar/baz}/CVS
and foo/bar/.git all exist, and cwd is foo/bar/baz/, git info would be shown
because the git root, foo/bar/, is closer (deeper) than the CVS root, foo/ —
notwithstanding that foo/bar/baz/CVS exists.
To be self-contained, what I proposed is:
- If [[ ${basedirA:P} == ${basedirB:P}/* ]], show ${basedirA}'s info.
- If [[ ${basedirB:P} == ${basedirA:P}/* ]], show ${basedirB}'s info.
- Show the info for whichever VCS is listed first in the 'enable' style.
Would that DTRT in your use-case?
> I would expect the list of repo types in the "enable" style to be handled
> in the order they appear.
Do you mean, that if the enable style lists "git" ahead of "cvs", then vcs_info
would always look for git info first and only show CVS info if git wasn't
detected? If so, see above.
Or do you mean, show _both_ the CVS and git info? I don't see how that would
work. Consider:
zstyle ':vcs_info:git:default:*' formats foo1
zstyle ':vcs_info:git:default:lorem' formats foo2 bar2
zstyle ':vcs_info:cvs:default:*' formats baz
precmd() { vcs_info default; [[ -z $vcs_info_msg_1_ ]] && print -Pr -- $vcs_info_msg_1_ }
Would this print "bar2" or "baz"? How could the precmd function determine
where the git info ends and the cvs info begins?
Perhaps we could have vcs_info return multiple arrays rather than multiple
scalars. For example, «typeset -a vcs_info_set_1_» could contain git info and
«typeset -a vcs_info_set_2_» could contain cvs info. That would also address
the case about git-within-git or hg-within-hg that I mentioned earlier.
However, it begs the question, why does vcs_info today use multiple scalars
rather than a single array?
Cheers,
Daniel
next prev parent reply other threads:[~2019-11-25 18:23 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-23 22:14 [PATCH 0/3] vcs_info: handle nested repositories of different types Aleksandr Mezin
2019-11-23 22:14 ` [PATCH 1/3] vcs_info/git: set vcs_comm[basedir] in VCS_INFO_detect_git Aleksandr Mezin
2019-11-23 22:14 ` [PATCH 2/3] vcs_info/cvs: set vcs_comm[basedir] in VCS_INFO_detect_cvs Aleksandr Mezin
2019-11-25 4:35 ` Daniel Shahaf
2019-11-25 7:31 ` Aleksandr Mezin
2019-11-25 8:16 ` Daniel Shahaf
2019-11-26 1:26 ` Aleksandr Mezin
2019-11-26 1:28 ` Aleksandr Mezin
2019-11-26 4:52 ` Daniel Shahaf
2019-11-26 10:22 ` Aleksandr Mezin
2019-11-28 11:13 ` Daniel Shahaf
2019-11-28 21:34 ` Daniel Shahaf
2019-11-29 13:41 ` Aleksandr Mezin
2019-11-29 15:25 ` Mikael Magnusson
2019-11-29 19:55 ` Daniel Shahaf
2019-11-29 20:30 ` Daniel Shahaf
2019-11-29 20:52 ` Daniel Shahaf
2019-11-25 9:13 ` Bart Schaefer
2019-11-25 18:22 ` Daniel Shahaf [this message]
2019-11-25 18:47 ` Bart Schaefer
2019-11-23 22:14 ` [PATCH 3/3] vcs_info: choose the nearest repository Aleksandr Mezin
2019-11-25 4:33 ` Daniel Shahaf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191125182216.qurp3zdwsmv6i5md@tarpaulin.shahaf.local2 \
--to=d.s@daniel.shahaf.name \
--cc=mezin.alexander@gmail.com \
--cc=zsh-workers@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).