From: Thomas Rast <trast@student.ethz.ch>
To: Junio C Hamano <gitster@pobox.com>
Cc: "Thomas Rast" <trast@student.ethz.ch>,
git@vger.kernel.org, "Bo Yang" <struggleyb.nku@gmail.com>,
"Zbigniew Jędrzejewski-Szmek" <zbyszek@in.waw.pl>,
"Will Palmer" <wmpalmer@gmail.com>
Subject: Re: [PATCH v8 4/5] Implement line-history search (git log -L)
Date: Thu, 28 Feb 2013 22:41:17 +0100 [thread overview]
Message-ID: <87hakw3yma.fsf@pctrast.inf.ethz.ch> (raw)
In-Reply-To: <7v38wgi38z.fsf@alter.siamese.dyndns.org> (Junio C. Hamano's message of "Thu, 28 Feb 2013 12:37:32 -0800")
Junio C Hamano <gitster@pobox.com> writes:
> Thomas Rast <trast@student.ethz.ch> writes:
>
>> Junio C Hamano <gitster@pobox.com> writes:
>>
>>>> +/*
>>>> + * NEEDSWORK: manually building a diff here is not the Right
>>>> + * Thing(tm). log -L should be built into the diff pipeline.
>>>
>>> I am not sure about this design, and do not necessarily agree that
>>> wedging this to the diff pipeline is the right future direction.
>>>
>>> I have a feeling that "log -L" should actually be built around
>>> "blame". You let blame to hit the first parent to take the blame,
>>> and then turn around to show a single "diff-tree" between the child
>>> and the parent with whatever other diff pipeline gizmo the user can
>>> give you from the command line. The blame also tells you what the
>>> "interesting" line range were at the first parent commit you found,
>>> so you can re-run the same thing with an updated range.
>>
>> Hrm, now that you mention it, this is actually a brilliant idea.
>
> I don't know. That is just me handwaving without giving a serious
> end-to-end thought.
Having thought about it for some time, I think we need to figure out
if/what can be shared. I can't shake off the feeling that *something*
should be common between blame and log -L, but I can't exactly say what
so far.
Your suggestion of looking at the first blame hit is almost there. (And
in fact if it did work, it should be rather easy to prototype from blame
--incremental.) However, it works only for additions, not removals.
Lines that were removed do not show up in blame at all, and since a
patch can also _only_ remove lines, blame would not find it even if we
adjust the blamed range at every found commit.
It may be possible to fix that by doing a reverse blame, but I suspect
that runs into yet more trouble when trying to reverse-blame from two
different sides of history.
Then there's a different issue if the order of code flips. Suppose you
have
A1
A2
B1
B2
and later change to
B1
B2
A1
A2
Diffs can fundamentally not express this; they'll only see one side as
unchanged, and the other as completely new. Ideally we'd be able to
track this case correctly -- as blame does? -- no matter which part is
within our tracked range.
Anyway, I believe this should be booked under "future improvements".
I've had it in my own tree for ages and it already does the right thing
most of the time :-)
--
Thomas Rast
trast@{inf,student}.ethz.ch
next prev parent reply other threads:[~2013-02-28 21:41 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-28 16:38 [PATCH v8 0/5] git log -L Thomas Rast
2013-02-28 16:38 ` [PATCH v8 1/5] Refactor parse_loc Thomas Rast
2013-02-28 17:16 ` Junio C Hamano
2013-02-28 19:24 ` Thomas Rast
2013-02-28 16:38 ` [PATCH v8 2/5] blame: introduce $ as "end of file" in -L syntax Thomas Rast
2013-02-28 17:18 ` Junio C Hamano
2013-03-12 22:34 ` Junio C Hamano
2013-03-13 7:52 ` Thomas Rast
2013-03-13 16:05 ` Junio C Hamano
2013-02-28 16:38 ` [PATCH v8 3/5] Export rewrite_parents() for 'log -L' Thomas Rast
2013-02-28 17:19 ` Junio C Hamano
2013-02-28 16:38 ` [PATCH v8 4/5] Implement line-history search (git log -L) Thomas Rast
2013-02-28 17:51 ` Junio C Hamano
2013-02-28 19:32 ` Thomas Rast
2013-02-28 20:37 ` Junio C Hamano
2013-02-28 21:41 ` Thomas Rast [this message]
2013-02-28 22:23 ` Junio C Hamano
2013-03-01 8:49 ` Thomas Rast
2013-03-01 14:59 ` Thomas Rast
2013-02-28 16:38 ` [PATCH v8 5/5] log -L: :pattern:file syntax to find by funcname Thomas Rast
2013-02-28 19:56 ` [PATCH v8 0/5] git log -L Junio C Hamano
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=87hakw3yma.fsf@pctrast.inf.ethz.ch \
--to=trast@student.ethz.ch \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=struggleyb.nku@gmail.com \
--cc=wmpalmer@gmail.com \
--cc=zbyszek@in.waw.pl \
/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).