Skip to content

Commit

Permalink
mergetool-lib: call vim in readonly mode for diffs
Browse files Browse the repository at this point in the history
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 <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Michael J Gruber authored and Junio C Hamano committed Feb 25, 2011
1 parent 7ed863a commit 853c0ff
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions git-mergetool--lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ run_merge_tool () {
fi
check_unchanged
else
"$merge_tool_path" -f -d -c "wincmd l" \
"$merge_tool_path" -R -f -d -c "wincmd l" \
"$LOCAL" "$REMOTE"
fi
;;
Expand All @@ -193,7 +193,7 @@ run_merge_tool () {
"$LOCAL" "$MERGED" "$REMOTE"
check_unchanged
else
"$merge_tool_path" -f -d -c "wincmd l" \
"$merge_tool_path" -R -f -d -c "wincmd l" \
"$LOCAL" "$REMOTE"
fi
;;
Expand Down

0 comments on commit 853c0ff

Please sign in to comment.