worktree: stop being overly intimate with run_command() internals
[git.git] / mergetools / vimdiff
blob96f6209a04106fbe8b66e30d5fefd0c8e92fb685
1 diff_cmd () {
2         "$merge_tool_path" -R -f -d \
3                 -c 'wincmd l' -c 'cd $GIT_PREFIX' "$LOCAL" "$REMOTE"
6 merge_cmd () {
7         case "$1" in
8         *vimdiff)
9                 if $base_present
10                 then
11                         "$merge_tool_path" -f -d -c '4wincmd w | wincmd J' \
12                                 "$LOCAL" "$BASE" "$REMOTE" "$MERGED"
13                 else
14                         "$merge_tool_path" -f -d -c 'wincmd l' \
15                                 "$LOCAL" "$MERGED" "$REMOTE"
16                 fi
17                 ;;
18         *vimdiff1)
19                 "$merge_tool_path" -f -d \
20                         -c 'echon "Resolve conflicts leftward then save. Use :cq to abort."' \
21                         "$LOCAL" "$REMOTE"
22                 ret="$?"
23                 if test "$ret" -eq 0
24                 then
25                         cp -- "$LOCAL" "$MERGED"
26                 fi
27                 return "$ret"
28                 ;;
29         *vimdiff2)
30                 "$merge_tool_path" -f -d -c 'wincmd l' \
31                         "$LOCAL" "$MERGED" "$REMOTE"
32                 ;;
33         *vimdiff3)
34                 if $base_present
35                 then
36                         "$merge_tool_path" -f -d -c 'hid | hid | hid' \
37                                 "$LOCAL" "$REMOTE" "$BASE" "$MERGED"
38                 else
39                         "$merge_tool_path" -f -d -c 'hid | hid' \
40                                 "$LOCAL" "$REMOTE" "$MERGED"
41                 fi
42                 ;;
43         esac
46 translate_merge_tool_path() {
47         case "$1" in
48         nvimdiff*)
49                 echo nvim
50                 ;;
51         gvimdiff*)
52                 echo gvim
53                 ;;
54         vimdiff*)
55                 echo vim
56                 ;;
57         esac
60 exit_code_trustable () {
61         true
64 list_tool_variants () {
65         for prefix in '' g n; do
66                 for suffix in '' 1 2 3; do
67                         echo "${prefix}vimdiff${suffix}"
68                 done
69         done