git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "Sokolov, Konstantin (ext)" <konstantin.sokolov.ext@siemens.com>
To: "git@vger.kernel.org" <git@vger.kernel.org>
Subject: git blame -M seems not to work as expected
Date: Wed, 27 Feb 2013 16:45:22 +0100	[thread overview]
Message-ID: <6AD84402EDEFAA4D833C4235C5F5CC8D31DA5830@DEFTHW99EF4MSX.ww902.siemens.net> (raw)

Hi Folks!

I've posed this question already on stackoverflow and on Google Groups - without any (satisfying) answer. So maybe you can help me to understand the behavior of git blame -M.

First I commit the following file(file.cpp):

void func1(){return;}[CR][LF]
int func2(){return 23;}[CR][LF]    

Then I modify it by moving what was in the first line and adding something new instead:

float newFunc(){return 23.0;}[CR][LF]
int func2(){return 23;}[CR][LF]
[CR][LF]
[CR][LF]
void func1(){return;}[CR][LF]
 
The log now looks as follows:

>git log --oneline -2
18c670f modified file.cpp
92b4186 added file.cpp
 
Now I run blame:

git blame -s -w -M file.cpp
18c670fa 1) float newFunc(){return 23.0;}
92b4186d 2) int func2(){return 23;}
18c670fa 3)
18c670fa 4)
18c670fa 5) void func1(){return;}
 
I wonder why the line containing func1() isn't recognized as moved. I've tried to reduce the number of required characters (i.e. -M4 etc.). Furthermore spaces should not matter because of the -w option.

On the other hand, when I move float newFunc(){return 23.0;} from line 1 to line 6 (which was empty before) in the subsequent commit, git blame -M correctly recognizes that it originates from commit 18c670fa even though it firstly appeared in line 6 only in the current commit. 

So what's the reason for this seemingly inconsequent behavior? As far as I understand the documentation, both movements should be recognized. It's very important for us to correctly understand the behavior of git blame -M since we are about to add some code analysis logic on top of git blame. 

Thanks in advance
Konstantin

                 reply	other threads:[~2013-02-27 15:56 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6AD84402EDEFAA4D833C4235C5F5CC8D31DA5830@DEFTHW99EF4MSX.ww902.siemens.net \
    --to=konstantin.sokolov.ext@siemens.com \
    --cc=git@vger.kernel.org \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).