{"thread":{"id":"27254","subject":"[PATCH] bash: Disable __git_ps1() if NO_GIT_PS1 is set","startedAt":"2011-05-04T22:11:53Z","lastAt":"2011-05-05T17:48:40Z","messageCount":2,"participants":["Øyvind A. Holm","Stefan Haller"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"167056","messageId":"20110504221153.GB15161@linode","threadId":"27254","inReplyTo":null,"subject":"[PATCH] bash: Disable __git_ps1() if NO_GIT_PS1 is set","fromName":"Øyvind A. Holm","fromEmail":"sunny@sunbase.org","sentAt":"2011-05-04T22:11:53Z","receivedAt":"2011-05-04T22:11:53Z","isPatch":true,"sender":{"key":"sunny@sunbase.org","avatar":"https://avatars.githubusercontent.com/u/113445?v=4"},"body":"If the user works in a big repository on a slow USB disk or network\ndrive, __git_ps1() can result in a significant delay before the prompt\nreappears. By setting the environment variable NO_GIT_PS1 to a nonempty\nvalue, the use of __git_ps1() is temporarily disabled.\n\nSigned-off-by: Øyvind A. Holm <sunny@sunbase.org>\n---\n contrib/completion/git-completion.bash |    6 ++++++\n 1 files changed, 6 insertions(+), 0 deletions(-)\n\ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex 0df356d..ee8cef5 100755\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -60,6 +60,11 @@\n #       per-repository basis by setting the bash.showUpstream config\n #       variable.\n #\n+#       When working in a big repository on a slow USB disk or network\n+#       drive, __git_ps1 may result in a noticeable delay before the prompt\n+#       reappears.  To temporarily disable the use of __git_ps1, set\n+#       NO_GIT_PS1 to a nonempty value.\n+#\n #\n # To submit patches:\n #\n@@ -225,6 +230,7 @@ __git_ps1_show_upstream ()\n # returns text to add to bash PS1 prompt (includes branch name)\n __git_ps1 ()\n {\n+\t[ -z \"$NO_GIT_PS1\" ] || return\n \tlocal g=\"$(__gitdir)\"\n \tif [ -n \"$g\" ]; then\n \t\tlocal r=\"\"\n-- \n1.7.5.185.g0b9dee\n"},{"id":"167135","messageId":"1k0t770.1lqbn2d43agaoM%lists@haller-berlin.de","threadId":"27254","inReplyTo":"20110504221153.GB15161@linode","subject":"Re: [PATCH] bash: Disable __git_ps1() if NO_GIT_PS1 is set","fromName":"Stefan Haller","fromEmail":"lists@haller-berlin.de","sentAt":"2011-05-05T17:48:40Z","receivedAt":"2011-05-05T17:48:40Z","isPatch":true,"sender":{"key":"lists@haller-berlin.de","avatar":null},"body":"Øyvind A. Holm <sunny@sunbase.org> wrote:\n\n> If the user works in a big repository on a slow USB disk or network\n> drive, __git_ps1() can result in a significant delay before the prompt\n> reappears. By setting the environment variable NO_GIT_PS1 to a nonempty\n> value, the use of __git_ps1() is temporarily disabled.\n\nAs far as I can tell, the only thing that makes the prompt slow in large\nrepositories is determining the dirty state; so instead of disabling the\nprompt entirely, you may want to just unset GIT_PS1_SHOWDIRTYSTATE.\nThat way you still see which branch you are on, for example.\n\n\n-- \nStefan Haller\nBerlin, Germany\nhttp://www.haller-berlin.de/\n"}]}