Skip to content

Commit

Permalink
docs: fix cross-directory linkgit references
Browse files Browse the repository at this point in the history
Most of our documentation is in a single directory, so using
linkgit:git-config[1] just generates a relative link in the
same directory. However, this is not the case with the API
documentation in technical/*, which need to refer to
git-config from the parent directory.

We can fix this by passing a special prefix attribute when building
in a subdirectory, and respecting that prefix in our linkgit
definitions.

We only have to modify the html linkgit definition.  For
manpages, we can ignore this for two reasons:

  1. we do not generate actual links to the file in
     manpages, but instead just give the name and section of
     the linked manpage

  2. we do not currently build manpages for subdirectories,
     only html

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Jeff King authored and Junio C Hamano committed Jun 8, 2012
1 parent 04ab6ae commit fe77b41
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 6 deletions.
2 changes: 2 additions & 0 deletions Documentation/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@ technical/api-index.txt: technical/api-index-skel.txt \
technical/api-index.sh $(patsubst %,%.txt,$(API_DOCS))
$(QUIET_GEN)cd technical && '$(SHELL_PATH_SQ)' ./api-index.sh

technical/%.html: ASCIIDOC_EXTRA += -a git-relative-html-prefix=../
$(patsubst %,%.html,$(API_DOCS) technical/api-index): %.html : %.txt
$(QUIET_ASCIIDOC)$(ASCIIDOC) -b xhtml11 -f asciidoc.conf \
$(ASCIIDOC_EXTRA) -agit_version=$(GIT_VERSION) $*.txt
Expand Down Expand Up @@ -323,6 +324,7 @@ $(patsubst %,%.html,$(ARTICLES)) : %.html : %.txt

WEBDOC_DEST = /pub/software/scm/git/docs

howto/%.html: ASCIIDOC_EXTRA += -a git-relative-html-prefix=../
$(patsubst %.txt,%.html,$(wildcard howto/*.txt)): %.html : %.txt
$(QUIET_ASCIIDOC)$(RM) $@+ $@ && \
sed -e '1,/^$$/d' $< | $(ASCIIDOC) $(ASCIIDOC_EXTRA) -b xhtml11 - >$@+ && \
Expand Down
2 changes: 1 addition & 1 deletion Documentation/asciidoc.conf
Original file line number Diff line number Diff line change
Expand Up @@ -91,5 +91,5 @@ endif::doctype-manpage[]

ifdef::backend-xhtml11[]
[linkgit-inlinemacro]
<a href="{target}.html">{target}{0?({0})}</a>
<a href="{git-relative-html-prefix}{target}.html">{target}{0?({0})}</a>
endif::backend-xhtml11[]
2 changes: 1 addition & 1 deletion Documentation/technical/api-config.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ config API
==========

The config API gives callers a way to access git configuration files
(and files which have the same syntax). See linkgit:../git-config[1] for a
(and files which have the same syntax). See linkgit:git-config[1] for a
discussion of the config file syntax.

General Usage
Expand Down
6 changes: 3 additions & 3 deletions Documentation/technical/api-credentials.txt
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ longer than a single git process; e.g., credentials may be stored
in-memory for a few minutes, or indefinitely on disk).

Each helper is specified by a single string in the configuration
variable `credential.helper` (and others, see linkgit:../git-config[1]).
variable `credential.helper` (and others, see linkgit:git-config[1]).
The string is transformed by git into a command to be executed using
these rules:

Expand Down Expand Up @@ -293,6 +293,6 @@ helpers will just ignore the new requests).
See also
--------

linkgit:../gitcredentials[7]
linkgit:gitcredentials[7]

linkgit:../git-config[5] (See configuration variables `credential.*`)
linkgit:git-config[5] (See configuration variables `credential.*`)
2 changes: 1 addition & 1 deletion Documentation/technical/api-merge.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ the operation of a low-level (single file) merge. Some options:
ancestors in a recursive merge.
If a helper program is specified by the
`[merge "<driver>"] recursive` configuration, it will
be used (see linkgit:../gitattributes[5]).
be used (see linkgit:gitattributes[5]).

`variant`::
Resolve local conflicts automatically in favor
Expand Down

0 comments on commit fe77b41

Please sign in to comment.