From: Dan McGee <dpmcgee@gmail.com>
To: git@vger.kernel.org
Cc: Dan McGee <dpmcgee@gmail.com>, David Aguilar <davvid@gmail.com>,
Jeff King <peff@peff.net>, Jacob Helwig <jacob.helwig@gmail.com>,
Felipe Contreras <felipe.contreras@gmail.com>,
Markus Heidelberg <markus.heidelberg@web.de>,
Charles Bailey <charles@hashpling.org>
Subject: [PATCH 2/2] mergetool-lib: add a three-way diff view for vim/gvim
Date: Mon, 27 Sep 2010 10:19:09 -0500 [thread overview]
Message-ID: <1285600749-1088-1-git-send-email-dpmcgee@gmail.com> (raw)
In-Reply-To: <20100925031745.GB30550@gmail.com>
When the base version is available, use a three-way, four panel view by
default. This shows the (local, base, remote) revisions up top and the
merged result by itself in the lower pane. All revisions will still scroll
together by default, and the cursor still defaults to the merged result edit
pane.
The original vimdiff/gvimdiff configuration is now available by using
'vimdiff2' or 'gvimdiff2' as the preferred merge tool.
Signed-off-by: Dan McGee <dpmcgee@gmail.com>
---
This should address the comments I got once I pestered people. The new behavior
is the default, but it at least becomes possible to use the previous behavior
without much hassle (just set your mergetool appropriately).
-Dan
git-mergetool--lib.sh | 23 ++++++++++++++++++++---
1 files changed, 20 insertions(+), 3 deletions(-)
diff --git a/git-mergetool--lib.sh b/git-mergetool--lib.sh
index f9a51ba..77d4aee 100644
--- a/git-mergetool--lib.sh
+++ b/git-mergetool--lib.sh
@@ -10,10 +10,10 @@ merge_mode() {
translate_merge_tool_path () {
case "$1" in
- vimdiff)
+ vimdiff|vimdiff2)
echo vim
;;
- gvimdiff)
+ gvimdiff|gvimdiff2)
echo gvim
;;
emerge)
@@ -47,7 +47,8 @@ check_unchanged () {
valid_tool () {
case "$1" in
kdiff3 | tkdiff | xxdiff | meld | opendiff | \
- emerge | vimdiff | gvimdiff | ecmerge | diffuse | araxis | p4merge)
+ vimdiff | gvimdiff | vimdiff2 | gvimdiff2 | \
+ emerge | ecmerge | diffuse | araxis | p4merge)
;; # happy
tortoisemerge)
if ! merge_mode; then
@@ -172,6 +173,22 @@ run_merge_tool () {
vimdiff|gvimdiff)
if merge_mode; then
touch "$BACKUP"
+ if $base_present; then
+ "$merge_tool_path" -f -d -c "wincmd J" \
+ "$MERGED" "$LOCAL" "$BASE" "$REMOTE"
+ else
+ "$merge_tool_path" -f -d -c "wincmd l" \
+ "$LOCAL" "$MERGED" "$REMOTE"
+ fi
+ check_unchanged
+ else
+ "$merge_tool_path" -f -d -c "wincmd l" \
+ "$LOCAL" "$REMOTE"
+ fi
+ ;;
+ vimdiff2|gvimdiff2)
+ if merge_mode; then
+ touch "$BACKUP"
"$merge_tool_path" -f -d -c "wincmd l" \
"$LOCAL" "$MERGED" "$REMOTE"
check_unchanged
--
1.7.3
next prev parent reply other threads:[~2010-09-27 15:19 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-15 2:21 [PATCH 1/2] mergetool-lib: combine vimdiff and gvimdiff run blocks Dan McGee
2010-09-15 2:21 ` [PATCH 2/2] mergetool-lib: add a three-way diff view for vim/gvim Dan McGee
2010-09-18 7:34 ` David Aguilar
2010-09-19 9:48 ` Felipe Contreras
2010-09-24 19:01 ` Dan McGee
2010-09-24 19:09 ` Jacob Helwig
2010-09-24 21:38 ` Jeff King
2010-09-25 3:17 ` David Aguilar
2010-09-27 15:19 ` Dan McGee [this message]
2010-09-24 21:31 ` Jeff King
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1285600749-1088-1-git-send-email-dpmcgee@gmail.com \
--to=dpmcgee@gmail.com \
--cc=charles@hashpling.org \
--cc=davvid@gmail.com \
--cc=felipe.contreras@gmail.com \
--cc=git@vger.kernel.org \
--cc=jacob.helwig@gmail.com \
--cc=markus.heidelberg@web.de \
--cc=peff@peff.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).