Hi Jonathan,

On Tue, Oct 03, 2017 at 03:15:26PM -0700, Jonathan Nieder wrote:
> Have you read https://bugs.debian.org/613892#10?  Would you be
> interested in working on a patch for upstream Git to do that?  We can
> make the error message printed when manpages are missing a value set
> at compile time (see the Makefile for existing compile-time parameters
> like DEFAULT_EDITOR).  I'm happy to give pointers, etc. to anyone
> wanting to work on this.

I actually followed a different route and created a patch which is
Debian-specific. Please have a look - it is not yet polished in any way,
esp. all the translations are missing. The patch is against git in
unstable.


Cheers,
--Toni++

diff --git a/builtin/help.c b/builtin/help.c
index 334a849..c2a3670 100644
--- a/builtin/help.c
+++ b/builtin/help.c
@@ -32,6 +32,8 @@ enum help_format {
 	HELP_FORMAT_WEB
 };
 
+static const char *manpage_canary = "/usr/share/doc/git-man/copyright";
+
 static const char *html_path;
 
 static int show_all = 0;
@@ -342,8 +344,15 @@ static void show_man_page(const char *git_cmd)
 	struct man_viewer_list *viewer;
 	const char *page = cmd_to_page(git_cmd);
 	const char *fallback = getenv("GIT_MAN_VIEWER");
+	struct stat throwaway;
+	int find_canary = 0;
 
 	setup_man_path();
+	find_canary = stat(manpage_canary, &throwaway);
+	if (find_canary == -1) {
+		printf(_("git: no man pages installed, please ask your system administrator to install the git-man package.\n"));
+		exit(0);
+	}
 	for (viewer = man_viewer_list; viewer; viewer = viewer->next)
 	{
 		exec_viewer(viewer->name, page); /* will return when unable */
diff --git a/debian/control b/debian/control
index 5c2eb20..bc8fc8b 100644
--- a/debian/control
+++ b/debian/control
@@ -27,9 +27,9 @@ Package: git
 Architecture: any
 Multi-Arch: foreign
 Depends: ${misc:Depends}, ${shlibs:Depends}, perl, liberror-perl,
- git-man (>> ${source:Upstream-Version}), git-man (<< ${source:Upstream-Version}-.)
 Pre-Depends: ${misc:Pre-Depends}
-Recommends: patch, less, ssh-client
+Recommends: patch, less, ssh-client, git-man (>> ${source:Upstream-Version}),
+ git-man (<< ${source:Upstream-Version}-.)
 Suggests: gettext-base, git-daemon-run | git-daemon-sysvinit,
  git-doc, git-el, git-email, git-gui, gitk, gitweb,
  git-cvs, git-mediawiki, git-svn

Reply via email to