Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

git_status not working #4712

Closed
hriddhidey opened this issue Dec 12, 2022 · 7 comments · Fixed by #3981
Closed

git_status not working #4712

hriddhidey opened this issue Dec 12, 2022 · 7 comments · Fixed by #3981
Assignees
Labels
🐛 bug Something isn't working as expected.

Comments

@hriddhidey
Copy link

Current Behavior

I don't see any git status symbols show up ever on any git repository. The Git branch and even state (MERGING etc.) show up but never any symbols to indicate whether I am ahead/behind/dirty/stashed/etc. I have tried manually adding format strings and symbols for the options in my config file but nothing works for git_status. It simply won't show up.

Expected Behavior

I would really like git_status to work.

Additional context/Screenshots

Screenshot 2022-12-13 at 1 36 38 AM

Environment

  • Starship version: 1.11.0
  • zsh version: zsh 5.9 (x86_64-apple-darwin21.3.0)
  • Operating system: Mac OS 12.6.1
  • Terminal emulator: WarpTerminal v0.2022.12.06.08.03.stable_01
  • Git Commit Hash:
  • Branch/Tag: master
  • Rust Version: rustc 1.64.0 (a55dd71d5 2022-09-19)
  • Rust channel: stable-x86_64-apple-darwin release
  • Build Time: 2022-10-15 01:46:07 +00:00

Relevant Shell Configuration

# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH

# Path to your oh-my-zsh installation.
export ZSH="$HOME/.oh-my-zsh"

# 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/ohmyzsh/ohmyzsh/wiki/Themes
ZSH_THEME=""

# 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 $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 one of the following lines to change the auto-update behavior
# zstyle ':omz:update' mode disabled  # disable automatic updates
# zstyle ':omz:update' mode auto      # update automatically without asking
# zstyle ':omz:update' mode reminder  # just remind me to update when it's time

# Uncomment the following line to change how often to auto-update (in days).
# zstyle ':omz:update' frequency 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.
# You can also set it to another string to have that shown instead of the default red dots.
# e.g. COMPLETION_WAITING_DOTS="%F{yellow}waiting...%f"
# Caution: this setting can cause issues with multiline prompts in zsh < 5.7.1 (see #5765)
# 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 $ZSH/plugins/
# Custom plugins may be added to $ZSH_CUSTOM/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.
plugins=(git)

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"
export N_PREFIX="$HOME/n"; [[ :$PATH: == *":$N_PREFIX/bin:"* ]] || PATH+=":$N_PREFIX/bin"
export JAVA_HOME=$(/usr/libexec/java_home)

alias cheat=cht.sh
alias free="top -l 1 -s 0 | grep PhysMem | sed 's/, /\n         /g'"

eval "$(starship init zsh)"

Starship Configuration

# ~/.config/starship.toml

add_newline=false
@hriddhidey hriddhidey added the 🐛 bug Something isn't working as expected. label Dec 12, 2022
@andytom
Copy link
Member

andytom commented Dec 28, 2022

Hi @hriddhidey, can you please run the following command in a git repo and post the results here.

env STARSHIP_LOG=trace starship module git_status 

This should help us debug what is going wrong here.

@andytom andytom self-assigned this Dec 28, 2022
@hriddhidey
Copy link
Author

hriddhidey commented Dec 29, 2022

Hey @andytom !
Thanks for taking a look at this and sharing the debug command! It proved very useful!
Here's a screenshot of the result of the command you requested -
Screenshot 2022-12-29 at 10 52 25 AM

Turns out the --no-optional-locks option as added only in git version 2.15.x.
I checked my local git version and I was on 2.10.1.

I used the following commands to upgrade my git -

brew install git
brew link --overwrite git

Now my git version is 2.37.3 and I am able to see the git state and status showing up.
However, the first time I spawn a new session or window, I get a timeout warning. I have to press Enter or Ctrl+C to move to a new line to get rid of that.
Attaching a screenshot here for your reference.
Screenshot 2022-12-29 at 10 58 35 AM

Any tips on what's the ideal way to solve this? Am I doing something wrong?

@hriddhidey
Copy link
Author

I see the following log when I try to debug using the trace command you mentioned -

...(couple of git commits)...exit code: "Some(0)", took 71.937696ms

@davidkna
Copy link
Member

#3981 has a fix for pre---no-optional-locks git versions, the argument can be replaced with .env("GIT_OPTIONAL_LOCKS", "0"). That PR has been open for a while, so maybe someone could a new PR only containing that fix to get it merged faster.

@hriddhidey
Copy link
Author

Just setting optional locks as disabled doesn't feel like a solution IMHO. Feels like a step backwards.
Either way, I have updated my git version to the latest now. The concern facing me is the timeout warning on every new session.

@davidkna
Copy link
Member

davidkna commented Dec 30, 2022

@hriddhidey Issues with performance git status are already being tracked in #4305. If you don't wish to see timeout warnings at all, known workarounds include increasing the command_timeout (for example starship config command_timeout 1000) or setting $STARSHIP_LOG to error.
Beyond this, the module performance may improve in the first half of 2023 by leveraging gitoxide.

@hriddhidey
Copy link
Author

Sounds great @davidkna!
Thanks a ton for your inputs, and I will eagerly look forward to the performance improvements next year.
My sincerest gratitude to you and the entire Starship team for your amazing work! ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working as expected.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants