From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from primenet.com.au (ns1.primenet.com.au [203.24.36.2]) by inbox.vuxu.org (OpenSMTPD) with ESMTP id ebe5f59a for ; Fri, 29 Nov 2019 13:42:43 +0000 (UTC) Received: (qmail 5050 invoked by alias); 29 Nov 2019 13:42:37 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: List-Unsubscribe: X-Seq: 44950 Received: (qmail 7390 invoked by uid 1010); 29 Nov 2019 13:42:37 -0000 X-Qmail-Scanner-Diagnostics: from mail-io1-f65.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.102.0/25642. spamassassin: 3.4.2. Clear:RC:0(209.85.166.65):SA:0(-2.0/5.0):. Processed in 1.726953 secs); 29 Nov 2019 13:42:37 -0000 X-Envelope-From: mezin.alexander@gmail.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at _netblocks.google.com designates 209.85.166.65 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=lktOuH3H3mW8ISd9AQnzviAPou5KXG32iuLUNR1uugg=; b=bL2OrBLCM/5UJ6RFs9KIyaLcUf7xisp8/W72RvZmmxGU5GGD+FrVtFEfBH8esDWSWg fKKtuV0rt8/UVhaiTBrb61IsYQ7+TL/PhLOy6ydcFV3MEK/nDPCFLvTuQddWhXGIk49R ud+hqDXEoQ5SmzX5eFqcFQlhuECxyfiijXTlyLzLGzz26kKahgqdC4XWjMS3RjeOd1h1 /WXs0GirRNsItWlRzGa11VvOy27Hd4NDYfDRNG2ZPt8KKeD+B4CwPwI/QNZPkeJcSLnc NbQBhy8ckEpJvZLSa+CxVLWRu6AdIKJXSQY5+gKHkwF4ALXr30EH/5ztiSt5VYfkb/oX eZAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=lktOuH3H3mW8ISd9AQnzviAPou5KXG32iuLUNR1uugg=; b=MRTezwmBdXGFn7zNDxpyJ3uyDTfmsJB1rQbTPbSvuSa8mym8FkemLzMVIEvaR71mu3 X333VvYTvgSzxDt5+oOAGPpLgD1rClElulR6PcEgQ4rk9ALSfvAhITQnwE/ReL7R4iHS P2yhZIOGIlsWQenrRe5lQQIj8c8hS4fC04K5vWsaK2TnNwfgZuPAHVDvC2uxSpKVtE3r JfV8+3GM7SKWZTJFJqM7sT5RrXGL29Kl4AaGob0dsm1TGtEYPPylP4YWNVznLIxe4XNx /oEecw+TzQSvtGGyuKUAcPrCdyOUsMYnnS+utGzKkQ0+CkOiSvZ1Bs/GHzxAcSesN3GU xIWA== X-Gm-Message-State: APjAAAWSNQtH2yjhi5ebyWo1mt2Qh4gbhqlTYlHzW3upBLShPwuKR2Di AX8gx0xtMhqKMiXAyJsCuO+bJT7GoouNxVZmf+NxZ0NwZfM= X-Google-Smtp-Source: APXvYqxFGd2bdS7NvZYNb7FsEUCmXqD0G3iPhNOFSm/G6mnzGzZZV6YN69HZ34/Ae0wJCkZjDdy4MPQhEklgKIg475c= X-Received: by 2002:a02:5a84:: with SMTP id v126mr649848jaa.60.1575034922565; Fri, 29 Nov 2019 05:42:02 -0800 (PST) MIME-Version: 1.0 References: <20191123221443.279556-1-mezin.alexander@gmail.com> <20191123221443.279556-3-mezin.alexander@gmail.com> <20191125043525.lcxm532gi6hb7n53@tarpaulin.shahaf.local2> <9438ca11-d0be-4c67-a5b3-a0b900342302@www.fastmail.com> <5edaa985-4ac9-411c-b4c2-415c49a563e3@www.fastmail.com> <20191128213430.53b5akiq43l7bzbx@tarpaulin.shahaf.local2> In-Reply-To: <20191128213430.53b5akiq43l7bzbx@tarpaulin.shahaf.local2> From: Aleksandr Mezin Date: Fri, 29 Nov 2019 19:41:51 +0600 Message-ID: Subject: Re: [PATCH 2/3] vcs_info/cvs: set vcs_comm[basedir] in VCS_INFO_detect_cvs To: Daniel Shahaf Cc: zsh-workers@zsh.org Content-Type: text/plain; charset="UTF-8" On Fri, Nov 29, 2019 at 3:34 AM Daniel Shahaf wrote: > > Daniel Shahaf wrote on Thu, Nov 28, 2019 at 11:13:44 +0000: > > Aleksandr Mezin wrote on Tue, 26 Nov 2019 10:22 +00:00: > > > On Tue, Nov 26, 2019 at 10:52 AM Daniel Shahaf wrote: > > > > % cd foo > > > > [shows hg info] > > > > % export GIT_WORK_TREE=${PWD/foo/bar} GIT_DIR=${PWD/foo/bar}/.git > > > > [shows git info] > > > > % > > > > > > Interesting. I didn't notice that GIT_INFO_detect_git checks the exit > > > code of `git rev-parse --is-inside-work-tree`, not the actual value. > > > > I think it should check both the exit code and the output. > > Sorry, I didn't look closely enough. In the example I gave (quoted above), > --is-inside-work-tree prints "false" and exits with code 0. In that situation, > I think VCS_INFO_detect_git should detect git, and it does. All in all, > I think the current code is correct, and could be optimized further with: > > [[[ > diff --git a/Functions/VCS_Info/Backends/VCS_INFO_detect_git b/Functions/VCS_Info/Backends/VCS_INFO_detect_git > index 61bc483e3..e4191f474 100644 > --- a/Functions/VCS_Info/Backends/VCS_INFO_detect_git > +++ b/Functions/VCS_Info/Backends/VCS_INFO_detect_git > @@ -6,8 +6,7 @@ setopt localoptions NO_shwordsplit > > [[ $1 == '--flavours' ]] && { print -l git-p4 git-svn; return 0 } > > -if VCS_INFO_check_com ${vcs_comm[cmd]} && ${vcs_comm[cmd]} rev-parse --is-inside-work-tree &> /dev/null ; then > - vcs_comm[gitdir]="$(${vcs_comm[cmd]} rev-parse --git-dir 2> /dev/null)" || return 1 > +if VCS_INFO_check_com ${vcs_comm[cmd]} && vcs_comm[gitdir]="$(${vcs_comm[cmd]} rev-parse --git-dir 2> /dev/null)" ; then > if [[ -d ${vcs_comm[gitdir]}/svn ]] ; then vcs_comm[overwrite_name]='git-svn' > elif [[ -d ${vcs_comm[gitdir]}/refs/remotes/p4 ]] ; then vcs_comm[overwrite_name]='git-p4' ; fi > return 0 > ]]] > > WDYT? > > Cheers, > > Daniel Then I don't see a sane way to choose which VCS to show, other than how it's already done (first one detected from 'enabled'). For example, a hg work tree in cwd, and GIT_WORK_TREE is set to something else (maybe parent directory, maybe ../other-dir). Which one (hg or git) to choose? Why? I guess I'll have to live with my own fork of vcs_info, because any changes there will break it for someone else.