summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--Functions/VCS_Info/Backends/VCS_INFO_get_data_git22
2 files changed, 21 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index edf814dd9..92d37809e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git
index 97a04b6ce..2b1e9afca 100644
--- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git
+++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git
@@ -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]}"