diff options
author | Vincent Ambo <mail@tazj.in> | 2020-11-21T18·20+0100 |
---|---|---|
committer | Vincent Ambo <mail@tazj.in> | 2020-11-21T18·45+0100 |
commit | f4609b896fac842433bd495c166d5987852a6a73 (patch) | |
tree | 95511c465c54c4f5d27e5d39ce187e2a1dd82bd3 /third_party/git/mergetools | |
parent | 082c006c04343a78d87b6c6ab3608c25d6213c3f (diff) |
merge(3p/git): Merge git subtree at v2.29.2 r/1890
This also bumps the stable nixpkgs to 20.09 as of 2020-11-21, because there is some breakage in the git build related to the netrc credentials helper which someone has taken care of in nixpkgs. The stable channel is not used for anything other than git, so this should be fine. Change-Id: I3575a19dab09e1e9556cf8231d717de9890484fb
Diffstat (limited to 'third_party/git/mergetools')
-rw-r--r-- | third_party/git/mergetools/bc | 5 | ||||
-rw-r--r-- | third_party/git/mergetools/bc3 | 1 | ||||
-rw-r--r-- | third_party/git/mergetools/gvimdiff3 | 1 | ||||
-rw-r--r-- | third_party/git/mergetools/meld | 85 | ||||
-rw-r--r-- | third_party/git/mergetools/nvimdiff (renamed from third_party/git/mergetools/gvimdiff2) | 0 | ||||
-rw-r--r-- | third_party/git/mergetools/vimdiff | 21 | ||||
-rw-r--r-- | third_party/git/mergetools/vimdiff2 | 1 | ||||
-rw-r--r-- | third_party/git/mergetools/vimdiff3 | 1 |
8 files changed, 90 insertions, 25 deletions
diff --git a/third_party/git/mergetools/bc b/third_party/git/mergetools/bc index 3a69e60faa9c..a89086ee720f 100644 --- a/third_party/git/mergetools/bc +++ b/third_party/git/mergetools/bc @@ -21,3 +21,8 @@ translate_merge_tool_path() { echo bcompare fi } + +list_tool_variants () { + echo bc + echo bc3 +} diff --git a/third_party/git/mergetools/bc3 b/third_party/git/mergetools/bc3 deleted file mode 100644 index 5d8dd4818488..000000000000 --- a/third_party/git/mergetools/bc3 +++ /dev/null @@ -1 +0,0 @@ -. "$MERGE_TOOLS_DIR/bc" diff --git a/third_party/git/mergetools/gvimdiff3 b/third_party/git/mergetools/gvimdiff3 deleted file mode 100644 index 04a5bb0ea848..000000000000 --- a/third_party/git/mergetools/gvimdiff3 +++ /dev/null @@ -1 +0,0 @@ -. "$MERGE_TOOLS_DIR/vimdiff" diff --git a/third_party/git/mergetools/meld b/third_party/git/mergetools/meld index 7a08470f8836..aab4ebb9355a 100644 --- a/third_party/git/mergetools/meld +++ b/third_party/git/mergetools/meld @@ -3,34 +3,87 @@ diff_cmd () { } merge_cmd () { - if test -z "${meld_has_output_option:+set}" + check_meld_for_features + + option_auto_merge= + if test "$meld_use_auto_merge_option" = true then - check_meld_for_output_version + option_auto_merge="--auto-merge" fi if test "$meld_has_output_option" = true then - "$merge_tool_path" --output="$MERGED" \ + "$merge_tool_path" $option_auto_merge --output="$MERGED" \ "$LOCAL" "$BASE" "$REMOTE" else - "$merge_tool_path" "$LOCAL" "$MERGED" "$REMOTE" + "$merge_tool_path" $option_auto_merge "$LOCAL" "$MERGED" "$REMOTE" fi } -# Check whether we should use 'meld --output <file>' -check_meld_for_output_version () { - meld_path="$(git config mergetool.meld.path)" - meld_path="${meld_path:-meld}" +# Get meld help message +init_meld_help_msg () { + if test -z "$meld_help_msg" + then + meld_path="$(git config mergetool.meld.path || echo meld)" + meld_help_msg=$("$meld_path" --help 2>&1) + fi +} - if meld_has_output_option=$(git config --bool mergetool.meld.hasOutput) +# Check the features and set flags +check_meld_for_features () { + # Check whether we should use 'meld --output <file>' + if test -z "$meld_has_output_option" then - : use configured value - elif "$meld_path" --help 2>&1 | - grep -e '--output=' -e '\[OPTION\.\.\.\]' >/dev/null + meld_has_output_option=$(git config --bool mergetool.meld.hasOutput) + case "$meld_has_output_option" in + true | false) + : use configured value + ;; + *) + : empty or invalid configured value, detecting "--output" automatically + init_meld_help_msg + + case "$meld_help_msg" in + *"--output="* | *'[OPTION...]'*) + # All version that has [OPTION...] supports --output + meld_has_output_option=true + ;; + *) + meld_has_output_option=false + ;; + esac + ;; + esac + fi + # Check whether we should use 'meld --auto-merge ...' + if test -z "$meld_use_auto_merge_option" then - : old ones mention --output and new ones just say OPTION... - meld_has_output_option=true - else - meld_has_output_option=false + meld_use_auto_merge_option=$( + git config --bool-or-str mergetool.meld.useAutoMerge + ) + case "$meld_use_auto_merge_option" in + true | false) + : use well formatted boolean value + ;; + auto) + # testing the "--auto-merge" option only if config is "auto" + init_meld_help_msg + + case "$meld_help_msg" in + *"--auto-merge"* | *'[OPTION...]'*) + meld_use_auto_merge_option=true + ;; + *) + meld_use_auto_merge_option=false + ;; + esac + ;; + "") + meld_use_auto_merge_option=false + ;; + *) + die "unknown mergetool.meld.useAutoMerge: $meld_use_auto_merge_option" + ;; + esac fi } diff --git a/third_party/git/mergetools/gvimdiff2 b/third_party/git/mergetools/nvimdiff index 04a5bb0ea848..04a5bb0ea848 100644 --- a/third_party/git/mergetools/gvimdiff2 +++ b/third_party/git/mergetools/nvimdiff diff --git a/third_party/git/mergetools/vimdiff b/third_party/git/mergetools/vimdiff index 10d86f3e1930..abc8ce4ec44e 100644 --- a/third_party/git/mergetools/vimdiff +++ b/third_party/git/mergetools/vimdiff @@ -5,7 +5,7 @@ diff_cmd () { merge_cmd () { case "$1" in - gvimdiff|vimdiff) + *vimdiff) if $base_present then "$merge_tool_path" -f -d -c '4wincmd w | wincmd J' \ @@ -15,11 +15,11 @@ merge_cmd () { "$LOCAL" "$MERGED" "$REMOTE" fi ;; - gvimdiff2|vimdiff2) + *vimdiff2) "$merge_tool_path" -f -d -c 'wincmd l' \ "$LOCAL" "$MERGED" "$REMOTE" ;; - gvimdiff3|vimdiff3) + *vimdiff3) if $base_present then "$merge_tool_path" -f -d -c 'hid | hid | hid' \ @@ -34,10 +34,13 @@ merge_cmd () { translate_merge_tool_path() { case "$1" in - gvimdiff|gvimdiff2|gvimdiff3) + nvimdiff*) + echo nvim + ;; + gvimdiff*) echo gvim ;; - vimdiff|vimdiff2|vimdiff3) + vimdiff*) echo vim ;; esac @@ -46,3 +49,11 @@ translate_merge_tool_path() { exit_code_trustable () { true } + +list_tool_variants () { + for prefix in '' g n; do + for suffix in '' 2 3; do + echo "${prefix}vimdiff${suffix}" + done + done +} diff --git a/third_party/git/mergetools/vimdiff2 b/third_party/git/mergetools/vimdiff2 deleted file mode 100644 index 04a5bb0ea848..000000000000 --- a/third_party/git/mergetools/vimdiff2 +++ /dev/null @@ -1 +0,0 @@ -. "$MERGE_TOOLS_DIR/vimdiff" diff --git a/third_party/git/mergetools/vimdiff3 b/third_party/git/mergetools/vimdiff3 deleted file mode 100644 index 04a5bb0ea848..000000000000 --- a/third_party/git/mergetools/vimdiff3 +++ /dev/null @@ -1 +0,0 @@ -. "$MERGE_TOOLS_DIR/vimdiff" |