Skip to content

Commit 853c0ff

Browse files
Michael J Grubergitster
authored andcommitted
mergetool-lib: call vim in readonly mode for diffs
When [g]vimdiff is called for files which are opened already, the editor complains about the existing swap file. But we do not want to write anything when called from difftool. So, make difftool use "-R" for the vim family. This - prevents the use of a swap file and - marks the buffers readonly. Signed-off-by: Michael J Gruber <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 7ed863a commit 853c0ff

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

git-mergetool--lib.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ run_merge_tool () {
182182
fi
183183
check_unchanged
184184
else
185-
"$merge_tool_path" -f -d -c "wincmd l" \
185+
"$merge_tool_path" -R -f -d -c "wincmd l" \
186186
"$LOCAL" "$REMOTE"
187187
fi
188188
;;
@@ -193,7 +193,7 @@ run_merge_tool () {
193193
"$LOCAL" "$MERGED" "$REMOTE"
194194
check_unchanged
195195
else
196-
"$merge_tool_path" -f -d -c "wincmd l" \
196+
"$merge_tool_path" -R -f -d -c "wincmd l" \
197197
"$LOCAL" "$REMOTE"
198198
fi
199199
;;

0 commit comments

Comments
 (0)