{"thread":{"id":"51943","subject":"[PATCH v3 1/2] git-gui: use existing interface to query a path's attribute","startedAt":"2019-09-30T21:04:01Z","lastAt":"2019-10-02T23:54:18Z","messageCount":7,"participants":["Bert Wesarg","Pratyush Yadav"],"isPatch":true,"patchVersion":3,"patchTotal":2},"messages":[{"id":"383165","messageId":"97013a71289857767100d6a4adcb39ca99b2b21b.1569873171.git.bert.wesarg@googlemail.com","threadId":"51943","inReplyTo":null,"subject":"[PATCH v3 1/2] git-gui: use existing interface to query a path's attribute","fromName":"Bert Wesarg","fromEmail":"bert.wesarg@googlemail.com","sentAt":"2019-09-30T19:54:52Z","receivedAt":"2019-09-30T21:04:01Z","isPatch":true,"sender":{"key":"bert.wesarg@googlemail.com","avatar":"https://avatars.githubusercontent.com/u/111934?v=4"},"body":"Replace the hand-coded call to git check-attr with the already provided one.\n\nSigned-off-by: Bert Wesarg <bert.wesarg@googlemail.com>\n---\n lib/diff.tcl | 15 +--------------\n 1 file changed, 1 insertion(+), 14 deletions(-)\n\ndiff --git a/lib/diff.tcl b/lib/diff.tcl\nindex 958a0fa..0fd4600 100644\n--- a/lib/diff.tcl\n+++ b/lib/diff.tcl\n@@ -270,19 +270,6 @@ proc show_other_diff {path w m cont_info} {\n \t}\n }\n \n-proc get_conflict_marker_size {path} {\n-\tset size 7\n-\tcatch {\n-\t\tset fd_rc [eval [list git_read check-attr \"conflict-marker-size\" -- $path]]\n-\t\tset ret [gets $fd_rc line]\n-\t\tclose $fd_rc\n-\t\tif {$ret > 0} {\n-\t\t\tregexp {.*: conflict-marker-size: (\\d+)$} $line line size\n-\t\t}\n-\t}\n-\treturn $size\n-}\n-\n proc start_show_diff {cont_info {add_opts {}}} {\n \tglobal file_states file_lists\n \tglobal is_3way_diff is_submodule_diff diff_active repo_config\n@@ -298,7 +285,7 @@ proc start_show_diff {cont_info {add_opts {}}} {\n \tset is_submodule_diff 0\n \tset diff_active 1\n \tset current_diff_header {}\n-\tset conflict_size [get_conflict_marker_size $path]\n+\tset conflict_size [gitattr $path conflict-marker-size 7]\n \n \tset cmd [list]\n \tif {$w eq $ui_index} {\n-- \n2.23.0.11.g242cf7f110\n\n"},{"id":"383209","messageId":"20191001142401.hhg5dtefj6qg66dd@yadavpratyush.com","threadId":"51943","inReplyTo":"97013a71289857767100d6a4adcb39ca99b2b21b.1569873171.git.bert.wesarg@googlemail.com","subject":"Re: [PATCH v3 1/2] git-gui: use existing interface to query a path's attribute","fromName":"Pratyush Yadav","fromEmail":"me@yadavpratyush.com","sentAt":"2019-10-01T14:24:01Z","receivedAt":"2019-10-01T14:24:06Z","isPatch":true,"sender":{"key":"me@yadavpratyush.com","avatar":"https://avatars.githubusercontent.com/u/8817931?v=4"},"body":"Hi,\n\nI don't see any difference between v3 and v2 of this patch. What changed \nin this version?\n\nOn 30/09/19 09:54PM, Bert Wesarg wrote:\n> Replace the hand-coded call to git check-attr with the already provided one.\n> \n> Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>\n> ---\n>  lib/diff.tcl | 15 +--------------\n>  1 file changed, 1 insertion(+), 14 deletions(-)\n> \n> diff --git a/lib/diff.tcl b/lib/diff.tcl\n> index 958a0fa..0fd4600 100644\n> --- a/lib/diff.tcl\n> +++ b/lib/diff.tcl\n> @@ -270,19 +270,6 @@ proc show_other_diff {path w m cont_info} {\n>  \t}\n>  }\n>  \n> -proc get_conflict_marker_size {path} {\n> -\tset size 7\n> -\tcatch {\n> -\t\tset fd_rc [eval [list git_read check-attr \"conflict-marker-size\" -- $path]]\n> -\t\tset ret [gets $fd_rc line]\n> -\t\tclose $fd_rc\n> -\t\tif {$ret > 0} {\n> -\t\t\tregexp {.*: conflict-marker-size: (\\d+)$} $line line size\n> -\t\t}\n> -\t}\n> -\treturn $size\n> -}\n> -\n>  proc start_show_diff {cont_info {add_opts {}}} {\n>  \tglobal file_states file_lists\n>  \tglobal is_3way_diff is_submodule_diff diff_active repo_config\n> @@ -298,7 +285,7 @@ proc start_show_diff {cont_info {add_opts {}}} {\n>  \tset is_submodule_diff 0\n>  \tset diff_active 1\n>  \tset current_diff_header {}\n> -\tset conflict_size [get_conflict_marker_size $path]\n> +\tset conflict_size [gitattr $path conflict-marker-size 7]\n>  \n>  \tset cmd [list]\n>  \tif {$w eq $ui_index} {\n> -- \n> 2.23.0.11.g242cf7f110\n> \n\n-- \nRegards,\nPratyush Yadav\n"},{"id":"383213","messageId":"CAKPyHN2qSudnEMfokp5-BXBDU6_kcVv3aokNUYdqZOnMXYVzYw@mail.gmail.com","threadId":"51943","inReplyTo":"20191001142401.hhg5dtefj6qg66dd@yadavpratyush.com","subject":"Re: [PATCH v3 1/2] git-gui: use existing interface to query a path's attribute","fromName":"Bert Wesarg","fromEmail":"bert.wesarg@googlemail.com","sentAt":"2019-10-01T15:22:57Z","receivedAt":"2019-10-01T15:23:13Z","isPatch":true,"sender":{"key":"bert.wesarg@googlemail.com","avatar":"https://avatars.githubusercontent.com/u/111934?v=4"},"body":"On Tue, Oct 1, 2019 at 4:24 PM Pratyush Yadav <me@yadavpratyush.com> wrote:\n>\n> Hi,\n>\n> I don't see any difference between v3 and v2 of this patch. What changed\n> in this version?\n\nnothing, but 2/2 changed.\n\nBert\n\n>\n> On 30/09/19 09:54PM, Bert Wesarg wrote:\n> > Replace the hand-coded call to git check-attr with the already provided one.\n> >\n> > Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>\n> > ---\n> >  lib/diff.tcl | 15 +--------------\n> >  1 file changed, 1 insertion(+), 14 deletions(-)\n> >\n> > diff --git a/lib/diff.tcl b/lib/diff.tcl\n> > index 958a0fa..0fd4600 100644\n> > --- a/lib/diff.tcl\n> > +++ b/lib/diff.tcl\n> > @@ -270,19 +270,6 @@ proc show_other_diff {path w m cont_info} {\n> >       }\n> >  }\n> >\n> > -proc get_conflict_marker_size {path} {\n> > -     set size 7\n> > -     catch {\n> > -             set fd_rc [eval [list git_read check-attr \"conflict-marker-size\" -- $path]]\n> > -             set ret [gets $fd_rc line]\n> > -             close $fd_rc\n> > -             if {$ret > 0} {\n> > -                     regexp {.*: conflict-marker-size: (\\d+)$} $line line size\n> > -             }\n> > -     }\n> > -     return $size\n> > -}\n> > -\n> >  proc start_show_diff {cont_info {add_opts {}}} {\n> >       global file_states file_lists\n> >       global is_3way_diff is_submodule_diff diff_active repo_config\n> > @@ -298,7 +285,7 @@ proc start_show_diff {cont_info {add_opts {}}} {\n> >       set is_submodule_diff 0\n> >       set diff_active 1\n> >       set current_diff_header {}\n> > -     set conflict_size [get_conflict_marker_size $path]\n> > +     set conflict_size [gitattr $path conflict-marker-size 7]\n> >\n> >       set cmd [list]\n> >       if {$w eq $ui_index} {\n> > --\n> > 2.23.0.11.g242cf7f110\n> >\n>\n> --\n> Regards,\n> Pratyush Yadav\n"},{"id":"383219","messageId":"20191001173100.n5dipyhjk4uxcnnj@yadavpratyush.com","threadId":"51943","inReplyTo":"CAKPyHN2qSudnEMfokp5-BXBDU6_kcVv3aokNUYdqZOnMXYVzYw@mail.gmail.com","subject":"Re: [PATCH v3 1/2] git-gui: use existing interface to query a path's attribute","fromName":"Pratyush Yadav","fromEmail":"me@yadavpratyush.com","sentAt":"2019-10-01T17:31:00Z","receivedAt":"2019-10-01T17:31:06Z","isPatch":true,"sender":{"key":"me@yadavpratyush.com","avatar":"https://avatars.githubusercontent.com/u/8817931?v=4"},"body":"On 01/10/19 05:22PM, Bert Wesarg wrote:\n> On Tue, Oct 1, 2019 at 4:24 PM Pratyush Yadav <me@yadavpratyush.com> wrote:\n> >\n> > Hi,\n> >\n> > I don't see any difference between v3 and v2 of this patch. What changed\n> > in this version?\n> \n> nothing, but 2/2 changed.\n\nI don't see a v3 of 2/2 in my inbox. A search on public-inbox yields \nnothing either. Can you please check if the patch was sent properly? Or \nif you _can_ find it on public-inbox.org, a link to that would do just \nfine.\n\nI _do_ have v2 of both patches, but the v3 of the second patch is the \none missing.\n\n-- \nRegards,\nPratyush Yadav\n"},{"id":"383257","messageId":"CAKPyHN31qQwL=x0hwk2TjOkyC8iRtcLY0v6NgwA81N2i8P6aBg@mail.gmail.com","threadId":"51943","inReplyTo":"20191001173100.n5dipyhjk4uxcnnj@yadavpratyush.com","subject":"Re: [PATCH v3 1/2] git-gui: use existing interface to query a path's attribute","fromName":"Bert Wesarg","fromEmail":"bert.wesarg@googlemail.com","sentAt":"2019-10-02T07:35:34Z","receivedAt":"2019-10-02T07:35:48Z","isPatch":true,"sender":{"key":"bert.wesarg@googlemail.com","avatar":"https://avatars.githubusercontent.com/u/111934?v=4"},"body":"Pratyush,\n\nOn Tue, Oct 1, 2019 at 7:31 PM Pratyush Yadav <me@yadavpratyush.com> wrote:\n>\n> On 01/10/19 05:22PM, Bert Wesarg wrote:\n> > On Tue, Oct 1, 2019 at 4:24 PM Pratyush Yadav <me@yadavpratyush.com> wrote:\n> > >\n> > > Hi,\n> > >\n> > > I don't see any difference between v3 and v2 of this patch. What changed\n> > > in this version?\n> >\n> > nothing, but 2/2 changed.\n>\n> I don't see a v3 of 2/2 in my inbox. A search on public-inbox yields\n> nothing either. Can you please check if the patch was sent properly? Or\n> if you _can_ find it on public-inbox.org, a link to that would do just\n> fine.\n>\n> I _do_ have v2 of both patches, but the v3 of the second patch is the\n> one missing.\n\nI noticed this already, while in contact with Johannes on GitHub and I\nfound my error. While pasting messages ids for References into the v3\npatch, I missed to renamed Message-Id to References for the v2 patch,\nthus the v3 has the same Message-Id than the v2 patch. Will resend\nnow.\n\nBert\n\n>\n> --\n> Regards,\n> Pratyush Yadav\n"},{"id":"383258","messageId":"a7cff5097eaf29a80c822cb37b537b3859d06ad7.1569873171.git.bert.wesarg@googlemail.com","threadId":"51943","inReplyTo":"97013a71289857767100d6a4adcb39ca99b2b21b.1569873171.git.bert.wesarg@googlemail.com","subject":"[PATCH v3 2/2] git-gui: support for diff3 conflict style","fromName":"Bert Wesarg","fromEmail":"bert.wesarg@googlemail.com","sentAt":"2019-10-02T07:36:02Z","receivedAt":"2019-10-02T07:36:07Z","isPatch":true,"sender":{"key":"bert.wesarg@googlemail.com","avatar":"https://avatars.githubusercontent.com/u/111934?v=4"},"body":"This adds highlight support for the diff3 conflict style.\n\nThe common pre-image will be reversed to --, because it has been removed\nand replaced with ours or theirs side respectively.\n\nSigned-off-by: Bert Wesarg <bert.wesarg@googlemail.com>\n---\n git-gui.sh   |  3 +++\n lib/diff.tcl | 17 ++++++++++++++++-\n 2 files changed, 19 insertions(+), 1 deletion(-)\n\n--- \n\nv3: Fixed a syntax error\n\ndiff --git a/git-gui.sh b/git-gui.sh\nindex fd476b6..6d80f82 100755\n--- a/git-gui.sh\n+++ b/git-gui.sh\n@@ -3581,6 +3581,9 @@ $ui_diff tag conf d_s- \\\n $ui_diff tag conf d< \\\n \t-foreground orange \\\n \t-font font_diffbold\n+$ui_diff tag conf d| \\\n+\t-foreground orange \\\n+\t-font font_diffbold\n $ui_diff tag conf d= \\\n \t-foreground orange \\\n \t-font font_diffbold\ndiff --git a/lib/diff.tcl b/lib/diff.tcl\nindex 0fd4600..dacdda2 100644\n--- a/lib/diff.tcl\n+++ b/lib/diff.tcl\n@@ -347,6 +347,10 @@ proc start_show_diff {cont_info {add_opts {}}} {\n \t}\n \n \tset ::current_diff_inheader 1\n+\t# detect pre-image lines of the diff3 conflict-style, they are just '++'\n+\t# lines which is not bijective, thus we need to maintain a state across\n+\t# lines\n+\tset ::conflict_in_pre_image 0\n \tfconfigure $fd \\\n \t\t-blocking 0 \\\n \t\t-encoding [get_path_encoding $path] \\\n@@ -449,11 +453,22 @@ proc read_diff {fd conflict_size cont_info} {\n \t\t\t{--} {set tags d_--}\n \t\t\t{++} {\n \t\t\t\tset regexp [string map [list %conflict_size $conflict_size]\\\n-\t\t\t\t\t\t\t\t{^\\+\\+([<>=]){%conflict_size}(?: |$)}]\n+\t\t\t\t\t\t\t\t{^\\+\\+([<>=|]){%conflict_size}(?: |$)}]\n \t\t\t\tif {[regexp $regexp $line _g op]} {\n \t\t\t\t\tset is_conflict_diff 1\n \t\t\t\t\tset line [string replace $line 0 1 {  }]\n \t\t\t\t\tset tags d$op\n+\t\t\t\t\t# the ||| conflict-marker marks the start of the pre-image,\n+\t\t\t\t\t# all those lines are also prefixed with '++', thus we need\n+\t\t\t\t\t# to maintain this state\n+\t\t\t\t\tset ::conflict_in_pre_image [expr {$op eq {|}}]\n+\t\t\t\t} elseif {$::conflict_in_pre_image} {\n+\t\t\t\t\t# this is a pre-image line, it is the one which both sides\n+\t\t\t\t\t# are based on. As it has also the '++' line start, it is\n+\t\t\t\t\t# normally shown as 'added', invert this to '--' to make\n+\t\t\t\t\t# it a 'removed' line\n+\t\t\t\t\tset line [string replace $line 0 1 {--}]\n+\t\t\t\t\tset tags d_--\n \t\t\t\t} else {\n \t\t\t\t\tset tags d_++\n \t\t\t\t}\n-- \n2.23.0.11.g242cf7f110\n\n"},{"id":"383315","messageId":"20191002235411.bfkrjc6cgyayqwud@yadavpratyush.com","threadId":"51943","inReplyTo":"a7cff5097eaf29a80c822cb37b537b3859d06ad7.1569873171.git.bert.wesarg@googlemail.com","subject":"Re: [PATCH v3 2/2] git-gui: support for diff3 conflict style","fromName":"Pratyush Yadav","fromEmail":"me@yadavpratyush.com","sentAt":"2019-10-02T23:54:11Z","receivedAt":"2019-10-02T23:54:18Z","isPatch":true,"sender":{"key":"me@yadavpratyush.com","avatar":"https://avatars.githubusercontent.com/u/8817931?v=4"},"body":"Hi,\n\nI made some fixes to the punctuation and capitalization in the comments \nyou added. You can take a look at [0].\n\nJust to be sure, I get the following text in git-gui when I ran your \nexample:\n\n  <<<<<<< HEAD\n +Proin bibendum purus ut est tristique, non pharetra dui consectetur.\n  ||||||| merged common ancestors\n--Proin in felis eu elit suscipit rhoncus vel ut metus.\n  =======\n+ Proin placerat leo malesuada lacinia lobortis.\n  >>>>>>> branch\n\nI noticed that the line after '<<<<<<< HEAD' starts with ' +' and the \nline after '=======' starts with '+ '.\n\nSo on the \"HEAD\" version, the space is before the '+', and on the \n\"branch\" version, the space is after the '+'. This is the intended \nbehaviour, right?\n\nIt is not strictly related to your patch because it happens without \ndiff3 conflict style enabled as well, but I just want to make sure this \nis not a bug.\n\nThe patch looks good. Will queue. Thanks.\n\n[0] https://github.com/prati0100/git-gui/commit/d6e413c7cff6d09a0089d7a5de115ad438b42e81\n\nOn 02/10/19 09:36AM, Bert Wesarg wrote:\n> This adds highlight support for the diff3 conflict style.\n> \n> The common pre-image will be reversed to --, because it has been removed\n> and replaced with ours or theirs side respectively.\n> \n> Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>\n> ---\n>  git-gui.sh   |  3 +++\n>  lib/diff.tcl | 17 ++++++++++++++++-\n>  2 files changed, 19 insertions(+), 1 deletion(-)\n> \n> --- \n> \n> v3: Fixed a syntax error\n> \n> diff --git a/git-gui.sh b/git-gui.sh\n> index fd476b6..6d80f82 100755\n> --- a/git-gui.sh\n> +++ b/git-gui.sh\n> @@ -3581,6 +3581,9 @@ $ui_diff tag conf d_s- \\\n>  $ui_diff tag conf d< \\\n>  \t-foreground orange \\\n>  \t-font font_diffbold\n> +$ui_diff tag conf d| \\\n> +\t-foreground orange \\\n> +\t-font font_diffbold\n>  $ui_diff tag conf d= \\\n>  \t-foreground orange \\\n>  \t-font font_diffbold\n> diff --git a/lib/diff.tcl b/lib/diff.tcl\n> index 0fd4600..dacdda2 100644\n> --- a/lib/diff.tcl\n> +++ b/lib/diff.tcl\n> @@ -347,6 +347,10 @@ proc start_show_diff {cont_info {add_opts {}}} {\n>  \t}\n>  \n>  \tset ::current_diff_inheader 1\n> +\t# detect pre-image lines of the diff3 conflict-style, they are just '++'\n> +\t# lines which is not bijective, thus we need to maintain a state across\n> +\t# lines\n> +\tset ::conflict_in_pre_image 0\n>  \tfconfigure $fd \\\n>  \t\t-blocking 0 \\\n>  \t\t-encoding [get_path_encoding $path] \\\n> @@ -449,11 +453,22 @@ proc read_diff {fd conflict_size cont_info} {\n>  \t\t\t{--} {set tags d_--}\n>  \t\t\t{++} {\n>  \t\t\t\tset regexp [string map [list %conflict_size $conflict_size]\\\n> -\t\t\t\t\t\t\t\t{^\\+\\+([<>=]){%conflict_size}(?: |$)}]\n> +\t\t\t\t\t\t\t\t{^\\+\\+([<>=|]){%conflict_size}(?: |$)}]\n>  \t\t\t\tif {[regexp $regexp $line _g op]} {\n>  \t\t\t\t\tset is_conflict_diff 1\n>  \t\t\t\t\tset line [string replace $line 0 1 {  }]\n>  \t\t\t\t\tset tags d$op\n> +\t\t\t\t\t# the ||| conflict-marker marks the start of the pre-image,\n> +\t\t\t\t\t# all those lines are also prefixed with '++', thus we need\n> +\t\t\t\t\t# to maintain this state\n> +\t\t\t\t\tset ::conflict_in_pre_image [expr {$op eq {|}}]\n> +\t\t\t\t} elseif {$::conflict_in_pre_image} {\n> +\t\t\t\t\t# this is a pre-image line, it is the one which both sides\n> +\t\t\t\t\t# are based on. As it has also the '++' line start, it is\n> +\t\t\t\t\t# normally shown as 'added', invert this to '--' to make\n> +\t\t\t\t\t# it a 'removed' line\n> +\t\t\t\t\tset line [string replace $line 0 1 {--}]\n> +\t\t\t\t\tset tags d_--\n>  \t\t\t\t} else {\n>  \t\t\t\t\tset tags d_++\n>  \t\t\t\t}\n\n-- \nRegards,\nPratyush Yadav\n"}]}