mergetool--lib: Fix misspelled mergetool.keepBackup
PATCH 1/2 mergetool--lib: Fix misspelled mergetool.keepBackup
From: Ferry Huberts <[email protected]>
In several places mergetool.keepBackup was misspelled as merge.keepBackup.
---
This is Ferry's patch with Junio's suggested commit message. Based on pu.
git-mergetool.sh | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
git-mergetool.sh +1 -1
@@ -257,7 +257,7 @@ prompt_after_failed_merge() { 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 -merge_keep_backup="$(git config --bool merge.keepBackup || echo true)" +merge_keep_backup="$(git config --bool mergetool.keepBackup || echo true)" merge_keep_temporaries="$(git config --bool mergetool.keepTemporaries || echo false)" merge_tool_trust_exit_code="$(git config --bool mergetool."$merge_tool".trustExitCode || echo false)"
Signature · 1 line
1.6.2.2.471.g6da14
PATCH 2/2 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.
---
This addresses Charles' notes by making the mergetool--lib simpler to use.
We can now simply use:
get_merge_tool
get_merge_tool_path
get_merge_tool_cmd
and things will work consistently.
Previous versions used global variables that would give unexpected results if they had been set previously.
Documentation/git-mergetool--lib.txt | 16 ++--- git-difftool--helper.sh | 6 +- git-mergetool--lib.sh | 109 ++++++++++++++++++---------------- git-mergetool.sh | 15 +++-- 4 files changed, 76 insertions(+), 70 deletions(-)
Documentation/git-mergetool--lib.txt +7 -9
@@ -7,7 +7,7 @@ git-mergetool--lib - Common git merge tool shell scriptlets SYNOPSIS -------- -'. "$(git --exec-path)/git-mergetool--lib"' +'TOOL_MODE=(diff|merge) . "$(git --exec-path)/git-mergetool--lib"' DESCRIPTION -----------
@@ -20,14 +20,14 @@ The 'git-mergetool--lib' scriptlet is designed to be sourced (using `.`) by other shell scripts to set up functions for working with git merge tools. -Before sourcing it, your script should set up a few variables; -`TOOL_MODE` is used to define the operation mode for various -functions. 'diff' and 'merge' are valid values. +Before sourcing 'git-mergetool--lib', your script must set `TOOL_MODE` +to define the operation mode for the functions listed below. +'diff' and 'merge' are valid values. FUNCTIONS --------- get_merge_tool:: - returns a merge tool + returns a merge tool. get_merge_tool_cmd:: returns the custom command for a merge tool.
@@ -38,10 +38,8 @@ get_merge_tool_path:: 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. + '$MERGED', '$LOCAL', '$REMOTE', and '$BASE' must be defined + for use by the merge tool. Author ------
git-difftool--helper.sh +3 -3
@@ -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
git-mergetool--lib.sh +58 -51
184 lines not on this page · raw message
git-mergetool.sh +8 -7
@@ -174,9 +174,11 @@ merge_file () { read ans fi - present=false - base_present && - present=true + if base_present; then + present=true + else + present=false + fi if ! run_merge_tool "$merge_tool" "$present"; then echo "merge of $MERGED failed" 1>&2
@@ -254,12 +256,11 @@ prompt_after_failed_merge() { done } -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 "$merge_tool") || exit +fi merge_keep_backup="$(git config --bool mergetool.keepBackup || echo true)" merge_keep_temporaries="$(git config --bool mergetool.keepTemporaries || echo false)" -merge_tool_trust_exit_code="$(git config --bool mergetool."$merge_tool".trustExitCode || echo false)" last_status=0 rollup_status=0
Signature · 1 line
1.6.2.2.471.g6da14