zsh-workers
 help / color / mirror / code / Atom feed
From: Daniel Shahaf <danielsh@apache.org>
To: zsh-workers@zsh.org
Subject: [PATCH] vcs_info quilt: Allow quiltcommand to be a function.
Date: Thu, 12 Mar 2020 18:15:45 +0000	[thread overview]
Message-ID: <20200312181545.8865-1-danielsh@tarpaulin.shahaf.local2> (raw)

Before this commit, it could only be an external command.
---
 Functions/VCS_Info/VCS_INFO_quilt | 5 +++--
 README                            | 5 +++++
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/Functions/VCS_Info/VCS_INFO_quilt b/Functions/VCS_Info/VCS_INFO_quilt
index fef85964a..264dbed0e 100644
--- a/Functions/VCS_Info/VCS_INFO_quilt
+++ b/Functions/VCS_Info/VCS_INFO_quilt
@@ -133,7 +133,7 @@ function VCS_INFO_quilt-patch2subject() {
         # This zstyle call needs to be moved further up if `quilt' needs
         # to be run in more places than this one.
         zstyle -s "${context}" quiltcommand quiltcommand || quiltcommand='quilt'
-        quilt_env=(env)
+        quilt_env=()
         if [ -z "$patches" ]; then
             zstyle -s "${context}" quilt-patch-dir patches || patches="${QUILT_PATCHES}"
             if [[ "${patches}" != /* ]]; then
@@ -147,7 +147,8 @@ function VCS_INFO_quilt-patch2subject() {
             fi
             quilt_env+=(QUILT_PATCHES="$patches")
         fi
-        unapplied=( ${(f)"$(${quilt_env[@]} $quiltcommand --quiltrc /dev/null unapplied 2> /dev/null)"} )
+        unapplied=( ${(f)"$(if (( $+quilt_env[1] )); then export ${quilt_env[@]}; fi
+                            $quiltcommand --quiltrc /dev/null unapplied 2> /dev/null)"} )
         unapplied=( ${unapplied:#} )
     else
         unapplied=()
diff --git a/README b/README
index b8dfd0e2a..2bd5c2179 100644
--- a/README
+++ b/README
@@ -38,6 +38,11 @@ Build-time change: The default value of the --enable-gdbm configure
 argument has changed from "yes" to "no".  Thus, the zsh/db/gdbm module will
 not be built unless --enable-gdbm is passed explicitly.
 
+vcs_info quilt: The value of the 'quiltcommand' style used to be taken for the
+name of an external command.  Now it may also be a shell function.  Normal
+command word precedece rules apply, so if you have a function and a command
+with the same name, the function will be used.
+
 Incompatibilities since 5.7.1
 -----------------------------
 

                 reply	other threads:[~2020-03-12 18:16 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20200312181545.8865-1-danielsh@tarpaulin.shahaf.local2 \
    --to=danielsh@apache.org \
    --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).