starship: Freezes and uses 100% of cpu in huge? git directories.
Current Behavior
Freeze in some directories.
/usr/bin/ls -lRa | wc -l
65256
Itβs git directory with rust project with a bunch of small files. Any command evaluates nearly 10 seconds and consumes 100% of CPU. In any other directory it works perfectly,
Expected Behavior
Not to freeze/
Additional context/Screenshots
Environment
- Starship version: 0.36.0
- zsh version: zsh 5.7.1 (x86_64-pc-linux-gnu)
- Operating system: Linux 19.0
- Terminal emulator: <unknown terminal> <unknown version>
Relevant Shell Configuration
export RUSTC_WRAPPER=sccache
export EDITOR=vim
alias rfm='fd --extension rs --exec=rustfmt'
# pacmatic needs to be run as root: https://github.com/keenerd/pacmatic/issues/35
alias pacmatic='sudo --preserve-env=pacman_program /usr/bin/pacmatic'
# Downgrade permissions as AUR helpers expect to be run as a non-root user. $UID is read-only in {ba,z}sh.
alias yay='pacman_program="sudo -u #$UID /usr/bin/yay --pacman powerpill" pacmatic'
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
alias open=xdg-open
# Path to your oh-my-zsh installation.
export ZSH="/home/username/.oh-my-zsh"
#alias less=bat
# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
ZSH_THEME="robbyrussell"
path+=('~/.cargo/bin')
export PATH
# Set list of themes to pick from when loading at random
# Setting this variable when ZSH_THEME=random will cause zsh to load
# a theme from this variable instead of looking in ~/.oh-my-zsh/themes/
# If set to an empty array, this variable will have no effect.
# ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" )
# Uncomment the following line to use case-sensitive completion.
# CASE_SENSITIVE="true"
# Uncomment the following line to use hyphen-insensitive completion.
# Case-sensitive completion must be off. _ and - will be interchangeable.
# HYPHEN_INSENSITIVE="true"
# Uncomment the following line to disable bi-weekly auto-update checks.
# DISABLE_AUTO_UPDATE="true"
# Uncomment the following line to automatically update without prompting.
# DISABLE_UPDATE_PROMPT="true"
# Uncomment the following line to change how often to auto-update (in days).
export UPDATE_ZSH_DAYS=13
# Uncomment the following line if pasting URLs and other text is messed up.
# DISABLE_MAGIC_FUNCTIONS=true
# Uncomment the following line to disable colors in ls.
# DISABLE_LS_COLORS="true"
# Uncomment the following line to disable auto-setting terminal title.
# DISABLE_AUTO_TITLE="true"
# Uncomment the following line to enable command auto-correction.
# ENABLE_CORRECTION="true"
# Uncomment the following line to display red dots whilst waiting for completion.
# COMPLETION_WAITING_DOTS="true"
# Uncomment the following line if you want to disable marking untracked files
# under VCS as dirty. This makes repository status check for large repositories
# much, much faster.
# DISABLE_UNTRACKED_FILES_DIRTY="true"
# Uncomment the following line if you want to change the command execution time
# stamp shown in the history command output.
# You can set one of the optional three formats:
# "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"
# or set a custom format using the strftime function format specifications,
# see 'man strftime' for details.
# HIST_STAMPS="mm/dd/yyyy"
# Would you like to use another custom folder than $ZSH/custom?
# ZSH_CUSTOM=/path/to/new-custom-folder
# Which plugins would you like to load?
# Standard plugins can be found in ~/.oh-my-zsh/plugins/*
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.
plugins=(
git
zsh-autosuggestions
zsh-syntax-highlighting
archlinux
)
source $ZSH/oh-my-zsh.sh
# User configuration
# export MANPATH="/usr/local/man:$MANPATH"
# You may need to manually set your language environment
# export LANG=en_US.UTF-8
# Preferred editor for local and remote sessions
# if [[ -n $SSH_CONNECTION ]]; then
# export EDITOR='vim'
# else
# export EDITOR='mvim'
# fi
# Compilation flags
# export ARCHFLAGS="-arch x86_64"
# Set personal aliases, overriding those provided by oh-my-zsh libs,
# plugins, and themes. Aliases can be placed here, though oh-my-zsh
# users are encouraged to define aliases within the ZSH_CUSTOM folder.
# For a full list of active aliases, run `alias`.
#
# Example aliases
# alias zshconfig="mate ~/.zshrc"
# alias ohmyzsh="mate ~/.oh-my-zsh"
autoload -U compinit && compinit
unalias ls
alias ls='exa'
eval "$(starship init zsh)"
#source /home/username/.config/broot/launcher/bash/br
fpath=( ~/.zfunc "${fpath[@]}" )
Starship Configuration
[battery]
full_symbol = "π"
charging_symbol = "β‘οΈ"
discharging_symbol = "π"
[character]
symbol = "β"
error_symbol = "β"
use_symbol_for_status = true
[directory]
truncation_length = 8
[git_branch]
symbol = "π± "
truncation_length = 4
truncation_symbol = ""
[git_status]
conflicted = "π³"
ahead = "ππ¨"
behind = "π°"
diverged = "π΅"
untracked = "π€·"
stashed = "π¦"
modified = "π"
staged.value = "++"
staged.style = "green"
staged_count.enabled = true
staged_count.style = "green"
renamed = "π
"
deleted = "π"
[hostname]
ssh_only = true
prefix = "βͺ"
suffix = "β«"
disabled = false
[jobs]
symbol = "+ "
threshold = 4
[line_break]
disabled = true
[package]
symbol = "π "
[memory_usage]
show_percentage = true
show_swap = true
threshold = -1
symbol = " "
separator = "/"
style = "bold dimmed green"
dis[memory_usage]
show_percentage = true
show_swap = true
threshold = -1
symbol = " "
separator = "/"
style = "bold dimmed green"
disabled = false
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 5
- Comments: 25 (5 by maintainers)
Iβm seeing the same thing, cloning the WebKit official git repository
git clone git://git.webkit.org/WebKit-https.git WebKitwhen entering the folder with starship is very slow.After a build itβs even A LOT slower but even
git statusthen complains thatIt took 3.81 seconds to enumerate untracked filesIβd suggest that the git plugin should have an upper bound on itβs execution time, having a working prompt without git branch name is better than a too slow to be usable prompt.
OK, so
git statusis fast,lg2 statusis fast, butstarship promptis slow and the CPU profile shows all time spent in libgit2. This must be fixable.Makes sense. Thanks for the info.
By the way, before ditching libgit2 in gitstatus Iβve also tried linking with git and calling its functions. This is really difficult and doesnβt pay off compared to forking into regular
gitand parsing the output. So itβs a good call for starship to invokegit.