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;