git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Nieder <jrnieder@gmail.com>
To: Tim Mazid <timmazid@hotmail.com>
Cc: git@vger.kernel.org, Jakub Narebski <jnareb@gmail.com>,
	Bo Yang <struggleyb.nku@gmail.com>
Subject: Re: Detection of relocations within a file
Date: Mon, 30 Aug 2010 10:44:27 -0500	[thread overview]
Message-ID: <20100830154427.GB3292@burratino> (raw)
In-Reply-To: <SNT124-W57C91CBC3A362218ACA23DC4890@phx.gbl>

Hi Tim,

Tim Mazid wrote:

> I was just wondering if git can/does detect relocations of sections of code/text within a file.
> 
> For example, moving a function from the top of a file to the end.

Depends what you are trying to do.

1. I am mystified by some piece of code, and I want to know where
it originated.  Code movements is uninteresting to me (so grepping
through a patch won't do it).  The command

 $ git log -S'const char git_more_info_string[] =
	"See 'git help COMMAND' for more information on a specific command.";' \
      -- git.c

tells the originating commit pretty quickly.

2. I am mystified not by some particular piece of code but by an
entire file.  The command

 $ git gui blame -- git.c

works okay.

3. The origins of some piece of code make enough sense, but the code
changes since then are a mystery to investigate.  The command

 $ git log -L '/int main(/,/}/' git.c

with git from the "next" branch can help.

4. I want a simple, easy-to-review patch representing a code movement.
No one I know of has worked on this, and if you have ideas for it,
that would be very neat.

  reply	other threads:[~2010-08-30 15:46 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-30 15:04 Detection of relocations within a file Tim Mazid
2010-08-30 15:44 ` Jonathan Nieder [this message]
2010-08-30 16:24   ` Matthieu Moy
  -- strict thread matches above, loose matches on Subject: below --
2010-08-30 17:13 Tim Mazid
2010-08-31  1:43 ` Jakub Narebski

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=20100830154427.GB3292@burratino \
    --to=jrnieder@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=jnareb@gmail.com \
    --cc=struggleyb.nku@gmail.com \
    --cc=timmazid@hotmail.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 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).