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,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 13464b3e for ; Thu, 28 Nov 2019 21:35:23 +0000 (UTC) Received: (qmail 14817 invoked by alias); 28 Nov 2019 21:35:14 -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: 44945 Received: (qmail 21880 invoked by uid 1010); 28 Nov 2019 21:35:14 -0000 X-Qmail-Scanner-Diagnostics: from wout3-smtp.messagingengine.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(64.147.123.19):SA:0(-2.6/5.0):. Processed in 5.039277 secs); 28 Nov 2019 21:35:14 -0000 X-Envelope-From: d.s@daniel.shahaf.name X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: none (ns1.primenet.com.au: domain at daniel.shahaf.name does not designate permitted sender hosts) 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=wo1c1t1uyt6qFunvtSDFYMwrQStCFrWjbSN9+m7m KLo=; b=D/izjKIbnQlEDpNi3WBJTsJBcZb/ULCAKTB7YCacAFVyNIR0KMUmiNHv k9rqRe6xIkb/JL+ka8D0d6BbVeILMQkhL4ZUZNlXGlikidsLVDp5OOXE37+oh4Q9 ztqcQh6idJEqz10YOTGN/2d0scrgxHkdFe+FuK1mF6BQZfkRaiFTQhS6N3KIz16w oCa0FRPseMQwDH/6QgFqYvigRMjbbFp96teWNtrYc30Ek//qk4sFkomG/p4tEaCJ 418brkeFG4CM1fVM+9hgufkOo0H+W2KHTCvJ0zzFdnKzCe3iM9mxwyt4SkQH7vpb apNxj4dCjkVSqXCJ/N5Rlfym/FNpcw== 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=wo1c1t1uyt6qFunvtSDFYMwrQStCFrWjbSN9+m7mK Lo=; b=PbFfddls//Z7905+Je7+y9cemJW/pkFken0iANYUPLKvLE2IE7sLg9OBb G5nyaRaLveyZA9Y5ptT1R1Uf7xFstnO8Xv0iZ5jyG9apF+hYZAlpZivSzT5CFPti ti2kB6I/3sEZXsgDN+v8zSeU06+zj60Q5CNUBbQ2fG1uisjuLMO7m464zfSbtBq+ o1jUDVIAIPBvXBRUWknnvdMpFrQY4ggfei8o/tPHw/r/n1fDSicHNStd6Gk9YHkZ q8+FSGl5OJC3NTdlmiIudCseBA/InQ3xKOc2TxC8o20BCH/chc4/IchngcKFawJ9 ARE/VLramkF9D56/+A4nrk1HAQcgA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedufedrudeijedgudegjecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpeffhffvuffkfhggtggugfgjfgesthektddttderudenucfhrhhomhepffgr nhhivghlucfuhhgrhhgrfhcuoegurdhssegurghnihgvlhdrshhhrghhrghfrdhnrghmvg eqnecukfhppeejledrudektddrheejrdduudelnecurfgrrhgrmhepmhgrihhlfhhrohhm pegurdhssegurghnihgvlhdrshhhrghhrghfrdhnrghmvgenucevlhhushhtvghrufhiii gvpedt X-ME-Proxy: Date: Thu, 28 Nov 2019 21:34:30 +0000 From: Daniel Shahaf To: Aleksandr Mezin Cc: zsh-workers@zsh.org Subject: Re: [PATCH 2/3] vcs_info/cvs: set vcs_comm[basedir] in VCS_INFO_detect_cvs Message-ID: <20191128213430.53b5akiq43l7bzbx@tarpaulin.shahaf.local2> 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> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <5edaa985-4ac9-411c-b4c2-415c49a563e3@www.fastmail.com> User-Agent: NeoMutt/20170113 (1.7.2) 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