Re: GSoC draft proposal: Line-level history browser
Show 7 quoted lines
>
> Errr... how the first line in preimage differs from first line in
> postimage? The look as if they are the same:
>
> - for (i = 0; i < extra_hdr_nr; i++) {
> + for (i = 0; i < extra_hdr.nr; i++) {
>Show 14 quoted lines
>
> The problem is when you are asking about tracking a subset of lines
> that appear in postimage of a patch. For example if we ask for
> history of
>
> strbuf_addstr(&buf, extra_hdr.items[i].string);
>
> line, should we track history of
>
> for (i = 0; i < extra_hdr.nr; i++) {
>
> line which appears in relevant diff chunk? If not, how we should
> detect which line in preimage (if any) corresponds to given line in
> postimage?If I understand correctly, that is as following.
@@ -1008,29 +1000,29 @@ int cmd_format_patch(int argc, const char
**argv, const char *prefix)
add_signoff = xmemdupz(committer, endpos - committer + 1);
}
- for (i = 0; i < extra_hdr_nr; i++) {
- strbuf_addstr(&buf, extra_hdr[i]);
+ for (i = 0; i < extra_hdr.nr; i++) {
+ strbuf_addstr(&buf, extra_hdr.items[i].string);
strbuf_addch(&buf, '\n');
}
Here, the user only ask for tracking the strbuf_addstr line. And we
find the above diff hunk. I think we can then find what the line would
be in the preimage using @@ -1008,29 +1000,29 @@. The strbuf_addstr
is located at
1000(the postimage start line number)
+3(the context number)
+1(the number of lines '+' before this line) in the postimage,
and we can calculate its line number in the preimage by the same way
1008
+3
+1(the number of lines with '-' before this line).
How do you think about this method?
Regards!
Bo