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

lib/omb-prompt-base: Set a timeout on git commands #173

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

pokowaka
Copy link
Contributor

The calculate of git_summary_status can be extremely expensive for large
repos. This results in the shell becoming unresponsive.

We now set a timeout of 0.2 seconds to make sure we always have
a responsive shell.

Fixes #172

@nntoan nntoan added bug-fix Issues about fixing bugs community-feature Community feature merge request P2 - Important Priority 2 labels Oct 23, 2020
@nntoan nntoan changed the title Set a timeout on git commands themes/base: Set a timeout on git commands Oct 23, 2020
@akinomyoga akinomyoga changed the title themes/base: Set a timeout on git commands lib/omb-prompt-base: Set a timeout on git commands Oct 14, 2023
@akinomyoga
Copy link
Contributor

rebased.

The calculate of git_summary_status can be extremely expensive for
large repos. This results in the shell becoming unresponsive.

We now set a timeout of 0.2 seconds to make sure we always have a
responsive shell.

* lib/omb-prompt-base: Set a timeout on git commands
* lib/omb-prompt-base: Fix timeout bug
* lib/omb-prompt-base: Rename function "{run_with => _omb_prompt}_timeout"
* lib/omb-prompt-base(_omb_prompt_timeout): Fix coding style
* lib/omb-prompt-base(_omb_prompt_timeout): Check timeout commands on startup

Fixes ohmybash#172
Co-authored-by: Koichi Murase <[email protected]>
@akinomyoga
Copy link
Contributor

Added fixes and squashed.

@akinomyoga
Copy link
Contributor

@pokowaka @HanJoHibender Do you have any thoughts on this?

I now think the default timeout 0.2 sec might be too short. If the timeout is too short, the prompt information will not be shown in many repositories. In fact, a user who picked this commit has increased the timeout to 1 sec:

@ghostrider-reborn Maybe you also have a comment?

But still, there might be cases where Git information is wanted even if it takes time to show the prompt. Another approach is to get the Git information asynchronously as I mentioned in #172 (comment).

@akinomyoga
Copy link
Contributor

As suggested in #6, another approach is to allow the user to disable the git prompt information for each repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug-fix Issues about fixing bugs community-feature Community feature merge request P2 - Important Priority 2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

git_status_summary extremely slow for large repos
3 participants