Skip to content

Commit f35ec54

Browse files
davvidgitster
authored andcommitted
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>
1 parent 665682c commit f35ec54

File tree

5 files changed

+36
-15
lines changed

5 files changed

+36
-15
lines changed

Documentation/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@ gitman.info
99
howto-index.txt
1010
doc.dep
1111
cmds-*.txt
12+
mergetools-*.txt
1213
manpage-base-url.xsl

Documentation/Makefile

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,11 @@ install-html: html
202202
#
203203
# Determine "include::" file references in asciidoc files.
204204
#
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
206210
$(QUIET_GEN)$(RM) $@+ $@ && \
207211
$(PERL_PATH) ./build-docdep.perl >$@+ $(QUIET_STDERR) && \
208212
mv $@+ $@
@@ -226,13 +230,27 @@ cmd-list.made: cmd-list.perl ../command-list.txt $(MAN1_TXT)
226230
$(PERL_PATH) ./cmd-list.perl ../command-list.txt $(QUIET_STDERR) && \
227231
date >$@
228232

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+
229247
clean:
230248
$(RM) *.xml *.xml+ *.html *.html+ *.1 *.5 *.7
231249
$(RM) *.texi *.texi+ *.texi++ git.info gitman.info
232250
$(RM) *.pdf
233251
$(RM) howto-index.txt howto/*.html doc.dep
234252
$(RM) technical/api-*.html technical/api-index.txt
235-
$(RM) $(cmds_txt) *.made
253+
$(RM) $(cmds_txt) $(mergetools_txt) *.made
236254
$(RM) manpage-base-url.xsl
237255

238256
$(MAN_HTML): %.html : %.txt

Documentation/diff-config.txt

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,10 @@ diff.<driver>.cachetextconv::
132132
conversion outputs. See linkgit:gitattributes[5] for details.
133133

134134
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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,12 @@ merge.stat::
5252
at the end of the merge. True by default.
5353

5454
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[]
6161

6262
merge.verbosity::
6363
Controls the amount of output shown by the recursive merge

git-mergetool--lib.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/bin/sh
22
# 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}
45

56
mode_ok () {
67
if diff_mode

0 commit comments

Comments
 (0)