about summary refs log tree commit diff
path: root/Functions
diff options
context:
space:
mode:
authorDaniel Shahaf <danielsh@apache.org>2019-12-21 15:58:26 +0000
committerDaniel Shahaf <danielsh@apache.org>2019-12-22 03:21:03 +0000
commit86db36ab705ea8225807b00b24b0c7df4033cbc6 (patch)
tree379eafd57af4c8fb454bb033e23af8a27bc4e968 /Functions
parent41e35185895ba33bf08cf93809bbe5955f81993a (diff)
downloadzsh-86db36ab705ea8225807b00b24b0c7df4033cbc6.tar.gz
zsh-86db36ab705ea8225807b00b24b0c7df4033cbc6.tar.xz
zsh-86db36ab705ea8225807b00b24b0c7df4033cbc6.zip
45114: vcs_info quilt: Improve support for svn-style patch headers.
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.
Diffstat (limited to 'Functions')
-rw-r--r--Functions/VCS_Info/VCS_INFO_patch2subject20
1 files 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]}