doc: generate a list of valid merge tools

Use the show_tool_names() function to build lists of all the built-in tools supported by difftool and mergetool. This frees us from needing to update the documentation whenever a new tool is added. Signed-off-by: David Aguilar <davvid@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

David Aguilar committed Jan 27, 2013 at 16:52 UTC f35ec546008e8390e0fd8e545680e72fae0efa35
5 files changed +36 -15
Documentation/.gitignore
+1
@@ -9,4 +9,5 @@ gitman.info
9 howto-index.txt
10 doc.dep
11 cmds-*.txt
12 +mergetools-*.txt
13 manpage-base-url.xsl
Documentation/Makefile
+20 -2
@@ -202,7 +202,11 @@ install-html: html
202 #
203 # Determine "include::" file references in asciidoc files.
204 #
205 -doc.dep : $(wildcard *.txt) build-docdep.perl
205 +docdep_prereqs = \
206 + mergetools-list.made $(mergetools_txt) \
207 + cmd-list.made $(cmds_txt)
208 +
209 +doc.dep : $(docdep_prereqs) $(wildcard *.txt) build-docdep.perl
210 $(QUIET_GEN)$(RM) $@+ $@ && \
211 $(PERL_PATH) ./build-docdep.perl >$@+ $(QUIET_STDERR) && \
212 mv $@+ $@
@@ -226,13 +230,27 @@ cmd-list.made: cmd-list.perl ../command-list.txt $(MAN1_TXT)
230 $(PERL_PATH) ./cmd-list.perl ../command-list.txt $(QUIET_STDERR) && \
231 date >$@
232
233 +mergetools_txt = mergetools-diff.txt mergetools-merge.txt
234 +
235 +$(mergetools_txt): mergetools-list.made
236 +
237 +mergetools-list.made: ../git-mergetool--lib.sh $(wildcard ../mergetools/*)
238 + $(QUIET_GEN)$(RM) $@ && \
239 + $(SHELL_PATH) -c 'MERGE_TOOLS_DIR=../mergetools && \
240 + . ../git-mergetool--lib.sh && \
241 + show_tool_names can_diff "* " || :' >mergetools-diff.txt && \
242 + $(SHELL_PATH) -c 'MERGE_TOOLS_DIR=../mergetools && \
243 + . ../git-mergetool--lib.sh && \
244 + show_tool_names can_merge "* " || :' >mergetools-merge.txt && \
245 + date >$@
246 +
247 clean:
248 $(RM) *.xml *.xml+ *.html *.html+ *.1 *.5 *.7
249 $(RM) *.texi *.texi+ *.texi++ git.info gitman.info
250 $(RM) *.pdf
251 $(RM) howto-index.txt howto/*.html doc.dep
252 $(RM) technical/api-*.html technical/api-index.txt
235 - $(RM) $(cmds_txt) *.made
253 + $(RM) $(cmds_txt) $(mergetools_txt) *.made
254 $(RM) manpage-base-url.xsl
255
256 $(MAN_HTML): %.html : %.txt
Documentation/diff-config.txt
+7 -6
@@ -132,9 +132,10 @@ diff.<driver>.cachetextconv::
132 conversion outputs. See linkgit:gitattributes[5] for details.
133
134 diff.tool::
135 - The diff tool to be used by linkgit:git-difftool[1]. This
136 - option overrides `merge.tool`, and has the same valid built-in
137 - values as `merge.tool` minus "tortoisemerge" and plus
138 - "kompare". Any other value is treated as a custom diff tool,
139 - and there must be a corresponding `difftool.<tool>.cmd`
140 - option.
135 + Controls which diff tool is used by linkgit:git-difftool[1].
136 + This variable overrides the value configured in `merge.tool`.
137 + The list below shows the valid built-in values.
138 + Any other value is treated as a custom diff tool and requires
139 + that a corresponding difftool.<tool>.cmd variable is defined.
140 +
141 +include::mergetools-diff.txt[]
Documentation/merge-config.txt
+6 -6
@@ -52,12 +52,12 @@ merge.stat::
52 at the end of the merge. True by default.
53
54 merge.tool::
55 - Controls which merge resolution program is used by
56 - linkgit:git-mergetool[1]. Valid built-in values are: "araxis",
57 - "bc3", "diffuse", "ecmerge", "emerge", "gvimdiff", "kdiff3", "meld",
58 - "opendiff", "p4merge", "tkdiff", "tortoisemerge", "vimdiff"
59 - and "xxdiff". Any other value is treated is custom merge tool
60 - and there must be a corresponding mergetool.<tool>.cmd option.
55 + Controls which merge tool is used by linkgit:git-mergetool[1].
56 + The list below shows the valid built-in values.
57 + Any other value is treated as a custom merge tool and requires
58 + that a corresponding mergetool.<tool>.cmd variable is defined.
59 +
60 +include::mergetools-merge.txt[]
61
62 merge.verbosity::
63 Controls the amount of output shown by the recursive merge
git-mergetool--lib.sh
+2 -1
@@ -1,6 +1,7 @@
1 #!/bin/sh
2 # git-mergetool--lib is a library for common merge tool functions
3 -MERGE_TOOLS_DIR=$(git --exec-path)/mergetools
3 +
4 +: ${MERGE_TOOLS_DIR=$(git --exec-path)/mergetools}
5
6 mode_ok () {
7 if diff_mode