summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Shahaf <d.s@daniel.shahaf.name>2015-10-30 15:08:53 +0000
committerDaniel Shahaf <d.s@daniel.shahaf.name>2015-11-13 20:17:27 +0000
commitf59864ce7a4a18efbfa5a330895d120ea1ce18f2 (patch)
treef0522d7543c5368cbdda568f63664009ea4237b8
parentd5ba08af4933fdef596f5151b3e903868d352f65 (diff)
downloadzsh-f59864ce7a4a18efbfa5a330895d120ea1ce18f2.tar.gz
zsh-f59864ce7a4a18efbfa5a330895d120ea1ce18f2.zip
37025: vcs_info git: Add a cherry-pick patch-format
-rw-r--r--ChangeLog5
-rw-r--r--Functions/VCS_Info/Backends/VCS_INFO_get_data_git22
2 files changed, 27 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 46bb02f48..f314e82f4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2015-11-13 Daniel Shahaf <d.s@daniel.shahaf.name>
+
+ * 37025: Functions/VCS_Info/Backends/VCS_INFO_get_data_git:
+ vcs_info git: Add a cherry-pick patch-format
+
2015-11-13 Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>
* 37090: Doc/zman.yo, Doc/ztexi.yo: handle blank lines correctly
diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git
index fcee47c13..704c1890e 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