Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [PATCH 3/3] vcs_info: choose the nearest repository
- X-seq: zsh-workers 44927
- From: Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx>
- To: Aleksandr Mezin <mezin.alexander@xxxxxxxxx>
- Subject: Re: [PATCH 3/3] vcs_info: choose the nearest repository
- Date: Mon, 25 Nov 2019 04:33:21 +0000
- 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 :references:mime-version:content-type:content-transfer-encoding :in-reply-to; s=fm1; bh=V2T9pRg3R2E/l/+ScjSFGmIxDe+2qiJ4JbfkknIO QUY=; b=LhnCAeE49vLGu3Ahvndg8xbdqEL5EkQ+32vR+riCj+70SnTBp4d8NOOi OIrpAXYNdkbCY300mQPYTxPdRz1TFTdKqP8Ntc2vGEdXGSyKg1qMjRNQlR0QzwYb 4Rrgq3NasyaLGTShaRnltW80eZ+PTHoF07341dckmish6Oku9hwTrJGsnpeQUhin gy/S3q6IPNL7PYa+twDojqYUhX8GGvq4azwl8nSh7Wn/hOI9bKmU5pax+vF92sxp xwmcu/4uinnyLJA/ds1CR9xpKaw8M8W+gJItTbXMsPEmb7O/vWqCtbV2taA35WGq GPEM13Xvn3RAyaD0n9Aovu8CI9pgZg==
- 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=V2T9pRg3R2E/l/+ScjSFGmIxDe+2qiJ4JbfkknIOQ UY=; b=bAAaA14B9hMf2AjBSq7crGt6HZPhkNf52RdfXjziMxj6KMBO7kQPDMC17 QPZPswlhcpkLGROa3vzbX7yZRQWX5rW9NOMzVD60yR07Pb7tySA6I3SAuKHj/zui 1c06+NNLxvlR4GXuCxjpnCCUjQ8YKYM4tCOXVKUIcIJzepsr5tvbYU/IGdje2PXl aK4FZP3NqND6f6jifT5bLxmMbQevr3XJUTnJkw8MUSm1blhZATnmSPvKlsk2LHRj mvVcrKIzhugifmQ0QDP2SU7i6EsO2EwdYawGVNAqezCbosp3ishb70lIkd9vqZ5U YaV2L2Bj6hX0jSweCkoMlCnIGFFYw==
- In-reply-to: <20191123221443.279556-4-mezin.alexander@gmail.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-unsubscribe: <mailto:zsh-workers-unsubscribe@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <20191123221443.279556-1-mezin.alexander@gmail.com> <20191123221443.279556-4-mezin.alexander@gmail.com>
Aleksandr Mezin wrote on Sun, Nov 24, 2019 at 04:14:43 +0600:
> However, this logic may not work correctly for symlinked repositories, if
> VCS_INFO_detect_* functions will continue to use :P modifier for the basedir.
> Is there a reason why :P is used for basedir instead of :a?
If ${foo} exists, then ${foo} and ${foo:P} are guaranteed to point to the same
inode. That's not true for ${foo} and ${foo:a}. What problem do you see with
use of :P? Shouldn't your 3/3 patch use :P rather than :a?
> +++ b/Functions/VCS_Info/vcs_info
> @@ -117,15 +116,25 @@ vcs_info () {
> fi
> vcs_comm=()
> VCS_INFO_get_cmd
> - VCS_INFO_detect_${vcs} && (( found = 1 )) && break
> + if VCS_INFO_detect_${vcs}; then
> + if (( ${#vcs_comm[basedir]:a} > ${#nearest_vcs_comm[basedir]:a} )); then
If $vcs_comm[basedir] is /foobar and $nearest_vcs_comm[basedir] is /foo, the
condition would be true but there'd be no parent dir–subdir relationship
between the two values.
> + nearest_vcs_comm=("${(kv)vcs_comm[@]}")
> + nearest_vcs="${vcs}"
> + nearest_backend_misc=("${(kv)backend_misc[@]}")
> + fi
> + fi
> done
Cheers,
Daniel
Messages sorted by:
Reverse Date,
Date,
Thread,
Author