From: KES <kes-kes@yandex.ru>
To: git <git@vger.kernel.org>
Subject: -C options do not work for code evaluation
Date: Sat, 06 Jan 2018 13:44:22 +0200 [thread overview]
Message-ID: <654491515239062@web58g.yandex.ru> (raw)
Hi.
I run this command:
git log --graph --decorate --pretty=oneline --abbrev-commit --color-moved -C -L 534,545:lib/DB/Hooks.pm
at some point of evalutation I see:
http://joxi.net/Y2L4GQ0in480l2
* e348241 Wrap whole DB::DB into &dbcall by moving DB::db into DB::interact
|
| diff --git a/lib/DB/Hooks.pm b/lib/DB/Hooks.pm
| --- a/lib/DB/Hooks.pm
| +++ b/lib/DB/Hooks.pm
| @@ -528,5 +528,12 @@
| - dbcall \&emit, 'btrap', $source, $f, $l;
| - dbcall \&emit, 'interact';
| - dbcall \&emit, 'atrap';
| +sub db {
| + my $dd = DB::new if DB::state( 'dbcall' );
| + DB::start_dd if $DB::DB || DB::state( 'dbcall' );
| + local $DB::DB = 1;
| +
| + &save_context;
| + my $dbg = DB::new \&restore_context;
| +
| + my( undef, $f, $l ) = caller(1);
| + dbcall \&interact, $f, $l;
| }
|
When I look at commit e348241 I can see that code is moved:
http://joxi.net/eAOMjW1I4W7LBm
commit e348241bfb9ba563c82d28c05d3f45ab9c1a765d
Author: Eugen Konkov <kes-kes@yandex.ru>
Date: Fri Jan 5 15:58:17 2018 +0200
Wrap whole DB::DB into &dbcall by moving DB::db into DB::interact
This allow us to not wrap each &emit call into &dbcall
diff --git a/lib/DB/Hooks.pm b/lib/DB/Hooks.pm
index 6ade20a..dabe701 100644
--- a/lib/DB/Hooks.pm
+++ b/lib/DB/Hooks.pm
@@ -490,23 +490,16 @@ sub goto {
}
-sub db {
- my $dd = DB::new if DB::state( 'dbcall' );
- DB::start_dd if $DB::DB || DB::state( 'dbcall' );
- local $DB::DB = 1;
- &save_context;
- my $dbg = DB::new \&restore_context;
-
-
- my( undef, $f, $l ) = caller(1);
+sub interact {
+ my( $f, $l ) = @_;
my $source = DB::source( $f )->[ $l ]; chomp $source;
- dbcall \&emit, 'trace', $source, $f, $l if $DB::trace;
+ emit( 'trace', $source, $f, $l ) if $DB::trace;
... #<<<<I remove part of patch to minify text
@@ -525,9 +518,23 @@ sub db {
- dbcall \&emit, 'btrap', $source, $f, $l;
- dbcall \&emit, 'interact';
- dbcall \&emit, 'atrap';
+ emit( 'btrap', $source, $f, $l );
+ emit( 'interact' );
+ emit( 'atrap' );
+}
+
+
+
+sub db {
+ my $dd = DB::new if DB::state( 'dbcall' );
+ DB::start_dd if $DB::DB || DB::state( 'dbcall' );
+ local $DB::DB = 1;
+
+ &save_context;
+ my $dbg = DB::new \&restore_context;
+
+ my( undef, $f, $l ) = caller(1);
+ dbcall \&interact, $f, $l;
}
To workaround this problem I run:
git log --graph --decorate --pretty=oneline --abbrev-commit --color-moved -C -L 492,505:lib/DB/Hooks.pm e348241b
http://joxi.ru/vAWMwOZIkNy7Rm
* e348241 Wrap whole DB::DB into &dbcall by moving DB::db into DB::interact
|
| diff --git a/lib/DB/Hooks.pm b/lib/DB/Hooks.pm
| --- a/lib/DB/Hooks.pm
| +++ b/lib/DB/Hooks.pm
| @@ -492,21 +492,14 @@
|
| -sub db {
| - my $dd = DB::new if DB::state( 'dbcall' );
| - DB::start_dd if $DB::DB || DB::state( 'dbcall' );
| - local $DB::DB = 1;
|
| - &save_context;
| - my $dbg = DB::new \&restore_context;
| -
| -
| - my( undef, $f, $l ) = caller(1);
| +sub interact {
| + my( $f, $l ) = @_;
|
| my $source = DB::source( $f )->[ $l ]; chomp $source;
| - dbcall \&emit, 'trace', $source, $f, $l if $DB::trace;
| + emit( 'trace', $source, $f, $l ) if $DB::trace;
|
| my @trap;
| if( my $info = DB::traps( $f )->{ $l } ) {
| - @trap = dbcall \&emit, 'trap', $info, $f, $l;
| + @trap = emit( 'trap', $info, $f, $l );
| # Stop unconditionally if there is no subscribers for the event
| @trap = (1) unless @trap;
| }
* 30c07c0 If we come from { dbcall } start debugger debugging too
|
| diff --git a/lib/DB/Hooks.pm b/lib/DB/Hooks.pm
| --- a/lib/DB/Hooks.pm
| +++ b/lib/DB/Hooks.pm
| @@ -489,20 +489,21 @@
|
| sub db {
| - DB::start_dd if $DB::DB;
| + my $dd = DB::new if DB::state( 'dbcall' );
| + DB::start_dd if $DB::DB || DB::state( 'dbcall' );
| local $DB::DB = 1;
|
| &save_context;
| my $dbg = DB::new \&restore_context;
|
|
| my( undef, $f, $l ) = caller(1);
|
| my $source = DB::source( $f )->[ $l ]; chomp $source;
| dbcall \&emit, 'trace', $source, $f, $l if $DB::trace;
|
| my @trap;
| if( my $info = DB::traps( $f )->{ $l } ) {
| @trap = dbcall \&emit, 'trap', $info, $f, $l;
| # Stop unconditionally if there is no subscribers for the event
| @trap = (1) unless @trap;
| }
1. In the example above moved code is not displayed as moved. It seems the whole
changeset (commit) is not inspected despite on the `-C` option is supplied
2. Please provide an option which will allow to follow moved code (maybe this should be done by default,
because 71% (77%) of code in interested block is moved and not changed)
| @@ -528,5 +528,12 @@
| - dbcall \&emit, 'btrap', $source, $f, $l;
| - dbcall \&emit, 'interact';
| - dbcall \&emit, 'atrap';
| +sub db {
| + my $dd = DB::new if DB::state( 'dbcall' );
| + DB::start_dd if $DB::DB || DB::state( 'dbcall' );
| + local $DB::DB = 1;
| +
| + &save_context;
| + my $dbg = DB::new \&restore_context;
| +
| + my( undef, $f, $l ) = caller(1);
| + dbcall \&interact, $f, $l;
| }
Maybe supply interactive mode which will suggest where to follow
Thank you
reply other threads:[~2018-01-06 11:52 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=654491515239062@web58g.yandex.ru \
--to=kes-kes@yandex.ru \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).