Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [RFC PATCH v3] vcs_info: choose backend by basedir
- X-seq: zsh-workers 47518
- From: Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx>
- To: Aleksandr Mezin <mezin.alexander@xxxxxxxxx>
- Subject: Re: [RFC PATCH v3] vcs_info: choose backend by basedir
- Date: Wed, 4 Nov 2020 06:38:24 +0000
- Archived-at: <https://zsh.org/workers/47518>
- Archived-at: <http://www.zsh.org/sympa/arcsearch_id/zsh-workers/2020-11/20201104063824.74110106%40tarpaulin.shahaf.local2>
- Authentication-results: zsh.org; iprev=pass (out2-smtp.messagingengine.com) smtp.remote-ip=66.111.4.26; dkim=pass header.d=daniel.shahaf.name header.s=fm1 header.a=rsa-sha256; dkim=pass header.d=messagingengine.com header.s=fm1 header.a=rsa-sha256; dmarc=none header.from=daniel.shahaf.name; arc=none
- Cc: zsh-workers@xxxxxxx
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= daniel.shahaf.name; h=date:from:to:cc:subject:message-id :in-reply-to:references:mime-version:content-type :content-transfer-encoding; s=fm1; bh=Kp7ghO0I+4GH4o6oo50VhA/AJp Uvo4O822OGjtKML1c=; b=EiF4h6ACibYpoIgN6Q79pCRKrLN65HeegLkYfHKvRC 4f0mJL7SpgK+zPJX0kfNQOx5lT3Te86FDJD3GDUthEJ/xITYhepQ+f2DsPSxq7jL vy+WKoVOdwrT1iEN0VRvk8BXp/rXcTAJ39lpuS/wjq7w0Un141EOGt4YYW3vJF2D eM+HtrmJC11Jy/FJv4D7qS0+aGDRyUc9zxykYOcuqu4p/eUlGhIbWpM+Le20hHVz OyDRrmzDICV/4xF+zostyyj/IOL8p5T+NtC8ZBy103LthP/O1buZBJN/3+ow0YGn 6GKM9++9BlXH65767b3w0xyVrRLULKYjlbW2ZKzHTNpg==
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; bh=Kp7ghO0I+4GH4o6oo50VhA/AJpUvo4O822OGjtKML 1c=; b=eMisS3TOpBfEyUFVKBI/Jumr+L6IvPt9nek119OJaiBjpTotITCPJicCB f8kddjzr6xeT/dt3KUiaXr8OLFu46UbqAmu3vU5YO/OpWip54ZDIOTgsxUAqW68r Mqz/Co2t7SUlY6xLK2Hs6RwR5bkTJPjfm2tOpgPlwlx+r2WoSDofZiKNHIAZhyoR FKqU/fCVB0rG0T4G88pwoZvYwCTBk4eVF3Wny2XnaRA58Qr8nPdHCvTxyeNa4yXX /zKf6HYnCwZY36BEQnycq/364zzWll9ogskPbPktilyqJHOrAqn5ifPlUhvrPKPp lzi4RNvdBScioWql35VAmc4kvBFmg==
- In-reply-to: <CADnvcfKwbzaKCjpvPjj-7sepvyYyq5CfSGwgC0pxofcTbz64bQ@mail.gmail.com>
- List-archive: <http://www.zsh.org/sympa/arc/zsh-workers>
- List-help: <mailto:sympa@zsh.org?subject=help>
- List-id: <zsh-workers.zsh.org>
- List-owner: <mailto:zsh-workers-request@zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-subscribe: <mailto:sympa@zsh.org?subject=subscribe%20zsh-workers>
- List-unsubscribe: <mailto:sympa@zsh.org?subject=unsubscribe%20zsh-workers>
- References: <20201029012755.253085-1-mezin.alexander@gmail.com> <CADnvcfKwbzaKCjpvPjj-7sepvyYyq5CfSGwgC0pxofcTbz64bQ@mail.gmail.com>
- Sender: zsh-workers-request@xxxxxxx
Sorry for the delayed replies; I've been offline. More below.
Aleksandr Mezin wrote on Mon, 02 Nov 2020 05:09 +0600:
> On Thu, Oct 29, 2020 at 7:28 AM Aleksandr Mezin
> <mezin.alexander@xxxxxxxxx> wrote:
> > It's possible to revert to the old behavior of vcs_info, by setting:
> >
> > zstyle ':vcs_info:*' backend-choice enablement-order
> >
>
> Now I'm not sure if an "enum-like" zstyle is a good idea.
>
Fair question.
> 1) Should I check somewhere that the string value is valid (i.e. it's
> either empty, or one of the predefined strings)?
(This question presumes we'll be keeping the enum-like design, so I'll
presume the same in my answer.)
If possible, please write the code so as to be forward compatible with
any new enum values we may add in the future. That is, when reviewing,
we'll consider several cases:
- Style isn't set
- Style is set to one of the predefined strings
- Style is set to a string that will be predefined in a future version
or to an invalid string (the code can't tell the difference)
Less likely cases include:
- The style is set to the empty array («zstyle $pattern $style» with no further arguments)
- The style is set to the empty string («zstyle $pattern $style ''»)
- The style is set to one of the predefined strings, plus some
additional words
> 2) Extensibility: I don't think there will be another different mode
> that should be controlled by this zstyle. More likely, there will be
> parameters like "prefer non-ancestor vcs directories or not". And IMO
> they should have their own boolean zstyles, and not something like
> `backend-choice closest-vcs-dir-prefer-ancestors`. And even more
> likely, nobody will add anything there
About extensibility, needs for extensibility aren't always foreseen.
As to their own boolean styles, I'm not sure I agree. zstyle values are
arrays, so we could let parameters be provided in additional words, as
in:
.
zstyle $pattern $style enablement-order foo=bar
zstyle $pattern $style closest-.vcs-dir lorem=ipsum
Hmm. Perhaps it would make more sense to name the style "disk-layout",
and then the extra parameters could be used to choose whether to select
the closest or farthest .${vcs} dir.
Or perhaps an enum really is overkill, as you say.
Frank?
Cheers,
Daniel
Messages sorted by:
Reverse Date,
Date,
Thread,
Author