Re: looking for example of following code across files

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Feb 16, 2008 at 12:10:11PM -0500, Rhodes, Kate wrote:

> In order to find the original commit of each block is the system looking 
> up the commit for each block via it's SHA1, then following its parent 
> commits until it finds another commit that affected the same block or runs 
> out of commits?

Not exactly. You don't have a sha1 for each block, you have a sha1 for
the whole file. So you walk the parent tree looking for the first time a
particular chunk showed up. The basic idea is sketched out here:

http://article.gmane.org/gmane.comp.version-control.git/28826

> I'm thinking that while this would be possible to do manually it would  
> way too many lookups to be practical. Or, is there a simpler way to do it 
> on the command line?

You could do it manually, but it would be horribly slow. An overly
simplified version of the algorithm is:

  1. Assume I'm interesed in a line that says "int foo() {"
  2. Check whether my parent has that line
     2a. If yes, then pass blame to parent, starting at '1'.
     2b. If no, then I introduced the line. Accept blame.

[When you talk about content movement, it gets a little trickier. See
Junio's original explanation for more details.]

So you would end up pass blame for some lines through many commits that
didn't touch those lines. I don't think you would want to do that by
hand.

-Peff
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux