Skip to content

Commit

Permalink
doc: generate a list of valid merge tools
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
davvid authored and gitster committed Feb 3, 2013
1 parent 665682c commit f35ec54
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 15 deletions.
1 change: 1 addition & 0 deletions Documentation/.gitignore
Expand Up @@ -9,4 +9,5 @@ gitman.info
howto-index.txt howto-index.txt
doc.dep doc.dep
cmds-*.txt cmds-*.txt
mergetools-*.txt
manpage-base-url.xsl manpage-base-url.xsl
22 changes: 20 additions & 2 deletions Documentation/Makefile
Expand Up @@ -202,7 +202,11 @@ install-html: html
# #
# Determine "include::" file references in asciidoc files. # Determine "include::" file references in asciidoc files.
# #
doc.dep : $(wildcard *.txt) build-docdep.perl docdep_prereqs = \
mergetools-list.made $(mergetools_txt) \
cmd-list.made $(cmds_txt)

doc.dep : $(docdep_prereqs) $(wildcard *.txt) build-docdep.perl
$(QUIET_GEN)$(RM) $@+ $@ && \ $(QUIET_GEN)$(RM) $@+ $@ && \
$(PERL_PATH) ./build-docdep.perl >$@+ $(QUIET_STDERR) && \ $(PERL_PATH) ./build-docdep.perl >$@+ $(QUIET_STDERR) && \
mv $@+ $@ mv $@+ $@
Expand All @@ -226,13 +230,27 @@ cmd-list.made: cmd-list.perl ../command-list.txt $(MAN1_TXT)
$(PERL_PATH) ./cmd-list.perl ../command-list.txt $(QUIET_STDERR) && \ $(PERL_PATH) ./cmd-list.perl ../command-list.txt $(QUIET_STDERR) && \
date >$@ date >$@


mergetools_txt = mergetools-diff.txt mergetools-merge.txt

$(mergetools_txt): mergetools-list.made

mergetools-list.made: ../git-mergetool--lib.sh $(wildcard ../mergetools/*)
$(QUIET_GEN)$(RM) $@ && \
$(SHELL_PATH) -c 'MERGE_TOOLS_DIR=../mergetools && \
. ../git-mergetool--lib.sh && \
show_tool_names can_diff "* " || :' >mergetools-diff.txt && \
$(SHELL_PATH) -c 'MERGE_TOOLS_DIR=../mergetools && \
. ../git-mergetool--lib.sh && \
show_tool_names can_merge "* " || :' >mergetools-merge.txt && \
date >$@

clean: clean:
$(RM) *.xml *.xml+ *.html *.html+ *.1 *.5 *.7 $(RM) *.xml *.xml+ *.html *.html+ *.1 *.5 *.7
$(RM) *.texi *.texi+ *.texi++ git.info gitman.info $(RM) *.texi *.texi+ *.texi++ git.info gitman.info
$(RM) *.pdf $(RM) *.pdf
$(RM) howto-index.txt howto/*.html doc.dep $(RM) howto-index.txt howto/*.html doc.dep
$(RM) technical/api-*.html technical/api-index.txt $(RM) technical/api-*.html technical/api-index.txt
$(RM) $(cmds_txt) *.made $(RM) $(cmds_txt) $(mergetools_txt) *.made
$(RM) manpage-base-url.xsl $(RM) manpage-base-url.xsl


$(MAN_HTML): %.html : %.txt $(MAN_HTML): %.html : %.txt
Expand Down
13 changes: 7 additions & 6 deletions Documentation/diff-config.txt
Expand Up @@ -132,9 +132,10 @@ diff.<driver>.cachetextconv::
conversion outputs. See linkgit:gitattributes[5] for details. conversion outputs. See linkgit:gitattributes[5] for details.


diff.tool:: diff.tool::
The diff tool to be used by linkgit:git-difftool[1]. This Controls which diff tool is used by linkgit:git-difftool[1].
option overrides `merge.tool`, and has the same valid built-in This variable overrides the value configured in `merge.tool`.
values as `merge.tool` minus "tortoisemerge" and plus The list below shows the valid built-in values.
"kompare". Any other value is treated as a custom diff tool, Any other value is treated as a custom diff tool and requires
and there must be a corresponding `difftool.<tool>.cmd` that a corresponding difftool.<tool>.cmd variable is defined.
option.
include::mergetools-diff.txt[]
12 changes: 6 additions & 6 deletions Documentation/merge-config.txt
Expand Up @@ -52,12 +52,12 @@ merge.stat::
at the end of the merge. True by default. at the end of the merge. True by default.


merge.tool:: merge.tool::
Controls which merge resolution program is used by Controls which merge tool is used by linkgit:git-mergetool[1].
linkgit:git-mergetool[1]. Valid built-in values are: "araxis", The list below shows the valid built-in values.
"bc3", "diffuse", "ecmerge", "emerge", "gvimdiff", "kdiff3", "meld", Any other value is treated as a custom merge tool and requires
"opendiff", "p4merge", "tkdiff", "tortoisemerge", "vimdiff" that a corresponding mergetool.<tool>.cmd variable is defined.
and "xxdiff". Any other value is treated is custom merge tool
and there must be a corresponding mergetool.<tool>.cmd option. include::mergetools-merge.txt[]


merge.verbosity:: merge.verbosity::
Controls the amount of output shown by the recursive merge Controls the amount of output shown by the recursive merge
Expand Down
3 changes: 2 additions & 1 deletion git-mergetool--lib.sh
@@ -1,6 +1,7 @@
#!/bin/sh #!/bin/sh
# git-mergetool--lib is a library for common merge tool functions # git-mergetool--lib is a library for common merge tool functions
MERGE_TOOLS_DIR=$(git --exec-path)/mergetools
: ${MERGE_TOOLS_DIR=$(git --exec-path)/mergetools}


mode_ok () { mode_ok () {
if diff_mode if diff_mode
Expand Down

0 comments on commit f35ec54

Please sign in to comment.