git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [BUG] Bad coloring
@ 2019-06-26  8:32 Eugen Konkov
  2019-06-26 12:24 ` Derrick Stolee
  0 siblings, 1 reply; 2+ messages in thread
From: Eugen Konkov @ 2019-06-26  8:32 UTC (permalink / raw)
  To: Git Mailing List

[-- Attachment #1: Type: text/plain, Size: 406 bytes --]

Hello,

For next diff the `}` line should not be detected as removed/added.

As  you can see there are differences only at new lines. (see attached
pics)

git version 2.21.0


git diff -b -w --ignore-blank-lines


git config:

[color "diff"]
    old = red bold
    new = green bold

[diff]
    tool = sublimerge
    colorMoved = default
    colorMovedWS = ignore-all-space



-- 
Best regards,
Eugen Konkov

[-- Attachment #2: diff --]
[-- Type: application/octet-stream, Size: 2907 bytes --]

--- a/Service.pm
+++ b/Service.pm
@@ -34,46 +34,4 @@ $X->set_primary_key("id");
 $X->has_many( service_types => $X, 'parent_id' );
 
 
-sub sqlt_deploy_hook {
-    my( $self, $sqlt_table ) =  @_;
-
-    my $sqlt =  $sqlt_table->schema;
-    $sqlt->add_procedure(
-        name =>  'service_level_tree',
-        parameters =>  [
-            { argmode => 'in',  type => 'integer' },
-        ],
-        extra =>  {
-            returns =>  { type => 'table( id int, parent_id int, name text, display text,
-            definitions =>  [
-                { language  =>  'sql' },
-                { attribute =>  'STABLE' },
-                { quote => "\$\$\n",  body => <<'   FUNC' =~ s!^\t!!grm  =~ s!;\n!;/**/\n
-        WITH RECURSIVE service_level_tree (id, parent_id, name, display, depth ) AS (
-            SELECT
-              id,
-              parent_id,
-              name,
-              display,
-              1
-            FROM service_level
-            WHERE id = $1
-            UNION
-            SELECT
-              sl.id,
-              sl.parent_id,
-              sl.name,
-              sl.display,
-              depth +1
-            FROM service_level_tree t
-            INNER JOIN service_level sl ON sl.id = t.parent_id
-            WHERE depth < 10   -- Prohibit deep hierarchy
-        )
-        SELECT * FROM service_level_tree;
-    FUNC
-    ]});
-
-}
-
-
 1;
diff --git a/ServiceLevel.pm b/S
index 73fa9dea..f7da48c8 100644
--- a/ServiceLevel.pm
+++ b/ServiceLevel.pm
@@ -34,4 +34,46 @@ $X->add_unique_constraint([ 'parent_id', 'name' ]);
 
 $X->has_many( service_levels => $X, 'parent_id' );
 
+
+sub sqlt_deploy_hook {
+    my( $self, $sqlt_table ) =  @_;
+
+    my $sqlt =  $sqlt_table->schema;
+    $sqlt->add_procedure(
+        name =>  'service_level_tree',
+        parameters =>  [
+            { argmode => 'in',  type => 'integer' },
+        ],
+        extra =>  {
+            returns =>  { type => 'table( id int, parent_id int, name text, display text,
+            definitions =>  [
+                { language  =>  'sql' },
+                { attribute =>  'STABLE' },
+                { quote => "\$\$\n",  body => <<'   FUNC' =~ s!^\t!!grm  =~ s!;\n!;/**/\n
+        WITH RECURSIVE service_level_tree (id, parent_id, name, display, depth ) AS (
+            SELECT
+              id,
+              parent_id,
+              name,
+              display,
+              1
+            FROM service_level
+            WHERE id = $1
+            UNION
+            SELECT
+              sl.id,
+              sl.parent_id,
+              sl.name,
+              sl.display,
+              depth +1
+            FROM service_level_tree t
+            INNER JOIN service_level sl ON sl.id = t.parent_id
+            WHERE depth < 10   -- Prohibit deep hierarchy
+        )
+        SELECT * FROM service_level_tree;
+    FUNC
+    ]});
+}
+
+
 1;

[-- Attachment #3: _.jpg --]
[-- Type: image/jpeg, Size: 6767 bytes --]

[-- Attachment #4: _2.jpg --]
[-- Type: image/jpeg, Size: 6551 bytes --]

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

* Re: [BUG] Bad coloring
  2019-06-26  8:32 [BUG] Bad coloring Eugen Konkov
@ 2019-06-26 12:24 ` Derrick Stolee
  0 siblings, 0 replies; 2+ messages in thread
From: Derrick Stolee @ 2019-06-26 12:24 UTC (permalink / raw)
  To: Eugen Konkov, Git Mailing List

