summaryrefslogtreecommitdiff
path: root/lib/diff.tcl
diff options
context:
space:
mode:
authorBert Wesarg <bert.wesarg@googlemail.com>2010-11-16 09:21:52 (GMT)
committerPat Thoyts <patthoyts@users.sourceforge.net>2010-11-19 11:25:00 (GMT)
commit4590307a338b1a4912c7a203c71af8b8995ea885 (patch)
tree2a5aee860cc1e5776a2ef78b35f9117fad67aef9 /lib/diff.tcl
parent46a0431b996cd19f21e0247c97b1eab2c19698fc (diff)
downloadgit-4590307a338b1a4912c7a203c71af8b8995ea885.zip
git-4590307a338b1a4912c7a203c71af8b8995ea885.tar.gz
git-4590307a338b1a4912c7a203c71af8b8995ea885.tar.bz2
git-gui: respect conflict marker size
Respect the conflict-marker-size attribute on paths when detecting merge conflicts. [PT: fixed problem with variable substitution in the regexps] Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com> Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
Diffstat (limited to 'lib/diff.tcl')
-rw-r--r--lib/diff.tcl26
1 files changed, 22 insertions, 4 deletions
diff --git a/lib/diff.tcl b/lib/diff.tcl
index 0579fa6..8fea947 100644
--- a/lib/diff.tcl
+++ b/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} {
@@ -357,7 +371,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
@@ -410,7 +424,9 @@ proc read_diff {fd cont_info} {
{- } {set tags d_-s}
{--} {set tags d_--}
{++} {
- if {[regexp {^\+\+([<>]{7} |={7})} $line _g op]} {
+ set regexp [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
@@ -449,7 +465,9 @@ proc read_diff {fd cont_info} {
{@} {set tags d_@}
{-} {set tags d_-}
{+} {
- if {[regexp {^\+([<>]{7} |={7})} $line _g op]} {
+ set regexp [string map [list %conflict_size $conflict_size]\
+ {^\+([<>=]){%conflict_size}(?: |$)}]
+ if {[regexp $regexp $line _g op]} {
set is_conflict_diff 1
set tags d$op
} else {