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>
This commit is contained in:
parent
46a0431b99
commit
4590307a33
@ -3351,13 +3351,13 @@ $ui_diff tag conf d_s- \
|
||||
-foreground red \
|
||||
-background ivory1
|
||||
|
||||
$ui_diff tag conf d<<<<<<< \
|
||||
$ui_diff tag conf d< \
|
||||
-foreground orange \
|
||||
-font font_diffbold
|
||||
$ui_diff tag conf d======= \
|
||||
$ui_diff tag conf d= \
|
||||
-foreground orange \
|
||||
-font font_diffbold
|
||||
$ui_diff tag conf d>>>>>>> \
|
||||
$ui_diff tag conf d> \
|
||||
-foreground orange \
|
||||
-font font_diffbold
|
||||
|
||||
|
26
lib/diff.tcl
26
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 {
|
||||
|
Loading…
Reference in New Issue
Block a user