Skip to content

Commit

Permalink
difftool--helper: Remove use of the GIT_MERGE_TOOL variable
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
davvid authored and gitster committed Jan 10, 2010
1 parent db36713 commit 61ed71d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 14 deletions.
9 changes: 4 additions & 5 deletions git-difftool--helper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,10 @@ launch_merge_tool () {
run_merge_tool "$merge_tool"
}

# Allow GIT_DIFF_TOOL and GIT_MERGE_TOOL to provide default values
test -n "$GIT_MERGE_TOOL" && merge_tool="$GIT_MERGE_TOOL"
test -n "$GIT_DIFF_TOOL" && merge_tool="$GIT_DIFF_TOOL"

if test -z "$merge_tool"; then
# GIT_DIFF_TOOL indicates that --tool=... was specified
if test -n "$GIT_DIFF_TOOL"; then
merge_tool="$GIT_DIFF_TOOL"
else
merge_tool="$(get_merge_tool)" || exit
fi

Expand Down
9 changes: 0 additions & 9 deletions t/t7800-difftool.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ restore_test_defaults()
# Restores the test defaults used by several tests
remove_config_vars
unset GIT_DIFF_TOOL
unset GIT_MERGE_TOOL
unset GIT_DIFFTOOL_PROMPT
unset GIT_DIFFTOOL_NO_PROMPT
git config diff.tool test-tool &&
Expand Down Expand Up @@ -107,15 +106,7 @@ test_expect_success 'GIT_DIFF_TOOL overrides' '
git config diff.tool bogus-tool &&
git config merge.tool bogus-tool &&
GIT_MERGE_TOOL=test-tool &&
export GIT_MERGE_TOOL &&
diff=$(git difftool --no-prompt branch) &&
test "$diff" = "branch" &&
unset GIT_MERGE_TOOL &&
GIT_MERGE_TOOL=bogus-tool &&
GIT_DIFF_TOOL=test-tool &&
export GIT_MERGE_TOOL &&
export GIT_DIFF_TOOL &&
diff=$(git difftool --no-prompt branch) &&
Expand Down

0 comments on commit 61ed71d

Please sign in to comment.