From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=0.3 required=5.0 tests=MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE,RDNS_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 Received: (qmail 9235 invoked from network); 26 Mar 2020 02:44:39 -0000 Received-SPF: pass (primenet.com.au: domain of zsh.org designates 203.24.36.2 as permitted sender) receiver=inbox.vuxu.org; client-ip=203.24.36.2 envelope-from= Received: from unknown (HELO primenet.com.au) (203.24.36.2) by inbox.vuxu.org with ESMTP; 26 Mar 2020 02:44:39 -0000 Received: (qmail 24810 invoked by alias); 26 Mar 2020 02:44:27 -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: List-Unsubscribe: X-Seq: 45627 Received: (qmail 15041 invoked by uid 1010); 26 Mar 2020 02:44:27 -0000 X-Qmail-Scanner-Diagnostics: from out5-smtp.messagingengine.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.102.2/25758. spamassassin: 3.4.2. Clear:RC:0(66.111.4.29):SA:0(-2.6/5.0):. Processed in 5.150965 secs); 26 Mar 2020 02:44:27 -0000 X-Envelope-From: d.s@daniel.shahaf.name X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: none (ns1.primenet.com.au: domain at daniel.shahaf.name does not designate permitted sender hosts) X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedugedrudehhedggeejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvffufffkofggtgfgsehtkedttd ertdejnecuhfhrohhmpeffrghnihgvlhcuufhhrghhrghfuceougdrshesuggrnhhivghl rdhshhgrhhgrfhdrnhgrmhgvqeenucfkphepjeelrddujeeirdduvdehrddvfedvnecuve hluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepugdrshesuggr nhhivghlrdhshhgrhhgrfhdrnhgrmhgv X-ME-Proxy: From: Daniel Shahaf To: zsh-workers@zsh.org Subject: [PATCH] vcs_info git: Under git-am(1) conflicts, pass to the gen-applied-string hook information on already-applied patches. Date: Thu, 26 Mar 2020 02:43:41 +0000 Message-Id: <20200326024341.22427-1-danielsh@tarpaulin.shahaf.local2> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The hook already receives information about the current (topmost applied) patch and, if the get-unapplied style is set, about future (unapplied) patches. Tested in the Functions/VCS_Info/test-repo-git-rebase-apply scenario, after manually converting the rebase to a «git am». (Specifically, I ran: mkdir d git rebase --abort git format-patch rebase_from_this..HEAD -o d git checkout rebase_onto_this git am d/* .) --- Functions/VCS_Info/Backends/VCS_INFO_get_data_git | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git index 2b1e9afca..2b2040c94 100644 --- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git +++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git @@ -258,14 +258,14 @@ elif [[ -d "${gitdir}/rebase-merge" ]]; then fi VCS_INFO_git_handle_patches elif [[ -d "${gitdir}/rebase-apply" ]]; then - # 'git rebase' without -i + # 'git rebase' without -i, or 'git am' patchdir="${gitdir}/rebase-apply" local next="${patchdir}/next" local this_patch_file if [[ -f $next ]]; then local cur=$(< $next) local p subject - # Fake patch names for patches "before" the current patch + # Compute patch names for patches "before" the current patch if [[ -r ${patchdir}/rewritten ]]; then if zstyle -t ":vcs_info:${vcs}:${usercontext}:${rrn}" use-simple; then git_patches_applied=( ${${(f)"$(<${patchdir}/rewritten)"}// */' ?'} ) @@ -280,7 +280,13 @@ elif [[ -d "${gitdir}/rebase-apply" ]]; then # of these versions have original-commit and orig-head and would # take the 'if' branch, rather than this 'else' branch. for ((p = 1; p < cur; p++)); do - printf -v "git_patches_applied[$p]" "%04d ?" "$p" + printf -v this_patch_file "%s/%04d" "${patchdir}" "${p}" + if [[ -f $this_patch_file ]]; then + VCS_INFO_patch2subject "${this_patch_file}" + git_patches_applied+=( "$p $REPLY" ) + else + git_patches_applied+=( "$p ?" ) + fi done fi # Set $subject to the info for the current patch @@ -298,6 +304,8 @@ elif [[ -d "${gitdir}/rebase-apply" ]]; then subject=${subject:-'?'} if [[ -f "${patchdir}/original-commit" ]]; then git_patches_applied+=("$(< ${patchdir}/original-commit) $subject") + elif [[ -f "${patchdir}/next" ]]; then + git_patches_applied+=("$(< ${patchdir}/next) $subject") else git_patches_applied+=("? $subject") fi