git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* How to tell if a file was renamed between two commits
@ 2010-02-03  2:29 Ron Garret
  2010-02-03  2:32 ` Shawn O. Pearce
  0 siblings, 1 reply; 6+ messages in thread
From: Ron Garret @ 2010-02-03  2:29 UTC (permalink / raw)
  To: git

I'm trying to write a little utility that will extract all the revisions 
of a particular file.  I start with a git rev-list HEAD -- filename, get 
the tree objects with git cat-file commit, the file objects with git 
ls-tree, and finally the file contents themselves with git cat-file 
blob.  It works, except in the case where the file name was changed.  
git rev-list is smart enough to track those name changes, but my little 
revision tracker isn't.  It dies when suddenly there is no file with the 
right name in the tree.

So... is there an easy way to work around this?  Is there a way to get, 
say, rev-list to tell me when the file it is tracking changed names?  Or 
a git-diff incantation?  I just need something that will tell me given 
two commits and a file name whether the file was renamed between those 
two commits and if so what its new name is.  There must be an easy way 
to do this, but I can't figure out what it is.

Thanks,
rg

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2010-02-03 17:49 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-03  2:29 How to tell if a file was renamed between two commits Ron Garret
2010-02-03  2:32 ` Shawn O. Pearce
2010-02-03  2:48   ` Ron Garret
2010-02-03  2:52     ` Ron Garret
2010-02-03  2:53     ` Shawn O. Pearce
2010-02-03 17:48       ` Ron Garret

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).