zsh-workers
 help / color / mirror / code / Atom feed
From: Daniel Shahaf <d.s@daniel.shahaf.name>
To: zsh-workers@zsh.org
Cc: Peter Grayson <pete@jpgrayson.net>
Subject: [PATCH] vcs_info git: Check the get-unapplied style as documented (was: [PATCH v3] Updated StGit patch detection in vcs_info)
Date: Thu, 8 Dec 2022 22:08:40 +0000	[thread overview]
Message-ID: <20221208220840.GT27622@tarpaulin.shahaf.local2> (raw)
In-Reply-To: <20221208220640.GS27622@tarpaulin.shahaf.local2>

The style was treated as "always true" rather than as "settable, false
by default" in the rebase-merge and cherry-pick cases.  This affects the
gen-unapplied-string hook, and may also affect gen-applied-string and
set-patch-format hooks if they accessed VCS_INFO_get_data_git's internal
parameters directly.

If this affects you, just set the style in your zshrc:
.
    zstyle ':vcs_info:git*:*:*' get-unapplied true

---
 Functions/VCS_Info/Backends/VCS_INFO_get_data_git | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Daniel Shahaf wrote on Thu, Dec 08, 2022 at 22:06:40 +0000:
> Noticed two issues while there:
> 
> 1. (preëxisting) Some of the other codepaths don't check the
> get-unapplied style.  I'll send a patch for that in a minute.

diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git
index 23d4d31a1..37cd048db 100644
--- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git
+++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git
@@ -244,7 +244,9 @@ if [[ -d "${gitdir}/rebase-merge" ]]; then
             (( $+REPLY )) && git_patches_applied+=( "$REPLY" )
         done
     fi
-    if [[ -f "${patchdir}/git-rebase-todo" ]] ; then
+    if zstyle -t ":vcs_info:${vcs}:${usercontext}:${rrn}" get-unapplied &&
+       [[ -f "${patchdir}/git-rebase-todo" ]]
+    then
         for p in ${(f)"$(< "${patchdir}/git-rebase-todo")"}; do
             VCS_INFO_git_map_rebase_line_to_hash_and_subject "$p"
             (( $+REPLY )) && git_patches_unapplied+=( "$REPLY" )
@@ -374,7 +376,9 @@ elif [[ -f "${gitdir}/CHERRY_PICK_HEAD" ]]; then
     # TODO: maybe read up to the first blank line
     IFS='' read -r subject < "${gitdir}/MERGE_MSG"
     git_patches_applied=( "$(<${gitdir}/CHERRY_PICK_HEAD) ${subject}" )
-    if [[ -f "${gitdir}/sequencer/todo" ]]; then
+    if zstyle -t ":vcs_info:${vcs}:${usercontext}:${rrn}" get-unapplied &&
+       [[ -f "${gitdir}/sequencer/todo" ]]
+    then
         # Get the next patches, and remove the one that's in CHERRY_PICK_HEAD.
         git_patches_unapplied=( ${${(M)${(f)"$(<"${gitdir}/sequencer/todo")"}:#pick *}#pick } )
         git_patches_unapplied[1]=()


  reply	other threads:[~2022-12-08 22:09 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-25 20:43 [PATCH] Remove _stgit completion script Peter Grayson
2022-10-31  9:19 ` Daniel Shahaf
2022-10-31 10:13   ` StGit 2.0 and vcs_info (was: Re: [PATCH] Remove _stgit completion script) Daniel Shahaf
2022-11-01  3:00   ` [PATCH] Remove _stgit completion script Peter Grayson
2022-11-01  3:04     ` [PATCH] Remove StGit patch detection from vcs_info Peter Grayson
2022-11-11 11:49       ` Daniel Shahaf
2022-11-12 14:46         ` Peter Grayson
2022-11-12 15:42           ` [PATCH] Updated StGit patch detection in vcs_info Peter Grayson
2022-11-13  4:58             ` Daniel Shahaf
2022-11-16 20:45             ` [PATCH v2] " Peter Grayson
2022-12-08 14:52               ` [PATCH v3] " Peter Grayson
2022-12-08 22:06                 ` Daniel Shahaf
2022-12-08 22:08                   ` Daniel Shahaf [this message]
2022-12-09  0:59                   ` Peter Grayson
2022-12-09  1:37                     ` Daniel Shahaf
2022-12-10 12:55                       ` Peter Grayson
2022-12-10 13:31                         ` Daniel Shahaf
2022-11-13  4:30           ` [PATCH] Remove StGit patch detection from vcs_info Daniel Shahaf
2022-11-14  3:38             ` Peter Grayson
2022-11-14  5:17               ` Mikael Magnusson
2022-11-14 13:21                 ` Daniel Shahaf
2022-11-14 13:15               ` Daniel Shahaf
2022-11-16 19:38                 ` Peter Grayson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221208220840.GT27622@tarpaulin.shahaf.local2 \
    --to=d.s@daniel.shahaf.name \
    --cc=pete@jpgrayson.net \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).