1
0
mirror of git://git.code.sf.net/p/zsh/code synced 2024-09-28 15:01:21 +02:00

45539: vcs_info git: In non-interactive rebases, obtain applied patches' names.

This commit is contained in:
Daniel Shahaf 2020-03-12 18:06:22 +00:00
parent e1946bacf8
commit 4ce4483daf
2 changed files with 21 additions and 5 deletions

@ -1,5 +1,9 @@
2020-03-15 Daniel Shahaf <danielsh@apache.org>
* 45539: Functions/VCS_Info/Backends/VCS_INFO_get_data_git:
vcs_info git: In non-interactive rebases, obtain applied
patches' names.
* 45540: Doc/Zsh/contrib.yo,
Functions/VCS_Info/Backends/VCS_INFO_get_data_git: vcs_info git:
In non-interactive rebases, compute patch names for unapplied

@ -266,11 +266,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]}"