zsh-workers
 help / color / mirror / code / Atom feed
From: Daniel Shahaf <danielsh@apache.org>
To: zsh-workers@zsh.org
Subject: [PATCH 3/5] vcs_info quilt: Improve support for svn-style patch headers.
Date: Sat, 21 Dec 2019 15:58:26 +0000	[thread overview]
Message-ID: <20191221155828.25950-3-danielsh@apache.org> (raw)
In-Reply-To: <20191221155828.25950-1-danielsh@apache.org>

Additional lines between the |-separated header line and the actual
log message, as generated by 'svn log -v' and 'svn log -g', are now
supported.

This change affects you if you have quilt patches with 'svn log'-style
information in their headers, regardless of whether you use quilt
standalone, quilt over svn, or quilt over some other VCS.
---
 Functions/VCS_Info/VCS_INFO_patch2subject | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/Functions/VCS_Info/VCS_INFO_patch2subject b/Functions/VCS_Info/VCS_INFO_patch2subject
index a48c16b04..a467edcdb 100644
--- a/Functions/VCS_Info/VCS_INFO_patch2subject
+++ b/Functions/VCS_Info/VCS_INFO_patch2subject
@@ -14,10 +14,7 @@
             IFS= read -r "lines[$i]"
             if [[ -z ${lines[$i]} ]] || [[ ${lines[$i]} == (#b)(---[^-]|Index:)* ]]; then
                 lines[$i]=()
-                # For 'svn log -r N --diff' output, read the first paragraph too.
-                if ! [[ $lines[i-1] =~ $svn_log_pattern ]]; then
-                    break
-                fi
+                break
             fi
         done < "$1"
         
@@ -55,9 +52,18 @@
               fi
             } < "$1"
             REPLY=$needle
-        elif [[ $lines[2] =~ $svn_log_pattern ]]; then
-            REPLY=$lines[4]
-            if (( ${+lines[5]} )); then REPLY+='...'; fi
+        elif [[ $lines[1] =~ $svn_log_pattern ]] || [[ $lines[2] =~ $svn_log_pattern ]]; then
+            # Read up to the next blank line, and the first two lines after it.
+            integer multiline=0
+            {
+              while read -r needle; [[ -n $needle ]]; do done
+              # Read the first line of the second paragraph, which is the first
+              # line of the log message.
+              read -r needle
+              read -r && [[ -n $REPLY ]] && multiline=1
+            } < "$1"
+            REPLY=$needle
+            if (( multiline )); then REPLY+='...'; fi
         elif (( ${+lines[1]} )); then
             # The first line of the file is not part of the diff.
             REPLY=${lines[1]}

  parent reply	other threads:[~2019-12-21 21:05 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-21 15:58 [PATCH 1/5] vcs_info examples: Add an example of showing Git environment variables Daniel Shahaf
2019-12-21 15:58 ` [PATCH 2/5] vcs_info examples: Make the quilt-patch-dir example friendlier Daniel Shahaf
2019-12-21 15:58 ` Daniel Shahaf [this message]
2019-12-21 15:58 ` [PATCH 4/5] vcs_info docs: Clarify documentation of the %p/%u/%a patch-format expandos Daniel Shahaf
2019-12-21 15:58 ` [PATCH 5/5] zshmodules: Explicitly document the return values of the 'zstyle' getters -s, -b, and -a Daniel Shahaf

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=20191221155828.25950-3-danielsh@apache.org \
    --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).