git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2/2] Change the description of '-M' and '-C' option.
  2010-04-08  6:51 ` [PATCH 1/2] Add a basic idea section for git-blame Bo Yang
@ 2010-04-08  6:51   ` Bo Yang
  0 siblings, 0 replies; 3+ messages in thread
From: Bo Yang @ 2010-04-08  6:51 UTC (permalink / raw)
  To: git; +Cc: trast, gitster

Both '-M' and '-C' option detect code moving and copying.
The difference between the two options is whether they
search across file boundary.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Bo Yang <struggleyb.nku@gmail.com>
---
 Documentation/blame-options.txt |   41 +++++++++++++++++++++++---------------
 1 files changed, 25 insertions(+), 16 deletions(-)

diff --git a/Documentation/blame-options.txt b/Documentation/blame-options.txt
index 4833cac..aca2a1c 100644
--- a/Documentation/blame-options.txt
+++ b/Documentation/blame-options.txt
@@ -79,14 +79,15 @@ of lines before or after the line given by <start>.
 	of the --date option at linkgit:git-log[1].
 
 -M|<num>|::
-	Detect moving lines in the file as well.  When a commit
-	moves a block of lines in a file (e.g. the original file
-	has A and then B, and the commit changes it to B and
-	then A), the traditional 'blame' algorithm typically blames
-	the lines that were moved up (i.e. B) to the parent and
-	assigns blame to the lines that were moved down (i.e. A)
-	to the child commit.  With this option, both groups of lines
-	are blamed on the parent.
+	Detect moving/copying lines in the file as well.  Instead of
+	taking blame for all added lines, attempt to find the same
+	lines 'in the same file' in the parent commit.  If such a
+	match was found, shift the blame to these lines in the
+	parent. (This expends extra effort on the order of the size
+	of the file for every change.)
++
+The net effect is that if code is moved or copied within the file, the
+lines are attributed to the original instead of the move/copy.
 +
 <num> is optional but it is the lower bound on the number of
 alphanumeric characters that git must detect as moving
@@ -94,14 +95,22 @@ within a file for it to associate those lines with the parent
 commit.
 
 -C|<num>|::
-	In addition to `-M`, detect lines copied from other
-	files that were modified in the same commit.  This is
-	useful when you reorganize your program and move code
-	around across files.  When this option is given twice,
-	the command additionally looks for copies from other
-	files in the commit that creates the file. When this
-	option is given three times, the command additionally
-	looks for copies from other files in any commit.
+	Like `-M`, detect moving/copying lines between files as well.
+	Instead of taking blame for all added lines, attempt to find the same
+	lines across file boundary according to the number of given `-C`.
+	This is useful when you reorganize your program and move/copy
+	code around across files. When this option is given once, detect
+	lines moved/copied from other files that were modified in the
+	same commit. (This expends extra effort on the order of
+	<number of modified files>*<file size> for every change.) When this
+	option is given twice, the command additionally looks for moves/copies
+	from other files in the commit that creates this file. (This expends
+	extra effort on the order of <number of files in the commit>*<file size>
+	for every change.) When this option is given three times, the
+	command additionally looks for moves/copies from other files
+	in any commit. (This expends extra effort on the order of
+	<commit number>*<number of files in one commit>*<file size>
+	for every change.)
 +
 <num> is optional but it is the lower bound on the number of
 alphanumeric characters that git must detect as moving
-- 
1.6.0.4

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

* Re: [PATCH 2/2] Change the description of '-M' and '-C' option.
@ 2010-04-08  8:07 Yann Dirson
  2010-04-09  5:15 ` Bo Yang
  0 siblings, 1 reply; 3+ messages in thread
From: Yann Dirson @ 2010-04-08  8:07 UTC (permalink / raw)
  To: git; +Cc: ydirson

Very interesting addition, indeed - thanks much.

Some information may still be missing, though:

- the default value of the numeric argument to -M/-C
- the meaning of numeric arguments to the various flags when several
  are given (eg. what does "blame -M10 -C5 -C15" mean ?)
- the numeric arguments are not visible in the summary

On another aspect, given the nature of repetitive -C we may want to warn
the user of bomb out if more than 3 occurences of the flag happen ?

-- 
Yann

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

* Re: [PATCH 2/2] Change the description of '-M' and '-C' option.
  2010-04-08  8:07 [PATCH 2/2] Change the description of '-M' and '-C' option Yann Dirson
@ 2010-04-09  5:15 ` Bo Yang
  0 siblings, 0 replies; 3+ messages in thread
From: Bo Yang @ 2010-04-09  5:15 UTC (permalink / raw)
  To: Yann Dirson; +Cc: git, ydirson

Hi Yann,
On Thu, Apr 8, 2010 at 1:07 AM, Yann Dirson <dirson@bertin.fr> wrote:
> Very interesting addition, indeed - thanks much.
>
> Some information may still be missing, though:
>
> - the default value of the numeric argument to -M/-C
> - the meaning of numeric arguments to the various flags when several
>  are given (eg. what does "blame -M10 -C5 -C15" mean ?)
> - the numeric arguments are not visible in the summary

Ah, thanks a lot for these advice, I will add them on next version of
this patch.

> On another aspect, given the nature of repetitive -C we may want to warn
> the user of bomb out if more than 3 occurences of the flag happen ?

En, sound rationale, I think. I will try another patch to add this. Thanks!

Regards!
Bo

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

end of thread, other threads:[~2010-04-09  5:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-08  8:07 [PATCH 2/2] Change the description of '-M' and '-C' option Yann Dirson
2010-04-09  5:15 ` Bo Yang
  -- strict thread matches above, loose matches on Subject: below --
2010-04-08  6:51 [PATCH 0/2] Document update for 'git-blame' " Bo Yang
2010-04-08  6:51 ` [PATCH 1/2] Add a basic idea section for git-blame Bo Yang
2010-04-08  6:51   ` [PATCH 2/2] Change the description of '-M' and '-C' option Bo Yang

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