mergetool--lib: simplify API usage by removing more global variables

The mergetool--lib scriplet was tricky to use because it relied upon
the existance of several global shell variables.  This removes more
global variables so that things are simpler for callers.

A side effect is that some variables are recomputed each time
run_merge_tool() is called, but the overhead for recomputing
them is justified by the simpler implementation.

Signed-off-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
David Aguilar
2009-04-11 20:41:56 -07:00
committed by Junio C Hamano
parent 70af4e9bef
commit 47d65924a6
4 changed files with 77 additions and 71 deletions

View File

@ -47,9 +47,9 @@ launch_merge_tool () {
test -n "$GIT_MERGE_TOOL" && merge_tool="$GIT_MERGE_TOOL"
test -n "$GIT_DIFF_TOOL" && merge_tool="$GIT_DIFF_TOOL"
merge_tool=$(get_merge_tool "$merge_tool") || exit
merge_tool_cmd="$(get_merge_tool_cmd "$merge_tool")"
merge_tool_path="$(get_merge_tool_path "$merge_tool")" || exit
if test -z "$merge_tool"; then
merge_tool="$(get_merge_tool)" || exit
fi
# Launch the merge tool on each path provided by 'git diff'
while test $# -gt 6