Thread (3 messages) flat view 3 messages, 1 author, 2016-06-15
DORMANTno replies

[PATCH 2/2] git-gui: support for diff3 conflict style

From: Bert Wesarg <hidden>
Date: 2016-06-15 22:50:03
Subsystem: the rest · Maintainer: Linus Torvalds

This adds highlight support for the diff3 conflict style.

The common pre-image will be reversed to --, because it has been removed
and either replaced with our or their side.

Signed-off-by: Bert Wesarg <redacted>

---
 git-gui/git-gui.sh   |    3 +++
 git-gui/lib/diff.tcl |   10 ++++++++++
 2 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/git-gui/git-gui.sh b/git-gui/git-gui.sh
index 38362fa..0134438 100755
--- a/git-gui/git-gui.sh
+++ b/git-gui/git-gui.sh
@@ -3354,6 +3354,9 @@ $ui_diff tag conf d_s- \
 $ui_diff tag conf d< \
 	-foreground orange \
 	-font font_diffbold
+$ui_diff tag conf d| \
+	-foreground orange \
+	-font font_diffbold
 $ui_diff tag conf d= \
 	-foreground orange \
 	-font font_diffbold
diff --git a/git-gui/lib/diff.tcl b/git-gui/lib/diff.tcl
index d4e2ce3..ccd4c70 100644
--- a/git-gui/lib/diff.tcl
+++ b/git-gui/lib/diff.tcl
@@ -339,6 +339,7 @@ proc start_show_diff {cont_info {add_opts {}}} {
 	}
 
 	set ::current_diff_inheader 1
+	set ::in_conflict_pre_image 0
 	fconfigure $fd \
 		-blocking 0 \
 		-encoding [get_path_encoding $path] \
@@ -420,6 +421,15 @@ proc read_diff {fd conflict_size cont_info} {
 					set is_conflict_diff 1
 					set line [string replace $line 0 1 {  }]
 					set tags d$op
+					set ::in_conflict_pre_image 0
+				} elseif {[regexp {^\+\+\|{$conflict_size}(?: |$)} $line]} {
+					set is_conflict_diff 1
+					set line [string replace $line 0 1 {  }]
+					set tags d|
+					set ::in_conflict_pre_image 1
+				} elseif ($::in_conflict_pre_image) {
+					set line [string replace $line 0 1 {--}]
+					set tags d_--
 				} else {
 					set tags d_++
 				}
-- 
tg: (fba7c96..) bw/git-gui/support-diff3 (depends on: master bw/git-gui/respect-conflict-marker-size)
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help