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 10980 invoked from network); 12 Nov 2022 15:42:51 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 12 Nov 2022 15:42:51 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1668267771; b=A/FvtJMG0F9vkBfg4sMCKKnRlGL47ghVpm6GfMFCSY6hiJpukknBgsloOwucZ4B97cBP7nJGLL X5QkmqMCxTpYLnvitzxcoZtj1fIZP0KvKBCsnhEIw9Nftc+iwlvCv/xWRKxenqLVPnGrYVF0jM 9tNu7hBUnEBSV5r8O5tL4aMKINlXXsqsUkzsNWU8X2S7S5rUdH7ule6vVtx62WoGZL+onVmSVU cycg5lpNC/uA9kBvRZz2FArpmroRZUFbze+SFjEodRsq5aHzmU2Cutf8HPr3mil9N/KEwwkq9c +qzwcIW2P2LOfm/SsZ5NU42dX+ihLMhbYi10jg9c6KqCrg==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (out1-smtp.messagingengine.com) smtp.remote-ip=66.111.4.25; dkim=pass header.d=jpgrayson.net header.s=fm3 header.a=rsa-sha256; dkim=pass header.d=messagingengine.com header.s=fm1 header.a=rsa-sha256; dmarc=none header.from=jpgrayson.net; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1668267771; bh=aFVv3IKAV723N2mmXcZsFZWxNEUek25XJh8amkampiI=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:Cc:To:From:DKIM-Signature: DKIM-Signature:DKIM-Signature; b=GARmlhFDHH4YW1f+oOWZIUeSwQjO1i+xB8epqCCGELGe/o5Dhns3SNk89oJD6wPEx6r/cOrWkZ eWLoWWn5PkEV5fsDvqbXu/j1uifB67kg+v4Ce4shbwhdMAe4TUHKn7xYZK+omdG26zFnkjx1uW N5unGLDZkQC6KgDtL4QcueNFNu29KLjzlw5n7oob/3l/OACuL2DWwl5gLdynSaRMpCZgjHuOkC 6bIIrrbjAxYtZS0Sgk24VXNbTstN3Rz7+rgIECXf9bhNrXO3Kzwcbf5W0xobLJjMs47Ss6zX8/ j/3laMMy/MJr8KU3VsjONOwSGyEMpS5RphCU9yUr2o2B/g==; 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:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=K2ts0oTnBTNpUUyotA+CyPYnufm3bLpyEwWFDu66hNw=; b=HvlXgkAke8CaQZHXR9zj+svQvL ttR6uWOqIUe+hOXL5ZzNM6DK5RAs3ZbSBe9Z5/FgSMQU/pCQdsEZFnlfkLQ/gG4i3WqJEMoCyLMIu gS/bSWNGqFug1+FRf2Qs/LO5Pef+sNi34DRpozegYstAYMF1IUjWmxEaQN5JOEKjXgBuJl6jMyLZB p/n6P6CjZy7PpLTirbrZ2uLl5/cI9DxH/X+AmEu5a9v/wbrtk4DPw8ZldAA7DEzfAiC2rQXpuc2Lb /pVjHrq4eo0o62di5NBcfTMpUKBW5DzvFYjdCR1NL5ol3T1pS64PtdLSt9uLGVgn0kELiKojgOu9U CL+9GCPw==; Received: by zero.zsh.org with local id 1otsef-000Klv-7E; Sat, 12 Nov 2022 15:42:49 +0000 Authentication-Results: zsh.org; iprev=pass (out1-smtp.messagingengine.com) smtp.remote-ip=66.111.4.25; dkim=pass header.d=jpgrayson.net header.s=fm3 header.a=rsa-sha256; dkim=pass header.d=messagingengine.com header.s=fm1 header.a=rsa-sha256; dmarc=none header.from=jpgrayson.net; arc=none Received: from out1-smtp.messagingengine.com ([66.111.4.25]:42189) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1otseL-000KQM-L7; Sat, 12 Nov 2022 15:42:30 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 678B55C007A; Sat, 12 Nov 2022 10:42:28 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Sat, 12 Nov 2022 10:42:28 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jpgrayson.net; h=cc:cc:content-transfer-encoding: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=1668267748; x= 1668354148; bh=K2ts0oTnBTNpUUyotA+CyPYnufm3bLpyEwWFDu66hNw=; b=l Y/QfqwFFVpE7aOa3UceTk2Y12f2g9BskSgrKgkt03AEp0lXMWeYv0F2VY8eDz608 +3vUKWpwQEPnTNYnDjt+b+2WxheUnASx3kyQ64lr6kfpV0wVP6VwZT0d9TkfJR0g uSnyWBfX8rRlLiwYqbQpky+yfXZOqdwlk50Yjd8GAkP8xG1A/Oo6vKpNoGCZXJwT 9jxAHWYBMN+xQdOKgIBCsv5rYOyiYsempupoKr7qEIHEu577XSyMLDVK+F4SsrKn Hb5nMDvdt7P9XDh7yqbmaUoj/eKuM3XqRRlmiA3lZYQFfkJXTVs6e4zfC3pWiQOT twxlX7f4nG7Xxj15Fp4YA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding: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=1668267748; x=1668354148; bh=K2ts0oTnBTNpU UyotA+CyPYnufm3bLpyEwWFDu66hNw=; b=lUsb1FwOKw6OuysIV/0ZrbSwHSmbr btWMpqVR9lzpDQ/YJ+x+/fDPAuxWZyrqT3OF+tPWLGQsD6cFh7lzDzGSeyHdyeMY Cd2r55YoBtIKI4sUrzh5cp/vdRY0UsbkSZPcCW0bKOWlRst56O8IjGaObxI3X0tk 0RIf0Wdm5fY0fqak/jo/rhHGm5CZSptJ7H6Z1OYlJufrwH+Wgpgqm4nZaLcCNtge Gx59QoJiwsF50E+X8NigC7FKwT1ib4ToW3yX+r1wcjCOp7mbreGp4Q/PkeXpizMT c9pmeuB2l1bXFHjtRxUyxpHYtDXCJJ9pIBpgqdW9dGv3TII1vp9iKLZ8A== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedrfeekgdektdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhephffvvefufffkofgjfhgggfestdekre dtredttdenucfhrhhomheprfgvthgvrhcuifhrrgihshhonhcuoehpvghtvgesjhhpghhr rgihshhonhdrnhgvtheqnecuggftrfgrthhtvghrnhepgeetudeggfejvdehkedugfeuge evvddvfefhjeetfeegveeiheevuddugefhfedvnecuvehluhhsthgvrhfuihiivgeptden ucfrrghrrghmpehmrghilhhfrhhomhepphgvthgvsehjphhgrhgrhihsohhnrdhnvght X-ME-Proxy: Feedback-ID: iefe944c0:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 12 Nov 2022 10:42:27 -0500 (EST) From: Peter Grayson To: zsh-workers@zsh.org Cc: d.s@daniel.shahaf.name, Peter Grayson Subject: [PATCH] Updated StGit patch detection in vcs_info Date: Sat, 12 Nov 2022 10:42:21 -0500 Message-Id: <20221112154221.661029-1-pete@jpgrayson.net> X-Mailer: git-send-email 2.38.1 In-Reply-To: <603fd1b9-1b11-4729-99cb-19e1c4ef8b37@app.fastmail.com> References: <603fd1b9-1b11-4729-99cb-19e1c4ef8b37@app.fastmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Seq: 50942 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: 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. 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. 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 -- 2.38.1