oh-my-bash
oh-my-bash copied to clipboard
lib/omb-prompt-base: Set a timeout on git commands
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
rebased.
Added fixes and squashed.
@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:
- https://github.com/ghostrider-reborn/oh-my-bash/commit/89c727960838ee23fb078ab16f6a362dd65a058e
@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 https://github.com/ohmybash/oh-my-bash/issues/172#issuecomment-1006343956.
As suggested in #6, another approach is to allow the user to disable the git prompt information for each repository.