Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
[PATCH] vcs_info git: Add a cherry-pick patch-format
- X-seq: zsh-workers 37025
- From: Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: [PATCH] vcs_info git: Add a cherry-pick patch-format
- Date: Fri, 30 Oct 2015 15:08:53 +0000
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= daniel.shahaf.name; h=content-type:date:from:message-id :mime-version:subject:to:x-sasl-enc:x-sasl-enc; s=mesmtp; bh=guW 3VLLV6aroh8NkKzTbV6Flq/Y=; b=mk7T4k2jejYgv9tB2ske5tGmMnkmKJ26Xjv Syyf0hzihJuWmEOkK6QGLUPgFF6WzIF+PB25zYwzh6A4/ZkcnZWvTfjjSWfUaGFw 8IOS0Vezn6PfmYQH2XEaG/IT1qiOdpHbj5deaYYNO02r32ydEdDe/ij1mY98J3lQ eHM790ps=
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=content-type:date:from:message-id :mime-version:subject:to:x-sasl-enc:x-sasl-enc; s=smtpout; bh=gu W3VLLV6aroh8NkKzTbV6Flq/Y=; b=E7f8PmyZLCVpBHEG4skwgdcUgB7WZIvPWg HbvGNTGzFlJJOdUq+y1Fj+Z6zum5wr7ZS9F2PvNP0vr+4LYdOeZBRLG9OX0S8REW /t5Q1lST5qumwNSrTYh4MjUo6Xso3BCCwgTGvYgtDa+hkeSTlkTWfffGYXZUJjN2 vTofKhaFI=
- 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
---
Connect a 'git cherry-pick' that conflicted to patch-format.
Git doesn't make available as much information as we'd like, but I still
think this is useful.
diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git
index fcee47c..704c189 100644
--- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git
+++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git
@@ -267,6 +267,28 @@ elif [[ -f "${gitdir}/MERGE_HEAD" ]]; then
# Not touching git_patches_unapplied
VCS_INFO_git_handle_patches
+elif [[ -f "${gitdir}/CHERRY_PICK_HEAD" ]]; then
+ # 'git cherry-pick' without -n, that conflicted. (With -n, git doesn't
+ # record the CHERRY_PICK_HEAD information anywhere, as of git 2.6.2.)
+ #
+ # ### 'git cherry-pick foo bar baz' only records the "remaining" part of
+ # ### the queue in the .git dir: if 'bar' has a conflict, the .git dir
+ # ### has a record of 'baz' being queued, but no record of 'foo' having been
+ # ### part of the queue as well. Therefore, the %n/%c applied/unapplied
+ # ### expandos will be memoryless: the "applied" counter will always
+ # ### 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
+ IFS='' read -r subject < "${gitdir}/MERGE_MSG"
+ git_patches_applied=( "$(<${gitdir}/CHERRY_PICK_HEAD) ${subject}" )
+ if [[ -f "${gitdir}/sequencer/todo" ]]; then
+ # Get the next patches, and remove the one that's in CHERRY_PICK_HEAD.
+ git_patches_unapplied=( ${${(M)${(f)"$(<"${gitdir}/sequencer/todo")"}:#pick *}#pick } )
+ git_patches_unapplied[1]=()
+ else
+ git_patches_unapplied=()
+ fi
+ VCS_INFO_git_handle_patches
else
gitmisc=''
fi
Messages sorted by:
Reverse Date,
Date,
Thread,
Author