From: Bo Yang <struggleyb.nku@gmail.com>
To: git@vger.kernel.org
Cc: gitster@pobox.com, trast@student.ethz.ch
Subject: [PATCH 1/2 v2] Add a basic idea section for git-blame.
Date: Sat, 10 Apr 2010 18:15:29 +0800 [thread overview]
Message-ID: <1270894530-6486-2-git-send-email-struggleyb.nku@gmail.com> (raw)
In-Reply-To: <1270894530-6486-1-git-send-email-struggleyb.nku@gmail.com>
Explain the basic idea about blame shifting with
'-M' or '-C' given.
Thanks-to: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Bo Yang <struggleyb.nku@gmail.com>
---
Documentation/git-blame.txt | 35 ++++++++++++++++++++++++++++++++++-
1 files changed, 34 insertions(+), 1 deletions(-)
diff --git a/Documentation/git-blame.txt b/Documentation/git-blame.txt
index a27f439..3378665 100644
--- a/Documentation/git-blame.txt
+++ b/Documentation/git-blame.txt
@@ -9,7 +9,7 @@ SYNOPSIS
--------
[verse]
'git blame' [-c] [-b] [-l] [--root] [-t] [-f] [-n] [-s] [-p] [-w] [--incremental] [-L n,m]
- [-S <revs-file>] [-M] [-C] [-C] [-C] [--since=<date>]
+ [-S <revs-file>] [-M|<num>|] [-C|<num>|] [-C|<num>|] [-C|<num>|] [--since=<date>]
[<rev> | --contents <file> | --reverse <rev>] [--] <file>
DESCRIPTION
@@ -36,6 +36,39 @@ $ git log --pretty=oneline -S'blame_usage'
ea4c7f9bf69e781dd0cd88d2bccb2bf5cc15c9a7 git-blame: Make the output
-----------------------------------------------------------------------------
+
+BASIC IDEA
+----------
+
+This section briefly explains the basic idea behind 'git-blame'. You
+do not have to understand it to use git-blame, but it helps in
+understanding the `-M` and `-C` options. For the sake of simplicity,
+we assume that history is linear.
+
+A call to `git-blame <rev> -- <file>` works as follows:
+
+- Assume all the lines' blame to <rev> initially.
+
+- Run git diff <rev>^ <rev> and ignore all +/- lines. The unchanged
+ lines are definitely from our parent, so pass the blame of the
+ unchanged lines to parent.
+
+- For the +/- lines, take the blame if there are no `-M` or `-C`
+ options given.
+
+- Repeat step 2~3 for all the remain lines which does not find
+ a blame until all lines find its blame.
+
+If there are `-M` or `-C` given, the command will try to search for
+same code of current lines and pass blame to it.
+
+With `-M`, this command detects same lines of the current blaming code
+inside the current file. And it will shift the blame to the author of
+the original lines instead of author of current blaming code. It does
+the same for `-C` except that it will search across file boundary and
+multiple commits.
+
+
OPTIONS
-------
include::blame-options.txt[]
--
1.7.0.2.273.gc2413.dirty
next prev parent reply other threads:[~2010-04-10 10:16 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-10 10:15 [PATCH 0/2 v2] Document update for 'git-blame' '-M' and '-C' option Bo Yang
2010-04-10 10:15 ` Bo Yang [this message]
2010-04-10 19:53 ` [PATCH 1/2 v2] Add a basic idea section for git-blame Junio C Hamano
2010-04-11 2:23 ` Bo Yang
2010-04-11 18:13 ` Pete Harlan
2010-04-10 10:15 ` [PATCH 2/2 v2] Change the description of '-M' and '-C' option Bo Yang
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=1270894530-6486-2-git-send-email-struggleyb.nku@gmail.com \
--to=struggleyb.nku@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=trast@student.ethz.ch \
/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).