oh-my-bash icon indicating copy to clipboard operation
oh-my-bash copied to clipboard

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

Open pokowaka opened this issue 3 years ago • 4 comments

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

pokowaka avatar Aug 28 '20 19:08 pokowaka

rebased.

akinomyoga avatar Oct 14 '23 08:10 akinomyoga

Added fixes and squashed.

akinomyoga avatar Oct 14 '23 08:10 akinomyoga

@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.

akinomyoga avatar Oct 14 '23 09:10 akinomyoga

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

akinomyoga avatar Oct 14 '23 09:10 akinomyoga