Ever since I installed GitBash on my computer, the prompt has been very unresponsive. I think I have lowered the culprit down to the command __git_ps1
.
The timings for this command are as follows, along with the output:
$ time __git_ps1
+ __git_ps1
+ local pcmode=no
+ local detached=no
+ local 'ps1pc_start=\u@\h:\w '
+ local 'ps1pc_end=\$ '
+ local 'printf_format= (%s)'
+ case "$#" in
+ printf_format=' (%s)'
+ local ps1_expanded=yes
+ '[' -z '' ']'
+ '[' -z '3.1.20(4)-release' ']'
+ shopt -q promptvars
+ local repo_info rev_parse_exit_code
++ git rev-parse --git-dir --is-inside-git-dir --is-bare-repository --is-inside-
work-tree --short HEAD
+ repo_info=
+ rev_parse_exit_code=128
+ '[' -z '' ']'
+ '[' no = yes ']'
+ return
real 0m0.541s
user 0m0.000s
sys 0m0.358s
$PS1 is equal to \[\033]0;$MSYSTEM:${PWD//[^[:ascii:]]/?}\007\]\n\[\033[32m\]\u@\h \[\033[33m\]\w$(__git_ps1)\[\033[0m\]\n$
I don't have this issue on any of my other computers either. I've virtualized windows 7 8.1 and 10 and they all don't have this issue. Any insight onto this issue will be helpful
time git rev-parse --git-dir --is-inside-git-dir --is-bare-repository --is-inside-work-tree --short HEAD
on my computer:
real 0m0.364s
user 0m0.000s
sys 0m0.186s
Above command in VM:
real 0m0.031s
user 0m0.000s
sys 0m0.015s