Skip to content

git prompt extremely slow on git repos with lots of commits. #8979

@phryk

Description

@phryk

Meta

Fish: 3.4.1
OS: FreeBSD 13.0
Terminal: rxvt-unicode

No third-party customizations.

Reproduction

Use one of the predefined prompts showing git info, like "Informative Vcs" or "Terlar".

git clone https://git.freebsd.org/ports.git
cd ports

Expected behavior

Change directory and give me access to my shell back, fast.

Actual behavior

Shell session blocked for ~15s.

Fix

Have __terlar_git_prompt and fish_git_prompt pass -uno to git status,
which makes it ignore untracked files. This speeds up the prompt generation
by a factor of something like 30-100, even when no untracked files are around.

fish_git_prompt has some settings that would make this invalid behavior
(show_informative_status, showuntrackedfiles), but -uno should at least
be the default because it makes the prompt on big repos so much faster.

I would also argue that a timeout like proposed by @cg505 and @krobelus
in #6764 should be wrapped around calls to prompt functions.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions