Re: looking for example of following code across files

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

 



"Rhodes, Kate" <masukomi@xxxxxxxxx> writes:

> I seem to remember that when Linus was giving the tech-talk to the
> folks at Google he mentioned Git being able to follow a block of code
> as it was moved from file to file, but I'm having a hard time finding
> an actual example of how that plays out. I'd love to be able to
> demonstrate this to people but I'm not quite sure of the steps I'd
> need to do to accomplish this.
> 
> I've gotten as far as using git ls-tree to track down the sha1 of the
> blob I want to follow, which I'm assuming is the key to making this
> happen but I'm not sure where to go from there. :(
> 
> Can someone please point me to an example showing how to go about this?

For example in git.git repository, try "git gui blame revision.c".
The 9th fragment, the 'path_name' function, was moved there from the
file "rev-list.c".

This is the commit that added the code:

  commit e646de0d14bac20ef6e156c1742b9e62fb0b9020
  Author:	Junio C Hamano <junkio@xxxxxxx>  czw lut 23 07:10:24 2006
  Committer:	Junio C Hamano <junkio@xxxxxxx>  pi? lut 24 08:44:42 2006
  Original File:	rev-list.c

  rev-list --objects: use full pathname to help hashing.

  This helps to group the same files from different revs together,
  while spreading files with the same basename in different
  directories, to help pack-object.

  Signed-off-by: Junio C Hamano <junkio@xxxxxxx>

This is the commit that moved the code

  commit ae563542bf10fa8c33abd2a354e4b28aca4264d7
  Author:	Linus Torvalds <torvalds@xxxxxxxx>  nie lut 26 01:19:46 2006
  Committer:	Junio C Hamano <junkio@xxxxxxx>  pon lut 27 00:33:27 2006

  First cut at libifying revlist generation

  This really just splits things up partially, and creates the
  interface to set things up by parsing the command line.

  No real code changes so far, although the parsing of filenames is a bit
  stricter. In particular, if there is a "--", then we do not accept any
  filenames before it, and if there isn't any "--", then we check that _all_
  paths listed are valid, not just the first one.

  The new argument parsing automatically also gives us "--default" and
  "--not" handling as in git-rev-parse.

  Signed-off-by: Linus Torvalds <torvalds@xxxxxxxx>
  Signed-off-by: Junio C Hamano <junkio@xxxxxxx>

You can check the commits using gitweb; unfortunately blame in gitweb
is usually disabled, and it dies not have fancy "git gui blame"
showing of code movements.

P.S. Sorry, I've just noticed that the dates are in my locale...
-- 
Jakub Narebski
Poland
ShadeHawk on #git
-
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