mergetool--lib: consolidate the last redundant bits in {diff,merge}tool
PATCH 1/1 mergetool--lib: consolidate the last redundant bits in {diff,merge}tool
This adds get_merge_tool, get_merge_tool_path, get_merge_tool_cmd and uses them in git-mergetool and git-difftool--helper.
Signed-off-by David Aguilar <[email protected]>
--- Documentation/git-mergetool--lib.txt | 22 ++++--- git-difftool--helper.sh | 80 ++------------------------ git-mergetool--lib.sh | 106 +++++++++++++++++++++++++++++++-- git-mergetool.sh | 65 ++------------------ t/t7800-difftool.sh | 8 +++ 5 files changed, 132 insertions(+), 149 deletions(-)
Documentation/git-mergetool--lib.txt +13 -9
@@ -26,18 +26,22 @@ functions. 'diff' and 'merge' are valid values. FUNCTIONS --------- -get_merge_tool_path:: - returns the `merge_tool_path` for a `merge_tool`. +get_merge_tool:: + returns a merge tool -run_mergetool:: - launches a merge tool given the tool name and a true/false - flag to indicate whether a merge base is present +get_merge_tool_cmd:: + returns the custom command for a merge tool. -valid_tool:: - tests whether a merge tool is setup correctly. +get_merge_tool_path:: + returns the custom path for a merge tool. -get_custom_cmd:: - given a merge tool, returns the custom command for that tool. +run_merge_tool:: + launches a merge tool given the tool name and a true/false + flag to indicate whether a merge base is present. + '$merge_tool', '$merge_tool_path', and for custom commands, + '$merge_tool_cmd', must be defined prior to calling + run_merge_tool. Additionally, '$MERGED', '$LOCAL', '$REMOTE', + and '$BASE' must be defined for use by the merge tool. Author ------
git-difftool--helper.sh +5 -75
98 lines not on this page · raw message
git-mergetool--lib.sh +99 -7
140 lines not on this page · raw message
git-mergetool.sh +7 -58
77 lines not on this page · raw message
t/t7800-difftool.sh +8 -0
@@ -200,4 +200,12 @@ test_expect_success 'difftool + mergetool config variables' ' restore_test_defaults ' +test_expect_success 'difftool.<tool>.path' ' + git config difftool.tkdiff.path echo && + diff=$(git difftool -y -t tkdiff branch) && + git config --unset difftool.tkdiff.path && + lines=$(echo "$diff" | grep file | wc -l) && + test "$lines" = 1 +' + test_done
Signature · 1 line
1.6.2.1.469.gdffc1