All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Shawn O. Pearce" <spearce@spearce.org>
To: Ron Garret <ron1@flownet.com>
Cc: git@vger.kernel.org
Subject: Re: How to tell if a file was renamed between two commits
Date: Tue, 2 Feb 2010 18:32:19 -0800	[thread overview]
Message-ID: <20100203023219.GA13092@spearce.org> (raw)
In-Reply-To: <ron1-2EA926.18292002022010@news.gmane.org>

Ron Garret <ron1@flownet.com> wrote:
> 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.

Maybe use the -M flag to git log, or the --follow flag to
log/rev-list?

-- 
Shawn.

  reply	other threads:[~2010-02-03  2:32 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

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=20100203023219.GA13092@spearce.org \
    --to=spearce@spearce.org \
    --cc=git@vger.kernel.org \
    --cc=ron1@flownet.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.