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

Re: [PATCH] Remove StGit patch detection from vcs_info



Peter Grayson wrote on Sat, Nov 12, 2022 at 09:46:02 -0500:
> On Fri, Nov 11, 2022, at 6:49 AM, Daniel Shahaf wrote:
> > [re #2]: It sounds like StGit 2.x support can be implemented at the cost
> > of one fork(2) for those who don't use StGit and under a microsecond for
> > those who do.  That doesn't sound like a deal breaker at all.
> 
> Running `stg series` with StGit 2.0 takes about 12ms in my environment.
> StGit 1.5 it is about 32ms. Not a microsecond, but perhaps acceptable
> nonetheless.
> 

To be clear, are these figures the duration of the «stg series
--noprefix --applied» invocation?

What's the impact on people who don't have stg(1) installed, or who have
stg(1) installed but are currently in a worktree that doesn't use StGit?
I.e., are those figures immediately after `git init`, or in a worktree
that has a StGit patch stack, or?

In general, 32ms for everyone might be too much (what if another
third-party tool wanted to do its own elif branch that also spent 32ms
for everyone?  That'd be 64ms in total and counting…).  However, if the
32ms would only be seen by users of an EOL'd stg(1), we can relax the
threshold a bit.  On the other hand, if it's 32ms just in cases where
stg(1) is used… well, there doesn't seem to be much we /can/ do there.
Perhaps hide some or all of the work behind an opt-in switch.  (For
instance, the default settings show only the topmost applied patch, so
if it's possible to tell stg(1) not to emit any other patches, that
might help the code finish more quickly.)

From the "Is your computer plugged in?" department: Is that 32ms figure
on hot disk cache with .pyc files already having been generated?

Cheers,

Daniel

> 
> > Cheers,
> >
> > Daniel
> >
> >> 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