1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-10-23 04:30:24 +02:00

37025: vcs_info git: Add a cherry-pick patch-format

This commit is contained in:
Daniel Shahaf 2015-10-30 15:08:53 +00:00
parent d5ba08af49
commit f59864ce7a
2 changed files with 27 additions and 0 deletions

View file

@ -266,6 +266,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=''