From: Junio C Hamano <gitster@pobox.com>
To: Jay Soffian <jaysoffian@gmail.com>
Cc: git <git@vger.kernel.org>
Subject: Re: blame -L questions
Date: Mon, 08 Feb 2010 19:32:50 -0800 [thread overview]
Message-ID: <7vtytrulr1.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <76718491002081903s2e37875bs85eeb55779167ce7@mail.gmail.com> (Jay Soffian's message of "Mon\, 8 Feb 2010 22\:03\:37 -0500")
Jay Soffian <jaysoffian@gmail.com> writes:
> My use case is emitting blocks that are wrapped in
>
> #if defined(WHATEVER)
> ....
> #endif
>
> I was going to use the syntax -L /start/../end/ for this.
>
> I naively thought I might just be able to setup multiple blame_entry's
> linked through the next/prev pointers at the start, but that clearly
> does not work.
The current -L parser is prepared to take only one range, but the
underlying data structure should be able to support what you want to do.
The scoreboard holds one final image (final_buf, final_buf_size) that is
the whole blob in the revision being annotated. Without -L, we start with
one blame entry in ent that covers the whole lines in this image. With a
single -L (i.e. the current implementation), this single ent covers a bit
narrower range of lines than the whole file.
A blame_entry records a range of lines (lno, num_lines) and which path
from what commit is the current suspect. We iteratively compare this
with parents of the suspect to see if we can pass blame for some lines
in the given range to some parents. When we can pass blame for the
whole range, we just update the "suspect" to parent; when we can pass
blame for some but not for other lines in the range, we break the
blame_entry into pieces, pass blame to parents for lines that came
from those parents and declare the current suspect for lines that did
not appear in any of the parents.
But this part does not concern you very much. The only thing you need
to know for what you want to do is how an ent must be initialized.
You should be able to start with more than one blame entry queued in ent
member of the scoreboard, each representing one range given by an -L
option, and as long as you prime these blame entries correctly, everything
should work just fine. sb->ent is supposed to be sorted by line number
and not have overlap, but I don't think they have to be contiguous.
prev parent reply other threads:[~2010-02-09 3:33 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-09 3:03 blame -L questions Jay Soffian
2010-02-09 3:32 ` Junio C Hamano [this message]
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=7vtytrulr1.fsf@alter.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=jaysoffian@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).