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/changelog b/debian/changelog
index 4ffa62c..71a50df 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
+git (1:1.8.5.2-1.1) unstable; urgency=low
+
+ * /etc/bash_completion.d/git-prompt: check for git-sh-prompt
+ and do not source it if git is removed but not purged (thx
+ Craig Small; closes: #726669).
+
+ -- Jonathan Nieder <jrnieder@gmail.com> Fri, 03 Jan 2014 15:44:36 -0800
+
git (1:1.8.5.2-1) unstable; urgency=low
* new upstream point release.
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