Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

[PATCH] Remove StGit patch detection from vcs_info



The vcs_info patch detection code attempted to interrogate StGit patch
stack state by inspecting .git/patches/applied and
.git/patches/unapplied. As of StGit 1.0, StGit stack and patch state is
no longer maintained via files in the .git/ directory, but is instead
captured in the repo's object database, accessible via the
refs/stacks/<branch> reference.

Thus zsh's approach for interrogating StGit patch state is long
obsoleted.

This patch excises the code that attempts to interrogate StGit stack
state. It would alternatively be possible to repair this code to
interrogate the StGit stack state in a different manner, but:

- It is not clear that StGit is a sufficiently popular tool to warrant
  direct inclusion in zsh.
- Interrogating the StGit stack needs to be done using StGit's
  proscribed interface, the stg executable, and not by interrogating
  either the .git filesystem nor by inspecting the git object database
  with the git executable.
- StGit versions prior to 2.0 are implemented in Python and thus have an
  unacceptable runtime overhead to be included in vcs_info (on the order
  of hundreds of milliseconds).
- StGit 2.0 is implemented in Rust is considerably faster (a few tens of
  milliseconds to interrogate stack state), but any non-zero overhead to
  vcs_info still seems like too much given the value of this patch
  information and the relative non-popularity of StGit.
- Just removing the code is the lowest-risk approach for the zsh code
  base.

Signed-off-by: Peter Grayson <pete@xxxxxxxxxxxxx>
---
 Functions/VCS_Info/Backends/VCS_INFO_get_data_git | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git
index e45eebc8e..a3f4dbdf0 100644
--- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git
+++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git
@@ -184,15 +184,8 @@ fi
 VCS_INFO_adjust
 VCS_INFO_git_getaction ${gitdir}
 
-local patchdir=${gitdir}/patches/${gitbranch}
-if [[ -d $patchdir ]] && [[ -f $patchdir/applied ]] \
-   && [[ -f $patchdir/unapplied ]]
-then
-    # stgit
-    git_patches_applied=(${(f)"$(< "${patchdir}/applied")"})
-    git_patches_unapplied=(${(f)"$(< "${patchdir}/unapplied")"})
-    VCS_INFO_git_handle_patches
-elif [[ -d "${gitdir}/rebase-merge" ]]; then
+local patchdir
+if [[ -d "${gitdir}/rebase-merge" ]]; then
     # 'git rebase -i'
     patchdir="${gitdir}/rebase-merge"
     local p
-- 
2.38.1





Messages sorted by: Reverse Date, Date, Thread, Author