summaryrefslogtreecommitdiff
path: root/git-mergetool--lib.sh
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2014-12-12 14:31:39 -0800
committerLibravatar Junio C Hamano <gitster@pobox.com>2014-12-12 14:31:39 -0800
commit0ddedd4d6b9b3e8eb3557d8ed28e1a0b354a25f8 (patch)
treebec8ec6f7d910bce51a681bb81a601709d95c54a /git-mergetool--lib.sh
parentMerge branch 'jk/colors-fix' (diff)
parentmergetools: stop setting $status in merge_cmd() (diff)
downloadtgif-0ddedd4d6b9b3e8eb3557d8ed28e1a0b354a25f8.tar.xz
Merge branch 'da/difftool-mergetool-simplify-reporting-status'
Code simplification. * da/difftool-mergetool-simplify-reporting-status: mergetools: stop setting $status in merge_cmd() mergetool: simplify conditionals difftool--helper: add explicit exit statement mergetool--lib: remove use of $status global mergetool--lib: remove no-op assignment to $status from setup_user_tool
Diffstat (limited to 'git-mergetool--lib.sh')
-rw-r--r--git-mergetool--lib.sh20
1 files changed, 5 insertions, 15 deletions
diff --git a/git-mergetool--lib.sh b/git-mergetool--lib.sh
index 2b6635130a..fe61e89f31 100644
--- a/git-mergetool--lib.sh
+++ b/git-mergetool--lib.sh
@@ -92,7 +92,7 @@ translate_merge_tool_path () {
check_unchanged () {
if test "$MERGED" -nt "$BACKUP"
then
- status=0
+ return 0
else
while true
do
@@ -100,8 +100,8 @@ check_unchanged () {
printf "Was the merge successful? [y/n] "
read answer || return 1
case "$answer" in
- y*|Y*) status=0; break ;;
- n*|N*) status=1; break ;;
+ y*|Y*) return 0 ;;
+ n*|N*) return 1 ;;
esac
done
fi
@@ -119,8 +119,6 @@ setup_user_tool () {
diff_cmd () {
( eval $merge_tool_cmd )
- status=$?
- return $status
}
merge_cmd () {
@@ -130,13 +128,10 @@ setup_user_tool () {
then
touch "$BACKUP"
( eval $merge_tool_cmd )
- status=$?
check_unchanged
else
( eval $merge_tool_cmd )
- status=$?
fi
- return $status
}
}
@@ -153,13 +148,11 @@ setup_tool () {
}
diff_cmd () {
- status=1
- return $status
+ return 1
}
merge_cmd () {
- status=1
- return $status
+ return 1
}
translate_merge_tool_path () {
@@ -210,7 +203,6 @@ run_merge_tool () {
merge_tool_path=$(get_merge_tool_path "$1") || exit
base_present="$2"
- status=0
# Bring tool-specific functions into scope
setup_tool "$1" || return 1
@@ -221,8 +213,6 @@ run_merge_tool () {
else
run_diff_cmd "$1"
fi
- status=$?
- return $status
}
# Run a either a configured or built-in diff tool