diff options
author | Denton Liu <liu.denton@gmail.com> | 2019-04-29 02:21:08 -0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2019-05-13 23:11:59 +0900 |
commit | 05fb8726cccc74908853c166248ff9b6abdafae5 (patch) | |
tree | e879f61c63d326d264ab6911fd8e32e6445610e4 /Documentation/git-mergetool--lib.txt | |
parent | 57d93c1d2ce7deddf485e7c826278fef6815ec6b (diff) | |
download | git-05fb8726cccc74908853c166248ff9b6abdafae5.tar.gz |
mergetool: use get_merge_tool function
In git-mergetool, the logic for getting which merge tool to use is
duplicated in git-mergetool--lib, except for the fact that it needs to
know whether the tool was guessed or not.
Rewrite `get_merge_tool` to return whether or not the tool was guessed
through the return code and make git-mergetool call this function
instead of duplicating the logic. Note that 1 was chosen to be the
return code of when a tool is guessed because it seems like a slightly
more abnormal condition than getting a tool that's explicitly specified
but this is completely arbitrary.
Also, let `$GIT_MERGETOOL_GUI` be set to determine whether or not the
guitool will be selected.
This change is not completely backwards compatible as there may be
external users of git-mergetool--lib. However, only one user,
git-diffall[1], was found from searching GitHub and Google, and this
tool is superseded by `git difftool --dir-diff` anyway. It seems very
unlikely that there exists an external caller that would take into
account the return code of `get_merge_tool` as it would always return 0
before this change so this change probably does not affect any external
users.
[1]: https://github.com/thenigan/git-diffall
Signed-off-by: Denton Liu <liu.denton@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'Documentation/git-mergetool--lib.txt')
-rw-r--r-- | Documentation/git-mergetool--lib.txt | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Documentation/git-mergetool--lib.txt b/Documentation/git-mergetool--lib.txt index 055550b2bc..4da9d24096 100644 --- a/Documentation/git-mergetool--lib.txt +++ b/Documentation/git-mergetool--lib.txt @@ -28,7 +28,9 @@ to define the operation mode for the functions listed below. FUNCTIONS --------- get_merge_tool:: - returns a merge tool. + returns a merge tool. the return code is 1 if we returned a guessed + merge tool, else 0. '$GIT_MERGETOOL_GUI' may be set to 'true' to + search for the appropriate guitool. get_merge_tool_cmd:: returns the custom command for a merge tool. |