diff options
author | Axel Beckert <abe@deuxchevaux.org> | 2017-09-12 23:22:34 +0200 |
---|---|---|
committer | Axel Beckert <abe@deuxchevaux.org> | 2017-09-12 23:22:34 +0200 |
commit | 4aaf06e6678dcead65d7226bd6bde3cffeb2cb2e (patch) | |
tree | 5c8e2ac2c9a85e2e6568aed7120372e6efa074ac /Functions/VCS_Info/VCS_INFO_patch2subject | |
parent | f33de64abf57611e59df72da230f3d0d6760c4c5 (diff) | |
parent | 6ff4787e830f8edb3a7e32490a88a131e4b62f7f (diff) | |
download | zsh-4aaf06e6678dcead65d7226bd6bde3cffeb2cb2e.tar.gz zsh-4aaf06e6678dcead65d7226bd6bde3cffeb2cb2e.zip |
Merge tag 'zsh-5.4.2' into debian
Release 5.4.2
Diffstat (limited to 'Functions/VCS_Info/VCS_INFO_patch2subject')
-rw-r--r-- | Functions/VCS_Info/VCS_INFO_patch2subject | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/Functions/VCS_Info/VCS_INFO_patch2subject b/Functions/VCS_Info/VCS_INFO_patch2subject index e222e8382..a48c16b04 100644 --- a/Functions/VCS_Info/VCS_INFO_patch2subject +++ b/Functions/VCS_Info/VCS_INFO_patch2subject @@ -6,14 +6,18 @@ integer -r LIMIT=10 local -a lines local needle + readonly svn_log_pattern='^r[0-9]* [|] .*' if [[ -f "$1" ]]; then # Extract the first LIMIT lines, or up to the first empty line or the start of the unidiffs, # whichever comes first. while (( i++ < LIMIT )); do IFS= read -r "lines[$i]" - if [[ -z ${lines[$i]} ]] || [[ ${lines[$i]} == (#b)(---|Index:)* ]]; then + if [[ -z ${lines[$i]} ]] || [[ ${lines[$i]} == (#b)(---[^-]|Index:)* ]]; then lines[$i]=() - break + # For 'svn log -r N --diff' output, read the first paragraph too. + if ! [[ $lines[i-1] =~ $svn_log_pattern ]]; then + break + fi fi done < "$1" @@ -51,6 +55,9 @@ fi } < "$1" REPLY=$needle + elif [[ $lines[2] =~ $svn_log_pattern ]]; then + REPLY=$lines[4] + if (( ${+lines[5]} )); then REPLY+='...'; fi elif (( ${+lines[1]} )); then # The first line of the file is not part of the diff. REPLY=${lines[1]} |