From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5733 invoked by alias); 3 Sep 2015 09:24:30 -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: 36410 Received: (qmail 24649 invoked from network); 3 Sep 2015 09:24:28 -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=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU 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=/yO CSm10HJ4pyG4WURGjosVPHjI=; b=uEnQyNW80dYG7jAMyUWNEqRYrf4syIfFyqH AfMz0cZ8Oy/tLq92CGx40qddrD9mVLAKepVxhdtbgKc+SjqaG4k7hQ/msDDps+6i 6WZVAYEOXc4lISLLpM0Vnd0cTGEn3vkMjt+lFvhvc4joAxJV1HxoKPsMAIBMUJeT kVOlqhCc= 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=/y OCSm10HJ4pyG4WURGjosVPHjI=; b=In8HV2HLuMn7lizu/wD6qdgUNzLDi8fzIS V+b7dJxiJVN6aGmOj5Ye+Esj3qvD0bYqvD4j1o25sZ+ki9rHU2NcRNPWTDyUWCaF 6DZPbW9cBt+/G+0s67Y+CEtkdaMPBTUZN/b5Y1Z/4DoZOZTDCtOUEJI2p8Tjvf0E U4D82iH2s= X-Sasl-enc: LfF0ZfcXtQ+biSkQ1h8TCooiSuyyYv+vF08kNktBNZ0e 1441272263 Date: Thu, 3 Sep 2015 09:24:16 +0000 From: Daniel Shahaf To: zsh-workers@zsh.org Subject: [PATCH] vcs_info git: Present merge heads as patches Message-ID: <20150903092416.GA11852@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) This shows, during 'git merge', the revision hashes of the "remote" head (the one that will become second parent of the commit) in the %m expando. --- Doc/Zsh/contrib.yo | 2 +- Functions/VCS_Info/Backends/VCS_INFO_get_data_git | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/Doc/Zsh/contrib.yo b/Doc/Zsh/contrib.yo index db0940d..741d4ad 100644 --- a/Doc/Zsh/contrib.yo +++ b/Doc/Zsh/contrib.yo @@ -1339,7 +1339,7 @@ tt(formats) and tt(actionformats) and will be available in the global tt(backend_misc) array as tt(${backend_misc[bookmarks]}). ) item(tt(gen-applied-string))( -Called in the tt(git) (with tt(stgit) or during rebase), and tt(hg) +Called in the tt(git) (with tt(stgit) or during rebase or merge), and tt(hg) (with tt(mq)) backends and in tt(quilt) support when the tt(applied-string) is generated; the tt(use-quilt) zstyle must be true for tt(quilt) (the tt(mq) and tt(stgit) backends are active by default). diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git index 3fc861e..5c136d6 100644 --- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git +++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git @@ -231,6 +231,23 @@ elif [[ -d "${gitdir}/rebase-apply" ]]; then git_patches_unapplied=($(seq $cur $(< "${patchdir}/last"))) VCS_INFO_git_handle_patches +elif [[ -f "${gitdir}/MERGE_HEAD" ]]; then + # This is 'git merge --no-commit' + local -a heads=( ${(@f)"$(<"${gitdir}/MERGE_HEAD")"} ) + local subject; + 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? + + local p + for p in $heads[@]; do + git_patches_applied+=("$p $subject") + done + unset p + + # Not touching git_patches_unapplied + + VCS_INFO_git_handle_patches else gitmisc='' fi -- 2.1.4