Skip to content

Commit

Permalink
Merge branch 'cc/help'
Browse files Browse the repository at this point in the history
* cc/help:
  RPM spec: Adjust htmldir
  git-help -w: do not require to be in git repository
  git.spec.in: remove python_path
  Documentation: rename git.texi to user-manual.texi
  Add git-browse-help to .gitignore
  git-help -i: show info documentation from matching version of git
  git-help -i: invoke info with document and node name
  Documentation: add gitman.info target
  Documentation: describe -w/--web option to "git-help".
  Use {web,instaweb,help}.browser config options.
  git-help: add -w|--web option to display html man page in a browser.
  Documentation: describe -i/--info option to "git-help"
  git-help: add -i|--info option to display info page.
  • Loading branch information
Junio C Hamano committed Dec 13, 2007
2 parents cd1bea9 + 39bf13f commit 467f42c
Show file tree
Hide file tree
Showing 12 changed files with 340 additions and 57 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ git-archive
git-bisect
git-blame
git-branch
git-browse-help
git-bundle
git-cat-file
git-check-attr
Expand Down
40 changes: 32 additions & 8 deletions Documentation/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ MAN1_TXT= \
MAN5_TXT=gitattributes.txt gitignore.txt gitmodules.txt
MAN7_TXT=git.txt

DOC_HTML=$(patsubst %.txt,%.html,$(MAN1_TXT) $(MAN5_TXT) $(MAN7_TXT))
MAN_TXT = $(MAN1_TXT) $(MAN5_TXT) $(MAN7_TXT)
MAN_XML=$(patsubst %.txt,%.xml,$(MAN_TXT))
MAN_HTML=$(patsubst %.txt,%.html,$(MAN_TXT))

DOC_HTML=$(MAN_HTML)

ARTICLES = tutorial
ARTICLES += tutorial-2
Expand All @@ -29,6 +33,7 @@ DOC_MAN7=$(patsubst %.txt,%.7,$(MAN7_TXT))

prefix?=$(HOME)
bindir?=$(prefix)/bin
htmldir?=$(prefix)/share/doc/git-doc
mandir?=$(prefix)/share/man
man1dir=$(mandir)/man1
man5dir=$(mandir)/man5
Expand Down Expand Up @@ -79,7 +84,7 @@ man1: $(DOC_MAN1)
man5: $(DOC_MAN5)
man7: $(DOC_MAN7)

info: git.info
info: git.info gitman.info

install: man
$(INSTALL) -d -m 755 $(DESTDIR)$(man1dir)
Expand All @@ -91,13 +96,17 @@ install: man

install-info: info
$(INSTALL) -d -m 755 $(DESTDIR)$(infodir)
$(INSTALL) -m 644 git.info $(DESTDIR)$(infodir)
$(INSTALL) -m 644 git.info gitman.info $(DESTDIR)$(infodir)
if test -r $(DESTDIR)$(infodir)/dir; then \
$(INSTALL_INFO) --info-dir=$(DESTDIR)$(infodir) git.info ;\
$(INSTALL_INFO) --info-dir=$(DESTDIR)$(infodir) gitman.info ;\
else \
echo "No directory found in $(DESTDIR)$(infodir)" >&2 ; \
fi

install-html: html
sh ./install-webdoc.sh $(DESTDIR)$(htmldir)

../GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE
$(MAKE) -C ../ GIT-VERSION-FILE

Expand Down Expand Up @@ -161,12 +170,27 @@ XSLTOPTS = --xinclude --stringparam html.stylesheet docbook-xsl.css
user-manual.html: user-manual.xml
xsltproc $(XSLTOPTS) -o $@ $(XSLT) $<

git.info: user-manual.xml
$(RM) $@ $*.texi $*.texi+
$(DOCBOOK2X_TEXI) user-manual.xml --to-stdout >$*.texi+
$(PERL_PATH) fix-texi.perl <$*.texi+ >$*.texi
git.info: user-manual.texi
$(MAKEINFO) --no-split -o $@ user-manual.texi

