You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
Thanks for this, I couldn't quite get powerline itself to work in my setup so this is handy.
Where I work the git repo is really big so each git command takes about 0.3 seconds.
As there a few it takes about a second to draw for the prompt to draw.
I don't know git well enough to provide a patch, but I was looking at whether its possible to get more of the stats using fewer external commands,
As an experiment I've made a script that gets the changed file count, and the the amount of insertions, using one call to git diff --shortstat and then parsing the output in bash.
Maybe this would be useful in helping speed up rendering of the prompt?
#!/bin/bash# Set comma as the delimiter
IFS=','read -a gitstat <<<$(git diff --shortstat)
# Example output from git diff --shortstat:# 3 files changed, 4 insertions(+)## read has split it by comma, next remove space prefix and text suffix# using bash.
git_changed=${gitstat[0]%" files changed"}
git_changed=${git_changed# }
git_insertions=${gitstat[1]%"insertions(+)"}
git_insertions=${git_insertions# }echo"changed: '"$git_changed"'"echo"inserted: '"$git_insertions"'"
Most of the work is removing the prefixes + suffixes from the strings.
The text was updated successfully, but these errors were encountered:
stuaxo
changed the title
Speed up git stats by calling it less
Improve performance
Oct 2, 2019
Hi,
Thanks for this, I couldn't quite get powerline itself to work in my setup so this is handy.
Where I work the git repo is really big so each git command takes about 0.3 seconds.
As there a few it takes about a second to draw for the prompt to draw.
I don't know git well enough to provide a patch, but I was looking at whether its possible to get more of the stats using fewer external commands,
As an experiment I've made a script that gets the changed file count, and the the amount of insertions, using one call to
git diff --shortstat
and then parsing the output in bash.Maybe this would be useful in helping speed up rendering of the prompt?
script:
Most of the work is removing the prefixes + suffixes from the strings.
The text was updated successfully, but these errors were encountered: