debian: handle removed-but-not-purged state in git-prompt completion script
The small wrapper at /etc/bash_completion.d/git-prompt is a conffile,
so it gets kept around even when the git package is removed as long as
it hasn't been purged, with unfortunate consequences when the user
logs in:
-bash: /usr/lib/git-core/git-sh-prompt: No such file or directory
-bash: /usr/lib/git-core/git-sh-prompt: No such file or directory
Fix it by first checking that the git-sh-prompt script is present,
as suggested in a different context by policy section 9.3.2.
Reported-by: Craig Small <csmall@debian.org>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
diff --git a/debian/git-prompt.completion b/debian/git-prompt.completion
index 6a31546..8b5852a 100644
--- a/debian/git-prompt.completion
+++ b/debian/git-prompt.completion
@@ -6,4 +6,6 @@
# at bash-completion startup for now, to ease the transition to a
# world order where the prompt function is requested separately.
#
-. /usr/lib/git-core/git-sh-prompt
+if [[ -e /usr/lib/git-core/git-sh-prompt ]]; then
+ . /usr/lib/git-core/git-sh-prompt
+fi