From: Bo Yang <struggleyb.nku@gmail.com>
To: Jakub Narebski <jnareb@gmail.com>
Cc: Jonathan Nieder <jrnieder@gmail.com>,
Junio C Hamano <gitster@pobox.com>,
gitzilla@gmail.com, Alex Riesen <raa.lkml@gmail.com>,
git@vger.kernel.org
Subject: Re: GSoC draft proposal: Line-level history browser
Date: Tue, 23 Mar 2010 23:23:39 +0800 [thread overview]
Message-ID: <41f08ee11003230823i1ca677b8q51b2413040c45c44@mail.gmail.com> (raw)
In-Reply-To: <201003231449.42190.jnareb@gmail.com>
Hi,
On Tue, Mar 23, 2010 at 9:49 PM, Jakub Narebski <jnareb@gmail.com> wrote:
> Try to come with the result of line-level history for some line in
> git sources "by hand": this would help in discussion about what
> line-level history browser should do, and perhaps even be first test
> of it (see e.g. tests for git-blame).
Thanks for your advice of coming with a real example, Jakub! And I can
give a not too trivial one, :)
If you look at the pretty.c line 1032 line, you will find a line like:
format_commit_message(commit, user_format, sb, context);
Take for example, we will trace the history of this line.
We will find that the first time this line appears:
@@ -900,18 +900,18 @@ char *reencode_commit_message(const struct
commit *commit, const char **encoding
...skipped...
if (fmt == CMIT_FMT_USERFORMAT) {
- format_commit_message(commit, user_format, sb, dmode);
+ format_commit_message(commit, user_format, sb, context);
return;
}
And we should trace the preimage, something like:
if (fmt == CMIT_FMT_USERFORMAT) {
format_commit_message(commit, user_format, sb, dmode);
We will find these below:
@@ -770,7 +775,7 @@ void pretty_print_commit(enum cmit_fmt fmt, const struct com
const char *encoding;
if (fmt == CMIT_FMT_USERFORMAT) {
- format_commit_message(commit, user_format, sb);
+ format_commit_message(commit, user_format, sb, dmode);
return;
}
Again:
+
+ if (fmt == CMIT_FMT_USERFORMAT) {
+ format_commit_message(commit, user_format, sb);
+ return;
+ }
+
Here, we find that the line is added from scratch and line level
history browser will do a code movement and copy matching try to find
whether this line if moved from other files.
And it is. In commit 93fc05eb9(Split off the pretty print stuff into
its own file), some code is moved from commit.c to pretty.c and this
line if from commit.c .
Ok, now, we will trace into commit.c for this line.
Again:
char *reencoded;
const char *encoding;
- char *buf;
- if (fmt == CMIT_FMT_USERFORMAT)
- return format_commit_message(commit, user_format,
buf_p, space_p);
+ if (fmt == CMIT_FMT_USERFORMAT) {
+ format_commit_message(commit, user_format, sb);
+ return;
+ }
encoding = (git_log_output_encoding
? git_log_output_encoding
Now, we will trace the commit which produce the above preimage of the
diff hunk. And because there are four lines of the preimage in our
tracing window. We should follow any commit which intersect with these
four lines. Fortunately, there is only one commit.
@@ -1165,7 +1166,7 @@ unsigned long pretty_print_commit(enum cmit_fmt fmt,
char *buf;
if (fmt == CMIT_FMT_USERFORMAT)
- return format_commit_message(commit, msg, buf_p, space_p);
+ return format_commit_message(commit, user_format,
buf_p, space_p);
encoding = (git_log_output_encoding
? git_log_output_encoding
Again, we find:
if (fmt == CMIT_FMT_USERFORMAT)
- return format_commit_message(commit, msg, buf, space);
+ return format_commit_message(commit, msg, buf_p, space_p);
encoding = (git_log_output_encoding
Again:
char *encoding;
+ if (fmt == CMIT_FMT_USERFORMAT)
+ return format_commit_message(commit, msg, buf, space);
+
encoding = (git_log_output_encoding
? git_log_output_encoding
And here, finally, we reach a place where the code is added from
scratch and not copied/moved from other place.
Line level history browser will just display all the related diff to
users and trace the code modification/move/copy.
It traces the preimage of the minimum related diff hunk carefully, if
there is any case that there are more than one commit intersect with
the preimage, we will stop and ask the users to select which way to go
on tracing.
I hope this can help us to discuss the problem, thanks!
Regards!
Bo
next prev parent reply other threads:[~2010-03-23 15:23 UTC|newest]
Thread overview: 54+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-20 9:18 GSoC draft proposal: Line-level history browser Bo Yang
2010-03-20 11:30 ` Johannes Schindelin
2010-03-20 13:10 ` Bo Yang
2010-03-20 13:30 ` Junio C Hamano
2010-03-21 6:03 ` Bo Yang
2010-03-20 13:36 ` Johannes Schindelin
2010-03-21 6:05 ` Bo Yang
2010-03-20 20:35 ` Alex Riesen
2010-03-20 20:57 ` Junio C Hamano
2010-03-21 6:10 ` Bo Yang
2010-03-20 21:58 ` A Large Angry SCM
2010-03-21 6:16 ` Bo Yang
2010-03-21 13:19 ` A Large Angry SCM
2010-03-22 3:48 ` Bo Yang
2010-03-22 4:24 ` Junio C Hamano
2010-03-22 4:34 ` Bo Yang
2010-03-22 5:32 ` Junio C Hamano
2010-03-22 7:31 ` Bo Yang
2010-03-22 7:41 ` Junio C Hamano
2010-03-22 7:52 ` Bo Yang
2010-03-22 8:10 ` Jonathan Nieder
2010-03-23 6:01 ` Bo Yang
2010-03-23 10:08 ` Jakub Narebski
2010-03-23 10:38 ` Bo Yang
2010-03-23 11:22 ` Jakub Narebski
2010-03-23 12:23 ` Bo Yang
2010-03-23 13:49 ` Jakub Narebski
2010-03-23 15:23 ` Bo Yang [this message]
2010-03-23 19:57 ` Jonathan Nieder
2010-03-23 21:51 ` A Large Angry SCM
2010-03-24 2:30 ` Bo Yang
2010-03-23 12:02 ` Peter Kjellerstedt
2010-03-23 18:57 ` Jonathan Nieder
2010-03-24 2:39 ` Bo Yang
2010-03-24 4:02 ` Jonathan Nieder
2010-03-22 10:39 ` Alex Riesen
2010-03-22 15:05 ` Johannes Schindelin
2010-03-22 3:52 ` Bo Yang
2010-03-22 15:48 ` Jakub Narebski
2010-03-22 18:21 ` Johannes Schindelin
2010-03-22 18:38 ` Sverre Rabbelier
2010-03-22 19:26 ` Johannes Schindelin
2010-03-22 20:21 ` Sverre Rabbelier
2010-03-22 19:24 ` Johannes Schindelin
2010-03-23 6:08 ` Bo Yang
2010-03-23 6:27 ` Bo Yang
[not found] ` <201003282120.40536.trast@student.ethz.ch>
2010-03-29 4:14 ` Bo Yang
2010-03-29 18:42 ` Thomas Rast
2010-03-30 2:52 ` Bo Yang
2010-03-30 9:07 ` Michael J Gruber
2010-03-30 9:38 ` Michael J Gruber
2010-03-30 11:10 ` Bo Yang
2010-03-30 9:10 ` Jakub Narebski
2010-03-30 11:15 ` Bo Yang
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=41f08ee11003230823i1ca677b8q51b2413040c45c44@mail.gmail.com \
--to=struggleyb.nku@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=gitzilla@gmail.com \
--cc=jnareb@gmail.com \
--cc=jrnieder@gmail.com \
--cc=raa.lkml@gmail.com \
/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.
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 NNTP newsgroup(s).