Skip to content

Commit 61ed71d

Browse files
davvidgitster
authored andcommitted
difftool--helper: Remove use of the GIT_MERGE_TOOL variable
An undocumented mis-feature in git-difftool is that it allows you to specify a default difftool by setting GIT_MERGE_TOOL. This behavior was never documented and was included as an oversight back when git-difftool was maintained outside of git. git-mergetool never honored GIT_MERGE_TOOL so neither should git-difftool. Signed-off-by: David Aguilar <davvid@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent db36713 commit 61ed71d

File tree

2 files changed

+4
-14
lines changed

2 files changed

+4
-14
lines changed

git-difftool--helper.sh

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,10 @@ launch_merge_tool () {
4040
run_merge_tool "$merge_tool"
4141
}
4242

43-
# Allow GIT_DIFF_TOOL and GIT_MERGE_TOOL to provide default values
44-
test -n "$GIT_MERGE_TOOL" && merge_tool="$GIT_MERGE_TOOL"
45-
test -n "$GIT_DIFF_TOOL" && merge_tool="$GIT_DIFF_TOOL"
46-
47-
if test -z "$merge_tool"; then
43+
# GIT_DIFF_TOOL indicates that --tool=... was specified
44+
if test -n "$GIT_DIFF_TOOL"; then
45+
merge_tool="$GIT_DIFF_TOOL"
46+
else
4847
merge_tool="$(get_merge_tool)" || exit
4948
fi
5049

t/t7800-difftool.sh

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ restore_test_defaults()
3232
# Restores the test defaults used by several tests
3333
remove_config_vars
3434
unset GIT_DIFF_TOOL
35-
unset GIT_MERGE_TOOL
3635
unset GIT_DIFFTOOL_PROMPT
3736
unset GIT_DIFFTOOL_NO_PROMPT
3837
git config diff.tool test-tool &&
@@ -107,15 +106,7 @@ test_expect_success 'GIT_DIFF_TOOL overrides' '
107106
git config diff.tool bogus-tool &&
108107
git config merge.tool bogus-tool &&
109108
110-
GIT_MERGE_TOOL=test-tool &&
111-
export GIT_MERGE_TOOL &&
112-
diff=$(git difftool --no-prompt branch) &&
113-
test "$diff" = "branch" &&
114-
unset GIT_MERGE_TOOL &&
115-
116-
GIT_MERGE_TOOL=bogus-tool &&
117109
GIT_DIFF_TOOL=test-tool &&
118-
export GIT_MERGE_TOOL &&
119110
export GIT_DIFF_TOOL &&
120111
121112
diff=$(git difftool --no-prompt branch) &&

0 commit comments

Comments
 (0)