Skip to contentSkip to conversation

Bad coloring

BUG Eugen Konkov 2 participants 2 messages Jun 26, 2019

lore
Share & tools
lore
#0 lore raw

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

Signature · 2 lines
Best regards,
Eugen Konkov
#1 lore raw
Quoted 15 lines · Eugen Konkov

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:

Quoted 9 lines

[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

---

Service.pm +0 -42
@@ -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;
ServiceLevel.pm +42 -0

46 lines not on this page · raw message