debian: move doc/git/contrib/emacs symlink to the git-el package

Avoid dangling symlinks in contrib/ when git-el is not installed.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
diff --git a/debian/git-el.postinst b/debian/git-el.postinst
index 3037997..96b4933 100644
--- a/debian/git-el.postinst
+++ b/debian/git-el.postinst
@@ -2,3 +2,13 @@
 set -e
 test "$1" = configure || exit 0
 /usr/lib/emacsen-common/emacs-package-install git
+
+# Replace the old /usr/share/doc/git/contrib/emacs directory
+# with a symlink.
+test -z "$2" || exit 0
+test -d /usr/share/doc/git/contrib/emacs || exit 0
+if ! rmdir /usr/share/doc/git/contrib/emacs; then
+  echo Moving /usr/share/doc/git/contrib/emacs to emacs.old >&2
+  mv -f /usr/share/doc/git/contrib/emacs /usr/share/doc/git/contrib/emacs.old
+fi
+ln -s ../../../git-core/emacs /usr/share/doc/git/contrib/emacs