git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH 1/2] git-gui: use existing interface to query a path's attribute
@ 2019-09-25 20:38 Bert Wesarg
  2019-09-25 20:38 ` [PATCH 2/2] git-gui: support for diff3 conflict style Bert Wesarg
  2019-09-27  5:27 ` [PATCH 1/2] git-gui: use existing interface to query a path's attribute Pratyush Yadav
  0 siblings, 2 replies; 23+ messages in thread
From: Bert Wesarg @ 2019-09-25 20:38 UTC (permalink / raw)
  To: git; +Cc: Bert Wesarg, Pratyush Yadav

Replace the hand-coded call to git check-attr with the already provided one.

Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>
---
 lib/diff.tcl | 15 +--------------
 1 file changed, 1 insertion(+), 14 deletions(-)

diff --git a/lib/diff.tcl b/lib/diff.tcl
index 958a0fa..0fd4600 100644
--- a/lib/diff.tcl
+++ b/lib/diff.tcl
@@ -270,19 +270,6 @@ 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
@@ -298,7 +285,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 conflict_size [gitattr $path conflict-marker-size 7]
 
 	set cmd [list]
 	if {$w eq $ui_index} {
-- 
2.21.0.789.ga095d9d866


^ permalink raw reply related	[flat|nested] 23+ messages in thread
* [PATCH 1/2] git-gui: support for underline styles
@ 2011-03-30  6:44 Bert Wesarg
  0 siblings, 0 replies; 23+ messages in thread
From: Bert Wesarg @ 2011-03-30  6:44 UTC (permalink / raw)
  To: Pat Thoyts; +Cc: git, Bert Wesarg

From: Pat Thoyts <patthoyts@users.sourceforge.net>

From: Pat Thoyts <patthoyts@users.sourceforge.net>

Suggested-by: Bert Wesarg <bert.wesarg@googlemail.com>
Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>
---

I left underline out because I reckon it would just make text harder to
read on a gui display. It seems like the option would only be useful on
monochrome terminals.

If we do want to support underlines in the diff view window then we can
have a different tag rather than replicating each color to get a
underlined version of the same color.
Something like the following should do it:
---
 git-gui.sh   |    1 +
 lib/diff.tcl |    2 +-
 2 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/git-gui.sh b/git-gui.sh
index fd6a43d..d5c1535 100755
--- a/git-gui.sh
+++ b/git-gui.sh
@@ -3361,6 +3361,7 @@ foreach {n c} {0 black 1 red4 2 green4 3 yellow4 4 blue4 5 magenta4 6 cyan4 7 gr
 	$ui_diff tag configure clri3$n -background $c
 }
 $ui_diff tag configure clr1 -font font_diffbold
+$ui_diff tag configure clr4 -underline 1
 
 $ui_diff tag conf d_info -foreground blue -font font_diffbold
 
diff --git a/lib/diff.tcl b/lib/diff.tcl
index cf8a95e..39e4d90 100644
--- a/lib/diff.tcl
+++ b/lib/diff.tcl
@@ -504,7 +504,7 @@ proc read_diff {fd conflict_size cont_info} {
 			set prefix clr
 			foreach style [split $colbegin ";"] {
 				if {$style eq "7"} {append prefix i; continue}
-				if {$style < 30 || $style > 47} {continue}
+				if {$style != 4 && ($style < 30 || $style > 47)} {continue}
 				set a "$mark linestart + $posbegin chars"
 				set b "$mark linestart + $posend chars"
 				catch {$ui_diff tag add $prefix$style $a $b}
-- 
1.7.4.1.1319.ga04f7.dirty

^ permalink raw reply related	[flat|nested] 23+ messages in thread
* [PATCHv2 1/2] git-gui: respect conflict marker size
@ 2010-11-16  9:21 Bert Wesarg
  2010-11-16  9:26 ` [PATCH 2/2] git-gui: support for diff3 conflict style Bert Wesarg
  0 siblings, 1 reply; 23+ messages in thread
From: Bert Wesarg @ 2010-11-16  9:21 UTC (permalink / raw)
  To: Pat Thoyts; +Cc: Bert Wesarg, Shawn O . Pearce, Junio C Hamano, git

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

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

---

v2 fixes the tags selection and also the regexp to match always exactly the
desired number of markers.

Bert

 git-gui/git-gui.sh   |    6 +++---
 git-gui/lib/diff.tcl |   22 ++++++++++++++++++----
 2 files changed, 21 insertions(+), 7 deletions(-)

diff --git a/git-gui/git-gui.sh b/git-gui/git-gui.sh
index d3acf0d..38362fa 100755
--- a/git-gui/git-gui.sh
+++ b/git-gui/git-gui.sh
@@ -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
 
diff --git a/git-gui/lib/diff.tcl b/git-gui/lib/diff.tcl
index dcf0711..d4e2ce3 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}(?: |$)} $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}(?: |$)} $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)

^ permalink raw reply related	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2019-10-04 16:09 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-25 20:38 [PATCH 1/2] git-gui: use existing interface to query a path's attribute Bert Wesarg
2019-09-25 20:38 ` [PATCH 2/2] git-gui: support for diff3 conflict style Bert Wesarg
2019-09-29 15:04   ` Pratyush Yadav
2019-09-30 12:17     ` Bert Wesarg
2019-09-30 12:20       ` [PATCH v2 1/2] git-gui: use existing interface to query a path's attribute Bert Wesarg
2019-09-30 12:20         ` [PATCH v2 2/2] git-gui: support for diff3 conflict style Bert Wesarg
2019-09-30 19:54           ` [PATCH v3 1/2] git-gui: use existing interface to query a path's attribute Bert Wesarg
2019-10-01 14:24             ` Pratyush Yadav
2019-10-01 15:22               ` Bert Wesarg
2019-10-01 17:31                 ` Pratyush Yadav
2019-10-02  7:35                   ` Bert Wesarg
2019-10-02  7:36             ` [PATCH v3 2/2] git-gui: support for diff3 conflict style Bert Wesarg
2019-10-02 23:54               ` Pratyush Yadav
2019-10-03 20:02       ` [PATCH " Philip Oakley
2019-10-03 20:54         ` Pratyush Yadav
2019-10-03 21:40           ` Philip Oakley
     [not found]             ` <CAKPyHN0_AUqLpPVDNJUZqNV8zRQzaDOMXJV4AbnK969AdtGpNg@mail.gmail.com>
2019-10-04 16:09               ` Philip Oakley
2019-09-27  5:27 ` [PATCH 1/2] git-gui: use existing interface to query a path's attribute Pratyush Yadav
  -- strict thread matches above, loose matches on Subject: below --
2011-03-30  6:44 [PATCH 1/2] git-gui: support for underline styles Bert Wesarg
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

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).