All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bert Wesarg <bert.wesarg@googlemail.com>
To: Pat Thoyts <patthoyts@users.sourceforge.net>
Cc: Bert Wesarg <bert.wesarg@googlemail.com>,
	"Shawn O . Pearce" <spearce@spearce.org>,
	Junio C Hamano <gitster@pobox.com>,
	git@vger.kernel.org
Subject: [PATCH] git-gui: respect conflict marker size
Date: Tue, 16 Nov 2010 08:49:22 +0100	[thread overview]
Message-ID: <1289893762-28567-1-git-send-email-bert.wesarg@googlemail.com> (raw)

Respect the conflict-marker-size attribute on paths when detecting merge
conflicts.

Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>

---
 git-gui/lib/diff.tcl |   22 ++++++++++++++++++----
 1 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/git-gui/lib/diff.tcl b/git-gui/lib/diff.tcl
index dcf0711..a753737 100644
--- a/git-gui/lib/diff.tcl
+++ b/git-gui/lib/diff.tcl
@@ -253,6 +253,19 @@ proc show_other_diff {path w m cont_info} {
 	}
 }
 
+proc get_conflict_marker_size {path} {
+	set size 7
+	catch {
+		set fd_rc [eval [list git_read check-attr "conflict-marker-size" -- $path]]
+		set ret [gets $fd_rc line]
+		close $fd_rc
+		if {$ret > 0} {
+			regexp {.*: conflict-marker-size: (\d+)$} $line line size
+		}
+	}
+	return $size
+}
+
 proc start_show_diff {cont_info {add_opts {}}} {
 	global file_states file_lists
 	global is_3way_diff is_submodule_diff diff_active repo_config
@@ -268,6 +281,7 @@ proc start_show_diff {cont_info {add_opts {}}} {
 	set is_submodule_diff 0
 	set diff_active 1
 	set current_diff_header {}
+	set conflict_size [get_conflict_marker_size $path]
 
 	set cmd [list]
 	if {$w eq $ui_index} {
@@ -329,7 +343,7 @@ proc start_show_diff {cont_info {add_opts {}}} {
 		-blocking 0 \
 		-encoding [get_path_encoding $path] \
 		-translation lf
-	fileevent $fd readable [list read_diff $fd $cont_info]
+	fileevent $fd readable [list read_diff $fd $conflict_size $cont_info]
 }
 
 proc parse_color_line {line} {
@@ -349,7 +363,7 @@ proc parse_color_line {line} {
 	return [list $result $markup]
 }
 
-proc read_diff {fd cont_info} {
+proc read_diff {fd conflict_size cont_info} {
 	global ui_diff diff_active is_submodule_diff
 	global is_3way_diff is_conflict_diff current_diff_header
 	global current_diff_queue
@@ -402,7 +416,7 @@ proc read_diff {fd cont_info} {
 			{- } {set tags d_-s}
 			{--} {set tags d_--}
 			{++} {
-				if {[regexp {^\+\+([<>]{7} |={7})} $line _g op]} {
+				if {[regexp {^\+\+([<>]{$conflict_size} |={$conflict_size})} $line _g op]} {
 					set is_conflict_diff 1
 					set line [string replace $line 0 1 {  }]
 					set tags d$op
@@ -441,7 +455,7 @@ proc read_diff {fd cont_info} {
 			{@} {set tags d_@}
 			{-} {set tags d_-}
 			{+} {
-				if {[regexp {^\+([<>]{7} |={7})} $line _g op]} {
+				if {[regexp {^\+([<>]{$conflict_size} |={$conflict_size})} $line _g op]} {
 					set is_conflict_diff 1
 					set tags d$op
 				} else {
-- 
tg: (6f10c41..) bw/git-gui/respect-conflict-marker-size (depends on: master)

             reply	other threads:[~2010-11-16  7:50 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-16  7:49 Bert Wesarg [this message]
2010-11-16  9:21 ` [PATCHv2 1/2] git-gui: respect conflict marker size Bert Wesarg
2010-11-16  9:26   ` [PATCH 2/2] git-gui: support for diff3 conflict style Bert Wesarg
2010-11-19 11:41     ` Pat Thoyts
2010-11-19 12:05       ` Bert Wesarg
2011-02-27 20:15       ` Bert Wesarg
2011-03-30  6:44         ` Bert Wesarg
2011-03-30  7:18           ` [PATCH 2v2/2] " Bert Wesarg
2011-10-20 19:35             ` Bert Wesarg
2010-11-19 11:20   ` [PATCHv2 1/2] git-gui: respect conflict marker size Pat Thoyts
2010-11-19 11:48     ` Bert Wesarg
  -- strict thread matches above, loose matches on Subject: below --
2010-11-15 10:04 [PATCH] git-gui: support for underline styles Bert Wesarg
2010-11-19 10:00 ` Pat Thoyts
2010-11-19 10:55   ` Bert Wesarg
2011-02-27 20:04   ` Bert Wesarg
2011-03-30  6:44     ` [PATCH 1/2] " Bert Wesarg

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=1289893762-28567-1-git-send-email-bert.wesarg@googlemail.com \
    --to=bert.wesarg@googlemail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=patthoyts@users.sourceforge.net \
    --cc=spearce@spearce.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.