From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3078 invoked by alias); 30 Oct 2015 15:08:59 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 37025 Received: (qmail 7755 invoked from network); 30 Oct 2015 15:08:58 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.0 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= X-Sasl-enc: vgxOZTijJOPB4GYOr9IxrES5FQLjCfYPsx1FLRx+tTro 1446217736 Date: Fri, 30 Oct 2015 15:08:53 +0000 From: Daniel Shahaf To: zsh-workers@zsh.org Subject: [PATCH] vcs_info git: Add a cherry-pick patch-format Message-ID: <20151030150853.GC1462@tarsus.local2> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) --- 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