git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 2/2 v2] Change the description of '-M' and '-C' option.

From
Bo Yang <struggleyb.nku@gmail.com>
Date
Apr 10, 2010, 10:15 UTC
Message-ID
<1270894530-6486-3-git-send-email-struggleyb.nku@gmail.com>
In-Reply-To
<1270894530-6486-1-git-send-email-struggleyb.nku@gmail.com>

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

Thanks-to: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Bo Yang <struggleyb.nku@gmail.com>
---
 Documentation/blame-options.txt |   46 +++++++++++++++++++++++---------------
 1 files changed, 28 insertions(+), 18 deletions(-)
diff --git a/Documentation/blame-options.txt b/Documentation/blame-options.txt
index 4833cac..d113f2e 100644
--- a/Documentation/blame-options.txt
+++ b/Documentation/blame-options.txt
@@ -79,34 +79,44 @@ 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 '+' 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
 within a file for it to associate those lines with the parent
-commit.
+commit. And the default value is 20.
 
 -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 '+' 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
 between files for it to associate those lines with the parent
-commit.
+commit. And the default value is 40. If there are different values
+provided by different `-C` option, the last value will take effect finally.
 
 -h::
 --help::
-- 
1.7.0.2.273.gc2413.dirty
Previous: Pete Harlan
Message 6 of 6 in “Document update for 'git-blame' '-M' and '-C' option”
  1. 0/2 Document update for 'git-blame' '-M' and '-C' optionBo Yang, Apr 10, 2010
  2. 1/2 Add a basic idea section for git-blame.Bo Yang, Apr 10, 2010
  3. Junio C HamanoApr 10, 2010
  4. Bo YangApr 11, 2010
  5. Pete HarlanApr 11, 2010
  6. 2/2 Change the description of '-M' and '-C' option.Bo Yang, Apr 10, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.