zsh-workers
 help / color / mirror / code / Atom feed
From: Daniel Shahaf <d.s@daniel.shahaf.name>
To: zsh-workers@zsh.org
Subject: Re: [PATCH 2/2] vcs_info quilt: Pass patch subject lines to gen-applied-string
Date: Sat, 24 Oct 2015 20:25:45 +0000	[thread overview]
Message-ID: <20151024202545.GC11372@tarsus.local2> (raw)
In-Reply-To: <20151022123057.GG7173@tarsus.local2>

Daniel Shahaf wrote on Thu, Oct 22, 2015 at 12:30:57 +0000:
> The format used is '${patchname} ${subject}', which is analogous to the
> git backend.
> ---
> This seems to work with both Debian and Fedora source packages.  In
> Debian the first line sometimes starts with "Description:" (DEP-3 format
> patches); perhaps that prefix should be removed, but for now I've erred
> on the side of conservatism and left the first line unmunged.

I've updated the patch to fix a few problems:

- Fix filtering of (---|Index:) — the condition was always false
- Don't leak error to terminal if the patch file doesn't exist
  (eg after 'quilt new')
- Add "?" as subject if the patch has none

Interdiff:

diff -u b/Functions/VCS_Info/VCS_INFO_quilt b/Functions/VCS_Info/VCS_INFO_quilt
--- b/Functions/VCS_Info/VCS_INFO_quilt
+++ b/Functions/VCS_Info/VCS_INFO_quilt
@@ -149,14 +149,28 @@
       () {
         local i line
         for ((i=1; i<=$#applied; i++)); do
-          read -r line < "$patches/$applied[$i]" &&
-          [[ line != (#b)(---|Index:) ]] &&
+          if [[ -f "$patches/$applied[$i]" ]] &&
+             read -r line < "$patches/$applied[$i]" &&
+             [[ $line != (#b)(---|Index:)* ]] &&
+             true
+            ;
+          then
             applied[$i]+=" $line"
+          else
+            applied[$i]+=" ?"
+          fi
         done
         for ((i=1; i<=$#unapplied; i++)); do
-          read -r line < "$patches/$unapplied[$i]" &&
-          [[ line != (#b)(---|Index:) ]] &&
+          if [[ -f "$patches/$unapplied[$i]" ]] &&
+             read -r line < "$patches/$unapplied[$i]" &&
+             [[ $line != (#b)(---|Index:)* ]] &&
+             true
+            ;
+          then
             unapplied[$i]+=" $line"
+          else
+            unapplied[$i]+=" ?"
+          fi
         done
       }
     fi


      reply	other threads:[~2015-10-24 20:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-22 12:30 Daniel Shahaf
2015-10-24 20:25 ` Daniel Shahaf [this message]

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=20151024202545.GC11372@tarsus.local2 \
    --to=d.s@daniel.shahaf.name \
    --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).