From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 11688 invoked from network); 13 Nov 2022 04:58:53 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 13 Nov 2022 04:58:53 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1668315533; b=X77i0AJiF/pLFZ1RT7DAhZfFR/+g8uxZ1L248zcuEE7F8U31Lqot/+GeJ2Q+49UlohH/USWxmv KaR3iEpOdBGkcb587ubn5Fodi9eM1s4kvRngMlbdMpZ9QcSQ+3S7G+gyVLCJsVRbdlpRnkfTlO RNzlSPzGje50UQ/386KlqCBpMu7QWSuLzejWl8t5z5zdg0v0Gs8KQg3S+V61FOsiQrbmYgZa78 fmnHsqvmJOb5fgRD4Fr7omS+TqykbrmfFgpZADGrE/Z+TkR1EO2g5W77PHd+NKOuBWeS7Y0Q8+ y0zn5eZRTc1Q7JiC2VbAHTz31Hssi4pGF/PzBkXlWyz/gg==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (out5-smtp.messagingengine.com) smtp.remote-ip=66.111.4.29; dkim=pass header.d=daniel.shahaf.name header.s=fm3 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 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1668315533; bh=dQcgks3NR9AX1mW/VwlayV85IQ+NscJHUUVHYRncSz8=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:In-Reply-To:Content-Transfer-Encoding:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:DKIM-Signature: DKIM-Signature:DKIM-Signature; b=L1OMTbzt1PdwoN+0bt5xY/mTs+9D6NgCf1Qqv9dKwWtzCP6J/7lgpc4QRc+zMo8mq6eCl+oPC6 Wre9DFCruKAyIpmcCwXJZM3hk4uytNyhAHL6sQycBFIrvauf30XqeM6iQ0llC8IiymLD5iKPBi DZxmThY0Y8C6QetHghXVwpU5cJRHdzQBTrMpybcru/uJG2mRTTKdiOf8Z17deAEBMR1Hm1mpiX oWAunkpot7Y79Fq7x2BtuJNMtYoeq2BwD+HoUfZDz8qBRxk3wwtCHNLVVoMRT0+PZr79DD2usg rOwWYK8TunNtv7hLkoOAc+f7K2MGTY3P1pKFfUnUxeaAVA==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20210803; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:In-Reply-To:Content-Transfer-Encoding :Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID; bh=QkwYtSrvTNtg9eOtUZ1Jps3hhMTNU3JiJAmZAGAXsBs=; b=R3n8ZYMybePEuLDCpfs8esmgq5 /JmLX1KQxC0QILO5MlwcjHZSpNjcD/OrFoi1PiQ7Fm5b0QMrH8TPrXOKcssGjz/lVRurqdYGwVp9K 9aOBhqOtP1guS4AxfflTesXi29A5+gu1yHuvI1P2OxH/KritFKAuCu2TAj7XJPRtke5UMhAwiEvD2 D0AeQ6FgXZItumftytS1KY5rAY1Wt2/dDaAVCDllyx5tHvdwS6QiNblxX0+0GiwIwb/C+xerNGkO0 61yyshKTv4vJ5OLyz6FR1GLa/BIq3NbnM7mOyUpBssrrxnuT36UAGF4AH57UuqBkQTXAOLTTfoj9K oBRD5laA==; Received: by zero.zsh.org with local id 1ou552-000HEs-Bn; Sun, 13 Nov 2022 04:58:52 +0000 Authentication-Results: zsh.org; iprev=pass (out5-smtp.messagingengine.com) smtp.remote-ip=66.111.4.29; dkim=pass header.d=daniel.shahaf.name header.s=fm3 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 Received: from out5-smtp.messagingengine.com ([66.111.4.29]:34599) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1ou54i-000Gts-ID; Sun, 13 Nov 2022 04:58:33 +0000 Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 5F70F5C00A0; Sat, 12 Nov 2022 23:58:31 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Sat, 12 Nov 2022 23:58:31 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= daniel.shahaf.name; h=cc:cc:content-transfer-encoding :content-type:date:date:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to; s=fm3; t=1668315511; x=1668401911; bh=QkwYtSrvTN tg9eOtUZ1Jps3hhMTNU3JiJAmZAGAXsBs=; b=ZnGXhlIOjvyemNiE2UFqVxJc2I SRr3WI6MdYLQn3mwLvMVZ9lum8GSVNP93ZaOdmp8J48+lu+9SlBD5WvIqFVPTuQy jEkpF8l+/U481bFiSG2XxGd2IGB+2OIjrbrWTEJp8czHvcEZf7Ppaak43pdqxLzX ffYDT31Ru1Kt/5PsJfeTG4fQi7MxwNDKdoS6c+0MhkoIyqUIzekk2pQdLM4vDsg9 b7fpirbY4FK2hCu/RqWTdKHIDYP3eCd8SijiON0v8hHFa+AAxDpv8Sc+gKSsp/Pk MA/NuPCuMJGugM856+ZmwD0B/xDbMOuUmUUl3VjSmHfu6ghCjl9y3KQPEo9Q== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1668315511; x= 1668401911; bh=QkwYtSrvTNtg9eOtUZ1Jps3hhMTNU3JiJAmZAGAXsBs=; b=k 4nKDUsJ5tSFEiDaybdCvnJJWtL00DLmxXG0QvWxGBeDnkxWrM1cWeaG0FJAvuThB 0zBqiZR/4TQEQPPVkWs5/ubc8Ju3GoBGkrWp37Rdh8WPa1wjX2TeKTAaSlSG9b2J MNaVdw7e0HSVtBqqYUmUwFjK8UW8XyokhDTgYzYs8TjCjF0yH4Z6R7VJzNjI4KTB 7DeCEZsCd3FUr8OfGIjzMGl05O6tS7xicDK53tI8AqU0c9VjEToYSDlMVkHSKO3k CzrLevFXtrJRJm+RlzolQUA0CaB27FFTyl38CtWdtgp7xlw7WCpppn0i6gOXLcsM ov7eNKFCZ7AW8r2SC+0EA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedrfeelgdejjecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpeffhffvvefukfhfgggtugfgjggfsehtkedttddtredunecuhfhrohhmpeffrghn ihgvlhcuufhhrghhrghfuceougdrshesuggrnhhivghlrdhshhgrhhgrfhdrnhgrmhgvqe enucggtffrrghtthgvrhhnpeefhfeiuedthefgtedufeeviedtgedtjeekgfdvudfggfdt udehgefgjeduteefueenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrih hlfhhrohhmpegurdhssegurghnihgvlhdrshhhrghhrghfrdhnrghmvg X-ME-Proxy: Feedback-ID: i425e4195:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 12 Nov 2022 23:58:30 -0500 (EST) Received: by tarpaulin.shahaf.local2 (Postfix, from userid 1000) id 4N90ZX5g8qzDY; Sun, 13 Nov 2022 04:58:28 +0000 (UTC) Date: Sun, 13 Nov 2022 04:58:28 +0000 From: Daniel Shahaf To: Peter Grayson Cc: zsh-workers@zsh.org Subject: Re: [PATCH] Updated StGit patch detection in vcs_info Message-ID: <20221113045828.GH27622@tarpaulin.shahaf.local2> References: <603fd1b9-1b11-4729-99cb-19e1c4ef8b37@app.fastmail.com> <20221112154221.661029-1-pete@jpgrayson.net> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20221112154221.661029-1-pete@jpgrayson.net> User-Agent: Mutt/1.10.1 (2018-07-13) X-Seq: 50948 Archived-At: X-Loop: zsh-workers@zsh.org Errors-To: zsh-workers-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-workers-request@zsh.org X-no-archive: yes List-Id: List-Help: , List-Subscribe: , List-Unsubscribe: , List-Post: List-Owner: List-Archive: Peter Grayson wrote on Sat, Nov 12, 2022 at 10:42:21 -0500: > The vcs_info patch detection code attempted to interrogate StGit patch > stack state by inspecting .git/patches/applied and > .git/patches/unapplied. As of StGit 1.0, StGit stack and patch state is > no longer maintained via files in the .git/ directory, but is instead > captured in the repo's object database, accessible via the > refs/stacks/ reference. > > Thus zsh's approach for interrogating StGit patch state is long > obsoleted. > > This patch updates vcs_info to use StGit's prescribed interface for > interrogating applied and unapplied patch state: the `stg series` command. > This approach will work with effectively all versions of StGit, pre-1.0, > 1.x, and 2.x. > Great! > The new test for StGit patches is moved to the end of the if/elif chain > that also tests for git rebase, merge, and cherrypick states. If any of > those operations are in progress, a StGit user will want to know about that > instead of the StGit stack state. > > N.B. it may be possible for vcs_info to interrogate StGit stack state > in a faster manner by probing the filesystem and git object database > directly instead of executing `stg series`, but this would require vcs_info > to have knowledge of StGit internals across many versions. > Either or both of these paragraphs might work better as a source comment, so as to ensure future editors of this file will be aware of these considerations. > Signed-off-by: Peter Grayson > --- > .../VCS_Info/Backends/VCS_INFO_get_data_git | 18 +++++++++--------- > 1 file changed, 9 insertions(+), 9 deletions(-) > > diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git > index e45eebc8e..9edc2d140 100644 > --- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git > +++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git > @@ -184,15 +184,8 @@ fi > VCS_INFO_adjust > VCS_INFO_git_getaction ${gitdir} > > -local patchdir=${gitdir}/patches/${gitbranch} > -if [[ -d $patchdir ]] && [[ -f $patchdir/applied ]] \ > - && [[ -f $patchdir/unapplied ]] > -then > - # stgit > - git_patches_applied=(${(f)"$(< "${patchdir}/applied")"}) > - git_patches_unapplied=(${(f)"$(< "${patchdir}/unapplied")"}) > - VCS_INFO_git_handle_patches > -elif [[ -d "${gitdir}/rebase-merge" ]]; then > +local patchdir > +if [[ -d "${gitdir}/rebase-merge" ]]; then > # 'git rebase -i' > patchdir="${gitdir}/rebase-merge" > local p > @@ -389,6 +382,13 @@ elif [[ -f "${gitdir}/CHERRY_PICK_HEAD" ]]; then > git_patches_unapplied=() > fi > VCS_INFO_git_handle_patches > +elif git_patches_applied=(${(f)"$(stg series --noprefix --applied 2>/dev/null)"}); then > + # N.B. the "--noprefix" option is available in StGit 2.x as an alias for --no-prefix. > + # The former is compatible with StGit versions going back to 2008. > + if zstyle -t ":vcs_info:${vcs}:${usercontext}:${rrn}" get-unapplied; then > + git_patches_unapplied=(${(f)"$(stg series --noprefix --unapplied 2>/dev/null)"}) > + fi > + VCS_INFO_git_handle_patches > else > gitmisc='' > fi +1 If you wish, you can add the patches' log messages here, too (as printed by «stg series --description»); a gen-applied-string hook can be used to show those in the prompt. There's an example in Misc/vcs_info-examples. (But I'd be happy to merge the patch without this, too :)) Cheers, Daniel