summary refs log tree commit diff
diff options
context:
space:
mode:
authorDaniel Hahler <git@thequod.de>2016-11-20 02:21:39 +0100
committerDaniel Hahler <git@thequod.de>2016-12-03 00:18:22 +0100
commitccf50048ac5bbef3f66164bd420d7c178ddd53ad (patch)
treeec119d4237b973e92b84a455858332f372275752
parent7b7e84f0815ed22a0ee348a217776529035dccf3 (diff)
downloadzsh-ccf50048ac5bbef3f66164bd420d7c178ddd53ad.tar.gz
zsh-ccf50048ac5bbef3f66164bd420d7c178ddd53ad.tar.xz
zsh-ccf50048ac5bbef3f66164bd420d7c178ddd53ad.zip
Get subject of current patch in rebase-apply mode
-rw-r--r--ChangeLog4
-rw-r--r--Functions/VCS_Info/Backends/VCS_INFO_get_data_git9
2 files changed, 13 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 39ef878c7..a09285607 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2016-12-03  Daniel Hahler  <zsh@thequod.de>
+	*  40029: Functions/VCS_Info/Backends/VCS_INFO_get_data_git:
+	Get subject of current patch in rebase-apply mode
+
 2016-12-02  Peter Stephenson  <p.w.stephenson@ntlworld.com>
 
 	* unposted: Config/version.mk: 5.2-test-1.
diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git
index 18ba89a9a..1560d7f27 100644
--- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git
+++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git
@@ -236,6 +236,15 @@ elif [[ -d "${gitdir}/rebase-apply" ]]; then
         done
         if [[ -f "${patchdir}/msg-clean" ]]; then
             subject="${$(< "${patchdir}/msg-clean")[(f)1]}"
+        elif [[ -f "${patchdir}/${(l:4::0:)cur}" ]]; then
+            local maxlines=10 line
+            while IFS= read -r line;  do
+                if [[ "$line" == "Subject:"* ]]; then
+                    subject=${line/(#s)Subject: /}
+                    break
+                fi
+                (( --maxlines )) || break
+            done < "${patchdir}/${(l:4::0:)cur}"
         fi
         if [[ -f "${patchdir}/original-commit" ]]; then
             if [[ -n $subject ]]; then