Wireshark-dev: Re: [Wireshark-dev] git history of files moved in SVN

From: Peter Wu <lekensteyn@xxxxxxxxx>
Date: Mon, 14 Apr 2014 23:17:17 +0200
On Monday 14 April 2014 17:07:48 Jeff Morriss wrote:
> > (That change doesn't show up in the history of
> > epan/dissectors/packet-tcp.c in the Git repository, probably because the
> > SVN-to-Git converter couldn't handle moves/renames in SVN, perhaps
> > because SVN, while handling them better than CVS, still handles them a
> > bit awkwardly.)
> 
> Ouch--you'd think that this kind of thing would work.  I guess none of 
> the dissectors have a history prior to The Great Dissector Move of 
> 2004/7/18.  Pity, as I recall a significant portion of the reason to 
> move to SVN (from CVS) was so that files could be moved without losing 
> history.

It is preserved, you just need to add the --follow option to continue the 
history after a rename:

    git log --follow --stat epan/dissectors/packet-tcp.c

Output:

commit 669db206cb1f270046ad400fff7655e20c63e723
Author: Gilbert Ramirez <gram@xxxxxxxxxxxxxxx>
Date:   Sun Jul 18 18:06:47 2004 +0000

    Move dissectors to epan/dissectors directory.
    
    Also move ncp222.py, x11-fields, process-x11-fields.pl,
    make-reg-dotc, and make-reg-dotc.py.
    
    Adjust #include lines in files that include packet-*.h
    files.
    
    svn path=/trunk/; revision=11410

 packet-tcp.c => epan/dissectors/packet-tcp.c | 0
 1 file changed, 0 insertions(+), 0 deletions(-)

Gits renames are based on heuristics, there is no rename metadata stored. 
Sometimes you also want to see renamed files in a single commit with 
additional changes. In that case you are looking for the -M option to detect 
that (by default there is a similarity index of 50%.) See the manual page git-
log(1) for more details.

Kind regards,
Peter