* [PATCH 1/4] vcs_info: Don't redefine helper functions on every execution of the autoloadable outer function.
@ 2018-10-07 17:46 Daniel Shahaf
2018-10-07 17:46 ` [PATCH 2/4] vcs_info git: In non-interactive rebases, always set $hook_com[git_patches_applied] to a string of the form 'foo bar', never just 'foo' Daniel Shahaf
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Daniel Shahaf @ 2018-10-07 17:46 UTC (permalink / raw)
To: zsh-workers
This allows enabling tracing of the helper functions without fned'ing
the outer function.
---
Functions/VCS_Info/Backends/VCS_INFO_detect_p4 | 2 ++
Functions/VCS_Info/Backends/VCS_INFO_get_data_bzr | 3 +++
Functions/VCS_Info/Backends/VCS_INFO_get_data_git | 3 +++
Functions/VCS_Info/VCS_INFO_quilt | 7 +++++--
4 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/Functions/VCS_Info/Backends/VCS_INFO_detect_p4 b/Functions/VCS_Info/Backends/VCS_INFO_detect_p4
index 95a534786..d171c68ee 100644
--- a/Functions/VCS_Info/Backends/VCS_INFO_detect_p4
+++ b/Functions/VCS_Info/Backends/VCS_INFO_detect_p4
@@ -16,6 +16,7 @@
# of having such files in all client root directories and nowhere above.
+(( ${+functions[VCS_INFO_p4_get_server]} )) ||
VCS_INFO_p4_get_server() {
emulate -L zsh
setopt extendedglob
@@ -43,6 +44,7 @@ VCS_INFO_p4_get_server() {
}
+(( ${+functions[VCS_INFO_detect_p4]} )) ||
VCS_INFO_detect_p4() {
local serverport p4where
diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_bzr b/Functions/VCS_Info/Backends/VCS_INFO_get_data_bzr
index 705db65a7..b30e0e12b 100644
--- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_bzr
+++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_bzr
@@ -8,6 +8,7 @@ local bzrbase bzrbr bzr_changes bzr_type
local -a bzrinfo
local -A hook_com bzr_info
+(( ${+functions[VCS_INFO_bzr_get_info]} )) ||
VCS_INFO_bzr_get_info() {
bzrinfo=( ${(s.:.)$( ${vcs_comm[cmd]} version-info --custom \
--template="{revno}:{branch_nick}:{clean}")} )
@@ -20,6 +21,7 @@ VCS_INFO_bzr_get_info() {
fi
}
+(( ${+functions[VCS_INFO_bzr_get_info_restricted]} )) ||
VCS_INFO_bzr_get_info_restricted() {
# we are forbidden from fetching info on bound branch from remote repository
bzrinfo=( $(${vcs_comm[cmd]} revno) ${bzrbase:t} )
@@ -30,6 +32,7 @@ VCS_INFO_bzr_get_info_restricted() {
fi
}
+(( ${+functions[VCS_INFO_bzr_get_changes]} )) ||
VCS_INFO_bzr_get_changes() {
local -A counts
local line flag
diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git
index 04d15bb4a..0050f613a 100644
--- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git
+++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git
@@ -8,6 +8,7 @@ local -i querystaged queryunstaged
local -a git_patches_applied git_patches_unapplied
local -A hook_com
+(( ${+functions[VCS_INFO_git_getaction]} )) ||
VCS_INFO_git_getaction () {
local gitdir=$1
local tmp
@@ -70,6 +71,7 @@ VCS_INFO_git_getaction () {
return 1
}
+(( ${+functions[VCS_INFO_git_getbranch]} )) ||
VCS_INFO_git_getbranch () {
local gitdir=$1 tmp actiondir
local gitsymref="${vcs_comm[cmd]} symbolic-ref HEAD"
@@ -118,6 +120,7 @@ VCS_INFO_git_getbranch () {
return 0
}
+(( ${+functions[VCS_INFO_git_handle_patches]} )) ||
VCS_INFO_git_handle_patches () {
local git_applied_s git_unapplied_s gitmsg
git_patches_applied=(${(Oa)git_patches_applied})
diff --git a/Functions/VCS_Info/VCS_INFO_quilt b/Functions/VCS_Info/VCS_INFO_quilt
index 381b58489..1f20e895d 100644
--- a/Functions/VCS_Info/VCS_INFO_quilt
+++ b/Functions/VCS_Info/VCS_INFO_quilt
@@ -1,5 +1,6 @@
## vim:ft=zsh:foldmethod=marker
+(( ${+functions[VCS_INFO_quilt-match]} )) ||
function VCS_INFO_quilt-match() {
emulate -L zsh
setopt extendedglob
@@ -20,6 +21,7 @@ function VCS_INFO_quilt-match() {
return 1
}
+(( ${+functions[VCS_INFO_quilt-standalone-detect]} )) ||
function VCS_INFO_quilt-standalone-detect() {
emulate -L zsh
setopt extendedglob
@@ -58,6 +60,7 @@ function VCS_INFO_quilt-standalone-detect() {
return 1
}
+(( ${+functions[VCS_INFO_quilt-dirfind]} )) ||
function VCS_INFO_quilt-dirfind() {
# This is a wrapper around VCS_INFO_bydir_detect(). It makes sure
# that $vcs_comm[] is unchanged. Currently, changing anything in it
@@ -80,11 +83,12 @@ function VCS_INFO_quilt-dirfind() {
return ${ret}
}
+(( ${+functions[VCS_INFO_quilt-patch2subject]} )) ||
function VCS_INFO_quilt-patch2subject() {
VCS_INFO_patch2subject "$@"
}
-function VCS_INFO_quilt() {
+{
emulate -L zsh
setopt extendedglob
local mode="$1"
@@ -192,4 +196,3 @@ function VCS_INFO_quilt() {
VCS_INFO_hook 'post-quilt' ${mode} ${patches} ${pc:-\\-nopc-}
}
-VCS_INFO_quilt "$@"
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 2/4] vcs_info git: In non-interactive rebases, always set $hook_com[git_patches_applied] to a string of the form 'foo bar', never just 'foo'.
2018-10-07 17:46 [PATCH 1/4] vcs_info: Don't redefine helper functions on every execution of the autoloadable outer function Daniel Shahaf
@ 2018-10-07 17:46 ` Daniel Shahaf
2018-10-07 17:46 ` [PATCH 3/4] vcs_info git: During a non-interactive rebase of a detached head, computer the %b expando correctly Daniel Shahaf
2018-10-07 17:46 ` [PATCH 4/4] vcs_info git: Reverse the order patches are passed to gen-unapplied-string in Daniel Shahaf
2 siblings, 0 replies; 4+ messages in thread
From: Daniel Shahaf @ 2018-10-07 17:46 UTC (permalink / raw)
To: zsh-workers
---
Functions/VCS_Info/Backends/VCS_INFO_get_data_git | 13 +++----------
1 file changed, 3 insertions(+), 10 deletions(-)
diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git
index 0050f613a..cd57902b6 100644
--- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git
+++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git
@@ -260,18 +260,11 @@ elif [[ -d "${gitdir}/rebase-apply" ]]; then
subject=$REPLY
}
fi
+ subject=${subject:-'?'}
if [[ -f "${patchdir}/original-commit" ]]; then
- if [[ -n $subject ]]; then
- git_patches_applied+=("$(< ${patchdir}/original-commit) $subject")
- else
- git_patches_applied+=("$(< ${patchdir}/original-commit)")
- fi
+ git_patches_applied+=("$(< ${patchdir}/original-commit) $subject")
else
- if [[ -n $subject ]]; then
- git_patches_applied+=("? $subject")
- else
- git_patches_applied+=("?")
- fi
+ git_patches_applied+=("? $subject")
fi
local last="$(< "${patchdir}/last")"
if (( cur+1 <= last )); then
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 3/4] vcs_info git: During a non-interactive rebase of a detached head, computer the %b expando correctly.
2018-10-07 17:46 [PATCH 1/4] vcs_info: Don't redefine helper functions on every execution of the autoloadable outer function Daniel Shahaf
2018-10-07 17:46 ` [PATCH 2/4] vcs_info git: In non-interactive rebases, always set $hook_com[git_patches_applied] to a string of the form 'foo bar', never just 'foo' Daniel Shahaf
@ 2018-10-07 17:46 ` Daniel Shahaf
2018-10-07 17:46 ` [PATCH 4/4] vcs_info git: Reverse the order patches are passed to gen-unapplied-string in Daniel Shahaf
2 siblings, 0 replies; 4+ messages in thread
From: Daniel Shahaf @ 2018-10-07 17:46 UTC (permalink / raw)
To: zsh-workers
Before this commit, the value of %b was the hash of the commit from the
"source" side of the rebase, from .git/rebase-apply/orig-head and
.git/rebase-apply/original-commit. This broke the invariant that
%b expands to a git-rev-parse(1) expression resolving to what %r
expands to.
Use .git/rebase-apply/onto instead as, empirically, it contains the
correct value.
---
Functions/VCS_Info/Backends/VCS_INFO_get_data_git | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git
index cd57902b6..8305cf41a 100644
--- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git
+++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git
@@ -90,7 +90,7 @@ VCS_INFO_git_getbranch () {
[[ -z ${gitbranch} ]] && [[ -r ${actiondir}/head-name ]] \
&& gitbranch="$(< ${actiondir}/head-name)"
[[ -z ${gitbranch} || ${gitbranch} == 'detached HEAD' ]] \
- && gitbranch="$(< ${gitdir}/ORIG_HEAD)"
+ && gitbranch="$(< ${actiondir}/onto)"
elif [[ -f "${gitdir}/MERGE_HEAD" ]] ; then
gitbranch="$(${(z)gitsymref} 2> /dev/null)"
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 4/4] vcs_info git: Reverse the order patches are passed to gen-unapplied-string in.
2018-10-07 17:46 [PATCH 1/4] vcs_info: Don't redefine helper functions on every execution of the autoloadable outer function Daniel Shahaf
2018-10-07 17:46 ` [PATCH 2/4] vcs_info git: In non-interactive rebases, always set $hook_com[git_patches_applied] to a string of the form 'foo bar', never just 'foo' Daniel Shahaf
2018-10-07 17:46 ` [PATCH 3/4] vcs_info git: During a non-interactive rebase of a detached head, computer the %b expando correctly Daniel Shahaf
@ 2018-10-07 17:46 ` Daniel Shahaf
2 siblings, 0 replies; 4+ messages in thread
From: Daniel Shahaf @ 2018-10-07 17:46 UTC (permalink / raw)
To: zsh-workers
This is an incompatible change; see README for details.
---
Doc/Zsh/contrib.yo | 2 +-
Functions/VCS_Info/Backends/VCS_INFO_get_data_git | 4 +++-
Functions/VCS_Info/VCS_INFO_set-patch-format | 2 ++
README | 9 ++++++++-
4 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/Doc/Zsh/contrib.yo b/Doc/Zsh/contrib.yo
index 9e4e6bc8f..d32ba018d 100644
--- a/Doc/Zsh/contrib.yo
+++ b/Doc/Zsh/contrib.yo
@@ -1668,7 +1668,7 @@ tt(mq)) backend and in tt(quilt) support when the tt(unapplied-string) is
generated; the tt(get-unapplied) style must be true.
This hook gets the names of all unapplied patches which tt(vcs_info)
-collected so far in the opposite order, which means that the first argument is
+collected so far in order, which means that the first argument is
the patch next-in-line to be applied and so forth.
When setting tt(ret) to non-zero, the string in
diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git
index 8305cf41a..a5cd5d861 100644
--- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git
+++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git
@@ -123,8 +123,10 @@ VCS_INFO_git_getbranch () {
(( ${+functions[VCS_INFO_git_handle_patches]} )) ||
VCS_INFO_git_handle_patches () {
local git_applied_s git_unapplied_s gitmsg
+ # All callers populate $git_patches_applied and $git_patches_unapplied in
+ # order, but the hook requires us to reverse $git_patches_applied.
git_patches_applied=(${(Oa)git_patches_applied})
- git_patches_unapplied=(${(Oa)git_patches_unapplied})
+ typeset -p1 git_patches_unapplied
VCS_INFO_set-patch-format 'git_patches_applied' 'git_applied_s' \
'git_patches_unapplied' 'git_unapplied_s' \
diff --git a/Functions/VCS_Info/VCS_INFO_set-patch-format b/Functions/VCS_Info/VCS_INFO_set-patch-format
index cdf2d303e..917ebf6bf 100644
--- a/Functions/VCS_Info/VCS_INFO_set-patch-format
+++ b/Functions/VCS_Info/VCS_INFO_set-patch-format
@@ -3,8 +3,10 @@
#
# Parameters:
# $1 - name of an array parameter to be the argument to gen-applied-string
+# (patches in reverse order)
# $2 - name of a parameter to store the applied-string in
# $3 - name of an array parameter to be the argument to gen-unapplied-string
+# (patches in order)
# $4 - name of a parameter to store the unapplied-string in
# $5 - context argument for use in zstyle getters
# $6 - name of a parameter to store a patch-format format string in
diff --git a/README b/README
index c792d4075..bff59a468 100644
--- a/README
+++ b/README
@@ -10,7 +10,7 @@ This is version 5.6.2 of the shell. This is a bugfix release, following
release.
Note in particular the changes highlighted under "Incompatibilities since
-5.5.1" below. See NEWS for more information.
+5.6.2" below. See NEWS for more information.
Installing Zsh
--------------
@@ -31,6 +31,13 @@ Zsh is a shell with lots of features. For a list of some of these, see the
file FEATURES, and for the latest changes see NEWS. For more
details, see the documentation.
+Incompatibilities since 5.6.2
+-----------------------------
+
+vcs_info git: The gen-unapplied-string hook receives the patches in order (next
+to be applied first). This is consistent with the hg backend and with one of
+two contradictory claims in the documentation (the other one has been corrected).
+
Incompatibilities since 5.5.1
-----------------------------
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-10-07 17:48 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-07 17:46 [PATCH 1/4] vcs_info: Don't redefine helper functions on every execution of the autoloadable outer function Daniel Shahaf
2018-10-07 17:46 ` [PATCH 2/4] vcs_info git: In non-interactive rebases, always set $hook_com[git_patches_applied] to a string of the form 'foo bar', never just 'foo' Daniel Shahaf
2018-10-07 17:46 ` [PATCH 3/4] vcs_info git: During a non-interactive rebase of a detached head, computer the %b expando correctly Daniel Shahaf
2018-10-07 17:46 ` [PATCH 4/4] vcs_info git: Reverse the order patches are passed to gen-unapplied-string in Daniel Shahaf
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).