git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Bert Wesarg <bert.wesarg@googlemail.com>
Date
Mar 30, 2011, 06:44 UTC
Message-ID
<56c38bdfd71d8af5633bea00cb130256d6981af5.1301467146.git.bert.wesarg@googlemail.com>
In-Reply-To
<AANLkTin4-1_bNuH2kQ0m6wpevnO5uCJUmLvy=gP4mLfH@mail.gmail.com>
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 <bert.wesarg@googlemail.com>
---
Maybe it's not too late for the next release.
 git-gui.sh   |    3 +++
 lib/diff.tcl |   12 ++++++++++++
 2 files changed, 15 insertions(+), 0 deletions(-)
diff --git a/git-gui.sh b/git-gui.sh
index d5c1535..6adcda6 100755
--- a/git-gui.sh
+++ b/git-gui.sh
@@ -3388,6 +3388,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/lib/diff.tcl b/lib/diff.tcl
index 39e4d90..11f9e16 100644
--- a/lib/diff.tcl
+++ b/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] \
@@ -439,10 +440,21 @@ proc read_diff {fd conflict_size cont_info} {
 			{++} {
 				set regexp [string map [list %conflict_size $conflict_size]\
 								{^\+\+([<>=]){%conflict_size}(?: |$)}]
+				set regexp_pre_image [string map [list %conflict_size $conflict_size]\
+								{^\+\+\|{%conflict_size}(?: |$)]
 				if {[regexp $regexp $line _g op]} {
 					set is_conflict_diff 1
 					set line [string replace $line 0 1 {  }]
 					set tags d$op
+					set ::in_conflict_pre_image 0
+				} elseif {[regexp $regexp_pre_image $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_++
 				}
-- 
1.7.4.1.1319.ga04f7.dirty
Previous: Bert WesargNext: Bert Wesarg
Message 7 of 11 in “git-gui: respect conflict marker size”
  1. git-gui: respect conflict marker sizeBert Wesarg, Nov 16, 2010
  2. 1/2 git-gui: respect conflict marker sizeBert Wesarg, Nov 16, 2010
  3. 2/2 git-gui: support for diff3 conflict styleBert Wesarg, Nov 16, 2010
  4. Pat ThoytsNov 19, 2010
  5. Bert WesargNov 19, 2010
  6. Bert WesargFeb 27, 2011
  7. 2/2 git-gui: support for diff3 conflict styleBert Wesarg, Mar 30, 2011
  8. git-gui: support for diff3 conflict styleBert Wesarg, Mar 30, 2011
  9. Bert WesargOct 20, 2011
  10. Pat ThoytsNov 19, 2010
  11. Bert WesargNov 19, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.