From: Daniel Shahaf <danielsh@apache.org>
To: zsh-workers@zsh.org
Subject: [PATCH 2/3] vcs_info git: In non-interactive rebases, obtain applied patches' names.
Date: Thu, 12 Mar 2020 18:06:22 +0000 [thread overview]
Message-ID: <20200312180623.5751-2-danielsh@tarpaulin.shahaf.local2> (raw)
In-Reply-To: <20200312180623.5751-1-danielsh@tarpaulin.shahaf.local2>
---
.../VCS_Info/Backends/VCS_INFO_get_data_git | 22 ++++++++++++++-----
1 file changed, 17 insertions(+), 5 deletions(-)
diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git
index 6391cd1a6..4731c7400 100644
--- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git
+++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git
@@ -253,11 +253,23 @@ elif [[ -d "${gitdir}/rebase-apply" ]]; then
local cur=$(< $next)
local p subject
# Fake patch names for patches "before" the current patch
- #
- # Note: With git 2.24, (( cur == 1 )), so the loop body never runs.
- for ((p = 1; p < cur; p++)); do
- printf -v "git_patches_applied[$p]" "%04d ?" "$p"
- done
+ if [[ -r ${patchdir}/rewritten ]]; then
+ if zstyle -t ":vcs_info:${vcs}:${usercontext}:${rrn}" use-simple; then
+ git_patches_applied=( ${${(f)"$(<${patchdir}/rewritten)"}// */' ?'} )
+ else
+ git_patches_applied=(
+ ${(f)"$(${vcs_comm[cmd]} log --no-walk=unsorted --pretty='%h %s' ${${(f)"$(<${patchdir}/rewritten)"}%% *} --)"}
+ )
+ fi
+ else
+ # Compatibility with old git. In 2.11 and 2.24, at least,
+ # (( cur == 1 )), so the loop body would never run. However, both
+ # 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"
+ done
+ fi
# Set $subject to the info for the current patch
if [[ -f "${patchdir}/msg-clean" ]]; then
subject="${$(< "${patchdir}/msg-clean")[(f)1]}"
next prev parent reply other threads:[~2020-03-12 18:07 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-12 18:06 [PATCH 1/3] vcs_info git: In non-interactive rebases, compute patch names for unapplied patches Daniel Shahaf
2020-03-12 18:06 ` Daniel Shahaf [this message]
2020-03-12 18:06 ` [PATCH 3/3] internal: vcs_info git: Add a test case repository for rebase-apply situations Daniel Shahaf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200312180623.5751-2-danielsh@tarpaulin.shahaf.local2 \
--to=danielsh@apache.org \
--cc=zsh-workers@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).