user-manual.texi: user-manual.xml
$(RM) $@+ $@
$(DOCBOOK2X_TEXI) user-manual.xml --to-stdout | $(PERL_PATH) fix-texi.perl >$@+
mv $@+ $@

gitman.texi: $(MAN_XML) cat-texi.perl
$(RM) $@+ $@
($(foreach xml,$(MAN_XML),$(DOCBOOK2X_TEXI) --to-stdout $(xml);)) | \
$(PERL_PATH) cat-texi.perl $@ >$@+
mv $@+ $@

gitman.info: gitman.texi
$(MAKEINFO) --no-split $*.texi
$(RM) $*.texi $*.texi+

$(patsubst %.txt,%.texi,$(MAN_TXT)): %.texi : %.xml
$(RM) $@+ $@
$(DOCBOOK2X_TEXI) --to-stdout $*.xml >$@+
mv $@+ $@

howto-index.txt: howto-index.sh $(wildcard howto/*.txt)
$(RM) $@+ $@
Expand Down
38 changes: 38 additions & 0 deletions Documentation/cat-texi.perl
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/usr/bin/perl -w

my @menu = ();
my $output = $ARGV[0];

open TMP, '>', "$output.tmp";

while (<STDIN>) {
next if (/^\\input texinfo/../\@node Top/);
next if (/^\@bye/ || /^\.ft/);
if (s/^\@top (.*)/\@node $1,,,Top/) {
push @menu, $1;
}
s/\(\@pxref{\[URLS\]}\)//;
print TMP;
}
close TMP;

printf '\input texinfo
@setfilename gitman.info
@documentencoding us-ascii
@node Top,,%s
@top Git Manual Pages
@documentlanguage en
@menu
', $menu[0];

for (@menu) {
print "* ${_}::\n";
}
print "\@end menu\n";
open TMP, '<', "$output.tmp";
while (<TMP>) {
print;
}
close TMP;
print "\@bye\n";
unlink "$output.tmp";
28 changes: 25 additions & 3 deletions Documentation/git-help.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ git-help - display help information about git

SYNOPSIS
--------
'git help' [-a|--all] [COMMAND]
'git help' [-a|--all|-i|--info|-w|--web] [COMMAND]

DESCRIPTION
-----------
Expand All @@ -20,18 +20,40 @@ If the option '--all' or '-a' is given, then all available commands are
printed on the standard output.

If a git command is named, a manual page for that command is brought
up. The 'man' program is used by default for this purpose.
up. The 'man' program is used by default for this purpose, but this
can be overriden by other options.

Note that 'git --help ...' is identical as 'git help ...' because the
former is internally converted into the latter.

OPTIONS
-------
-a|--all::

Prints all the available commands on the standard output. This
option superseeds any other option.

-i|--info::
Use the 'info' program to display the manual page, instead of
the 'man' program that is used by default.

-w|--web::
Use a web browser to display the HTML manual page, instead of
the 'man' program that is used by default.
+
The web browser can be specified using the configuration variable
'help.browser', or 'web.browser' if the former is not set. If none of
these config variables is set, the 'git-browse-help' script (called by
'git-help') will pick a suitable default.
+
You can explicitly provide a full path to your prefered browser by
setting the configuration variable 'browser.<tool>.path'. For example,
you can configure the absolute path to firefox by setting
'browser.firefox.path'. Otherwise, 'git-browse-help' assumes the tool
is available in PATH.
+
Note that the script tries, as much as possible, to display the HTML
page in a new tab on an already opened browser.

Author
------
Written by Junio C Hamano <gitster@pobox.com> and the git-list
Expand Down
3 changes: 3 additions & 0 deletions Documentation/git-instaweb.txt
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ You may specify configuration in your .git/config

-----------------------------------------------------------------------

If the configuration variable 'instaweb.browser' is not set,
'web.browser' will be used instead if it is defined.

Author
------
Written by Eric Wong <normalperson@yhbt.net>
Expand Down
5 changes: 5 additions & 0 deletions Documentation/git.txt
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,11 @@ OPTIONS
commands. If the option '--all' or '-a' is given then all
available commands are printed. If a git command is named this
option will bring up the manual page for that command.
+
Other options are available to control how the manual page is
displayed. See gitlink:git-help[1] for more information,
because 'git --help ...' is converted internally into 'git
help ...'.

--exec-path::
Path to wherever your core git programs are installed.
Expand Down
14 changes: 11 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,11 @@ STRIP ?= strip
prefix = $(HOME)
bindir = $(prefix)/bin
mandir = $(prefix)/share/man
infodir = $(prefix)/share/info
gitexecdir = $(bindir)
sharedir = $(prefix)/share
template_dir = $(sharedir)/git-core/templates
htmldir=$(sharedir)/doc/git-doc
ifeq ($(prefix),/usr)
sysconfdir = /etc
else
Expand All @@ -184,7 +186,7 @@ GITWEB_FAVICON = git-favicon.png
GITWEB_SITE_HEADER =
GITWEB_SITE_FOOTER =

export prefix bindir gitexecdir sharedir template_dir sysconfdir
export prefix bindir gitexecdir sharedir template_dir htmldir sysconfdir

CC = gcc
AR = ar
Expand Down Expand Up @@ -224,7 +226,8 @@ SCRIPT_SH = \
git-merge-resolve.sh \
git-lost-found.sh git-quiltimport.sh git-submodule.sh \
git-filter-branch.sh \
git-stash.sh
git-stash.sh \
git-browse-help.sh

SCRIPT_PERL = \
git-add--interactive.perl \
Expand Down Expand Up @@ -748,8 +751,10 @@ ETC_GITCONFIG_SQ = $(subst ','\'',$(ETC_GITCONFIG))
DESTDIR_SQ = $(subst ','\'',$(DESTDIR))
bindir_SQ = $(subst ','\'',$(bindir))
mandir_SQ = $(subst ','\'',$(mandir))
infodir_SQ = $(subst ','\'',$(infodir))
gitexecdir_SQ = $(subst ','\'',$(gitexecdir))
template_dir_SQ = $(subst ','\'',$(template_dir))
htmldir_SQ = $(subst ','\'',$(htmldir))
prefix_SQ = $(subst ','\'',$(prefix))

SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
Expand Down Expand Up @@ -795,7 +800,9 @@ git$X: git.o $(BUILTIN_OBJS) $(GITLIBS)
$(BUILTIN_OBJS) $(ALL_LDFLAGS) $(LIBS)

help.o: help.c common-cmds.h GIT-CFLAGS
$(QUIET_CC)$(CC) -o $*.o -c $(ALL_CFLAGS) '-DGIT_MAN_PATH="$(mandir_SQ)"' $<
$(QUIET_CC)$(CC) -o $*.o -c $(ALL_CFLAGS) \
'-DGIT_MAN_PATH="$(mandir_SQ)"' \
'-DGIT_INFO_PATH="$(infodir_SQ)"' $<

git-merge-subtree$X: git-merge-recursive$X
$(QUIET_BUILT_IN)$(RM) $@ && ln git-merge-recursive$X $@
Expand All @@ -814,6 +821,7 @@ $(patsubst %.sh,%,$(SCRIPT_SH)) : % : %.sh
-e 's|@@PERL@@|$(PERL_PATH_SQ)|g' \
-e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
-e 's/@@NO_CURL@@/$(NO_CURL)/g' \
-e 's|@@HTMLDIR@@|$(htmldir_SQ)|g' \
$@.sh >$@+ && \
chmod +x $@+ && \
mv $@+ $@
Expand Down
Loading

0 comments on commit 467f42c

Please sign in to comment.