Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
[PATCH] vcs_info git: rfc822-unfold rebase-apply patch subjects when msg-clean is unavailable.
- X-seq: zsh-workers 40074
- From: Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: [PATCH] vcs_info git: rfc822-unfold rebase-apply patch subjects when msg-clean is unavailable.
- Date: Sat,  3 Dec 2016 10:34:46 +0000
- Cc: Daniel Hahler <genml+zsh-workers@xxxxxxxxxx>
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=	daniel.shahaf.name; h=cc:date:from:in-reply-to:message-id	:references:subject:to:x-me-sender:x-me-sender:x-sasl-enc	:x-sasl-enc; s=mesmtp; bh=ZCV2vwNx60ghBYibBuIDCG3Zuio=; b=XGmAUv	oK/iH1FG3D4Bcx/RP9M3UYsG0iBK6mxRDIRpJH9lLjSfmQbQSdDyngFVf04VsKaL	beuVd0i4z633dAt0soYM/L/HywH9Esu/sSklwwfgNpi/bNhzRu+09V+pMiN++9bI	M8LdC4pE84KvxmLwRK28+UfjnSlka6EHNIBXA=
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=	messagingengine.com; h=cc:date:from:in-reply-to:message-id	:references:subject:to:x-me-sender:x-me-sender:x-sasl-enc	:x-sasl-enc; s=smtpout; bh=ZCV2vwNx60ghBYibBuIDCG3Zuio=; b=Ml1bx	VVgl0Gfq1T3+5vyFHwseQIYGC4brTmv/PtQNb7NzpPaULKfUk65a0RIeT6AAdcsL	UBX4sNaBbg7mLHoPJX7HzIdAxMmLD4TKQN3NqNOUXlnhZcSsW3BIZpHJhIiYeUiT	iwHodyaidbgS98zK+5e31kMqypKYzgvMCWmzjw=
- In-reply-to: <c5a88588-1928-4b42-bbe0-de5cdcec7630@thequod.de>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <c5a88588-1928-4b42-bbe0-de5cdcec7630@thequod.de>
Example (in this repository):
    git -c merge.merge-changelog.driver=/bin/false rebase --onto=1955cce^^  1955cce^ 1955cce
---
I think this patch covers all the "other places" Daniel referred to.
Daniel
 Functions/VCS_Info/Backends/VCS_INFO_get_data_git | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git
index 1560d7f..a92261f 100644
--- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git
+++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git
@@ -237,14 +237,11 @@ elif [[ -d "${gitdir}/rebase-apply" ]]; then
         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}"
+            () {
+              local REPLY
+              VCS_INFO_patch2subject "${patchdir}/${(l:4::0:)cur}"
+              subject=$REPLY
+            }
         fi
         if [[ -f "${patchdir}/original-commit" ]]; then
             if [[ -n $subject ]]; then
@@ -270,6 +267,7 @@ elif [[ -f "${gitdir}/MERGE_HEAD" ]]; then
     # This is 'git merge --no-commit'
     local -a heads=( ${(@f)"$(<"${gitdir}/MERGE_HEAD")"} )
     local subject;
+    # TODO: maybe read up to the first blank line
     IFS='' read -r subject < "${gitdir}/MERGE_MSG"
     # $subject is the subject line of the would-be commit
     # Maybe we can get the subject lines of MERGE_HEAD's commits cheaply?
@@ -295,6 +293,7 @@ elif [[ -f "${gitdir}/CHERRY_PICK_HEAD" ]]; then
     # ### be "1".  The %u/%c tuple will assume the values [(1,2), (1,1), (1,0)],
     # ### whereas the correct sequence would be [(1,2), (2,1), (3,0)].
     local subject
+    # TODO: maybe read up to the first blank line
     IFS='' read -r subject < "${gitdir}/MERGE_MSG"
     git_patches_applied=( "$(<${gitdir}/CHERRY_PICK_HEAD) ${subject}" )
     if [[ -f "${gitdir}/sequencer/todo" ]]; then
Messages sorted by:
Reverse Date,
Date,
Thread,
Author