On 6/26/2019 4:32 AM, Eugen Konkov wrote:
> Hello,
> 
> For next diff the `}` line should not be detected as removed/added.
> 
> As  you can see there are differences only at new lines. (see attached
> pics)
> 
> git version 2.21.0
> 
> 
> git diff -b -w --ignore-blank-lines
> 
> 
> git config:
> 
> [color "diff"]
>     old = red bold
>     new = green bold
> 
> [diff]
>     tool = sublimerge
>     colorMoved = default
>     colorMovedWS = ignore-all-space
> 

Below, I pasted your diff in the message body for
easier discussion on-list.

Your diff shows that the content was moved. However, it was
also changed during the move by adding that extra line of
whitespace. The "ignore-all-space" setting can only ignore
whitespace when matching lines. It cannot ignore entire
lines of whitespace.

For that reason, the last three lines are not matched as moved
because they are not part of the larger hunk that moved. You
are using the 'default' mode for diff.colorMoved which defaults
to the 'zebra' mode and that matches blocks of at least 20
characters. These lines at the end are only four characters
("}\n\n\n").

If we used a smaller block size, then we would have too many
false-positives when using the color-moved option.

Thanks,
-Stolee

---

--- a/Service.pm
+++ b/Service.pm
@@ -34,46 +34,4 @@ $X->set_primary_key("id");
 $X->has_many( service_types => $X, 'parent_id' );
 
 
-sub sqlt_deploy_hook {
-    my( $self, $sqlt_table ) =  @_;
-
-    my $sqlt =  $sqlt_table->schema;
-    $sqlt->add_procedure(
-        name =>  'service_level_tree',
-        parameters =>  [
-            { argmode => 'in',  type => 'integer' },
-        ],
-        extra =>  {
-            returns =>  { type => 'table( id int, parent_id int, name text, display text,
-            definitions =>  [
-                { language  =>  'sql' },
-                { attribute =>  'STABLE' },
-                { quote => "\$\$\n",  body => <<'   FUNC' =~ s!^\t!!grm  =~ s!;\n!;/**/\n
-        WITH RECURSIVE service_level_tree (id, parent_id, name, display, depth ) AS (
-            SELECT
-              id,
-              parent_id,
-              name,
-              display,
-              1
-            FROM service_level
-            WHERE id = $1
-            UNION
-            SELECT
-              sl.id,
-              sl.parent_id,
-              sl.name,
-              sl.display,
-              depth +1
-            FROM service_level_tree t
-            INNER JOIN service_level sl ON sl.id = t.parent_id
-            WHERE depth < 10   -- Prohibit deep hierarchy
-        )
-        SELECT * FROM service_level_tree;
-    FUNC
-    ]});
-
-}
-
-
 1;
diff --git a/ServiceLevel.pm b/S
index 73fa9dea..f7da48c8 100644
--- a/ServiceLevel.pm
+++ b/ServiceLevel.pm
@@ -34,4 +34,46 @@ $X->add_unique_constraint([ 'parent_id', 'name' ]);
 
 $X->has_many( service_levels => $X, 'parent_id' );
 
+
+sub sqlt_deploy_hook {
+    my( $self, $sqlt_table ) =  @_;
+
+    my $sqlt =  $sqlt_table->schema;
+    $sqlt->add_procedure(
+        name =>  'service_level_tree',
+        parameters =>  [
+            { argmode => 'in',  type => 'integer' },
+        ],
+        extra =>  {
+            returns =>  { type => 'table( id int, parent_id int, name text, display text,
+            definitions =>  [
+                { language  =>  'sql' },
+                { attribute =>  'STABLE' },
+                { quote => "\$\$\n",  body => <<'   FUNC' =~ s!^\t!!grm  =~ s!;\n!;/**/\n
+        WITH RECURSIVE service_level_tree (id, parent_id, name, display, depth ) AS (
+            SELECT
+              id,
+              parent_id,
+              name,
+              display,
+              1
+            FROM service_level
+            WHERE id = $1
+            UNION
+            SELECT
+              sl.id,
+              sl.parent_id,
+              sl.name,
+              sl.display,
+              depth +1
+            FROM service_level_tree t
+            INNER JOIN service_level sl ON sl.id = t.parent_id
+            WHERE depth < 10   -- Prohibit deep hierarchy
+        )
+        SELECT * FROM service_level_tree;
+    FUNC
+    ]});
+}
+
+
 1;


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

end of thread, other threads:[~2019-06-26 12:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-06-26  8:32 [BUG] Bad coloring Eugen Konkov
2019-06-26 12:24 ` Derrick Stolee

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).