Skip to content
This repository has been archived by the owner on Apr 24, 2020. It is now read-only.

Fix wrapper slowness in vcs segment #797

Merged
merged 1 commit into from
Jul 10, 2018

Conversation

guicassolato
Copy link
Contributor

@guicassolato guicassolato commented Apr 11, 2018

This prevents git command from passing through eventual aliases, commonly defined when Git wrappers (e.g. hub) are used.

@dritter
Copy link
Member

dritter commented Apr 12, 2018

Thanks @guicassolato for this PR (and congrats for the 400th PR ;) ).
I think this PR deserves a bit more explanation.

From the docs:

command [ -pvV ] simple command
The simple command argument is taken as an external command instead of a function or builtin and is executed. If the POSIX_BUILTINS option is set, builtins will also be executed but certain special properties of them are suppressed. The -p flag causes a default path to be searched instead of that in $path. With the -v flag, command is similar to whence and with -V, it is equivalent to whence -v.

So the command builtin skips possible wrapper scripts and executes the command directly. If I have an alias for git (e.g. alias git='echo "git-wrapper"; git'; stupid, I know) and I execute git status in a repository, I'll get git-wrapper besides the git status output. But if I do command git status I'll get only the output of that command (without git-wrapper).

@bhilburn
Copy link
Member

This is excellent, @guicassolato! This will certainly improve a number of issues, including extremely confusing bug reports as well as likely speeding some things up. And thanks, @dritter, for explaining how it works!

We're right in the middle of a major code re-org in #711, which will affect where this changeset is applied (although not the actual logic of the code itself). To avoid merge conflicts, I'm going to wait until that PR is done (should be shortly), and then we can update this PR and merge =)

onaforeignshore added a commit to onaforeignshore/powerlevel9k that referenced this pull request Apr 16, 2018
@dritter dritter mentioned this pull request Jun 4, 2018
dritter added a commit to dritter/powerlevel9k that referenced this pull request Jun 6, 2018
… staging_065

Conflicts were:
- functions/vcs.zsh: Two commits avoided wrapper behaviour. Powerlevel9k#685
in grep, Powerlevel9k#797 in git.
@dritter dritter mentioned this pull request Jun 7, 2018
@bhilburn bhilburn merged commit 1aee125 into Powerlevel9k:master Jul 10, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants