Git development
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Felipe Contreras <felipe.contreras@gmail.com>
Cc: git@vger.kernel.org, Ramkumar Ramachandra <artagnon@gmail.com>,
	Duy Nguyen <pclouds@gmail.com>
Subject: Re: [PATCH v6] Add new git-related helper to contrib
Date: Thu, 23 May 2013 14:52:25 -0700	[thread overview]
Message-ID: <7vppwhcqjq.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <CAMP44s0X-79Pn4gq_rqBbti-xUobyYDc8Gy-3-g=sq8siZqq8g@mail.gmail.com> (Felipe Contreras's message of "Thu, 23 May 2013 16:33:13 -0500")

Felipe Contreras <felipe.contreras@gmail.com> writes:

>> Imagine that your scoreboard originally has three blocks of text
>> (i.e. blame_entry) A, B, and C, and the current suspect for A and C
>> are the same, while we already know what the final guilty party for
>> B is (which may be some descendant of the "suspect").
>
> I don't see how that's possible, but whatever.

The tree in your latest commit HEAD has a file with block of text A
followed by block of text B followed by block of text C.  The latest
commit was the one that added B (perhaps new lines were inserted, or
perhaps existing contiguous block of text was replaced, there is no
difference between these two cases).  You start digging the history
of this file from HEAD.

Your scoreboard begins with a single blame-entry that covers all
three segments, with its suspect set to HEAD.  Then pass_blame()
discovers that top and bottom segments are older than this latest
commit, and splits the originally-one blame entry into three blame
entries.  The first and the third blame entries cover the block A
and the block C respectively, and their suspect fields are both set
to HEAD^.  The second blame entry covers the block B and its suspect
does not change (it still is HEAD).  Then it returns to the caller.

The caller of pass_blame() looks at the scoreboard and finds these
three blame entries.  The second one's supect is still the original
suspect the caller asked pass_blame() to exonerate blames for, and
the suspect failed to do so for block B.  The final blame for the
middle block is now known to be HEAD.

After all of the above, the next iteration of while(1) loop begins.
That is how you arrive to the "whatever" situation.  You have three
blame entries, A, B and C, and suspect of A and C are the same,
while B has a different suspect.

Then in that "next iteration", we pick blame entry for A and decide
to see if HEAD^, which is the suspect for A, can be exonerated of
blames for _any_ (not just A) blame entry it currently is suspected
for.  We call pass_blame() and it will find and process both A and
C with a single "git diff-tree", attempting to pass blame to HEAD^^
and its ancestors.

  reply	other threads:[~2013-05-23 21:52 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-19 15:53 [PATCH v6] Add new git-related helper to contrib Felipe Contreras
2013-05-20  1:47 ` Eric Sunshine
2013-05-22 19:23 ` Junio C Hamano
2013-05-22 19:54   ` Junio C Hamano
2013-05-22 22:23   ` Felipe Contreras
2013-05-22 22:38     ` Junio C Hamano
2013-05-22 22:43       ` Felipe Contreras
2013-05-22 22:53         ` Junio C Hamano
2013-05-22 22:58           ` Junio C Hamano
2013-05-22 23:42             ` Junio C Hamano
2013-05-22 23:57               ` Felipe Contreras
2013-05-23  0:08                 ` Junio C Hamano
2013-05-23  4:07                   ` Felipe Contreras
2013-05-23  5:22                     ` Felipe Contreras
2013-05-23 16:54                       ` Junio C Hamano
2013-05-23 18:34                         ` Junio C Hamano
2013-05-23 21:33                         ` Felipe Contreras
2013-05-23 21:52                           ` Junio C Hamano [this message]
2013-05-23 21:58                             ` Felipe Contreras
2013-05-23 22:44                               ` Junio C Hamano
2013-05-23 22:59                                 ` Felipe Contreras
2013-05-23 23:47                                   ` Junio C Hamano
2013-05-24  0:22                                     ` Felipe Contreras
2013-05-23  3:23               ` Felipe Contreras
2013-05-23  3:50                 ` Felipe Contreras
2013-05-23 17:05                   ` Junio C Hamano
2013-05-22 23:19           ` Felipe Contreras

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=7vppwhcqjq.fsf@alter.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=artagnon@gmail.com \
    --cc=felipe.contreras@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=pclouds@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