Skip to content

Commit 57e7a0a

Browse files
author
Junio C Hamano
committed
Document 'git-blame --incremental'
Signed-off-by: Junio C Hamano <junkio@cox.net>
1 parent 4f193f2 commit 57e7a0a

File tree

1 file changed

+46
-1
lines changed

1 file changed

+46
-1
lines changed

Documentation/git-blame.txt

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ git-blame - Show what revision and author last modified each line of a file
88
SYNOPSIS
99
--------
1010
[verse]
11-
'git-blame' [-c] [-l] [-t] [-f] [-n] [-p] [-L n,m] [-S <revs-file>]
11+
'git-blame' [-c] [-l] [-t] [-f] [-n] [-p] [--incremental] [-L n,m] [-S <revs-file>]
1212
[-M] [-C] [-C] [--since=<date>] [<rev>] [--] <file>
1313

1414
DESCRIPTION
@@ -63,6 +63,10 @@ OPTIONS
6363
-p, --porcelain::
6464
Show in a format designed for machine consumption.
6565

66+
--incremental::
67+
Show the result incrementally in a format designed for
68+
machine consumption.
69+
6670
-M::
6771
Detect moving lines in the file as well. When a commit
6872
moves a block of lines in a file (e.g. the original file
@@ -158,6 +162,47 @@ parents, using `commit{caret}!` notation:
158162
git blame -C -C -f $commit^! -- foo
159163

160164

165+
INCREMENTAL OUTPUT
166+
------------------
167+
168+
When called with `--incremental` option, the command outputs the
169+
result as it is built. The output generally will talk about
170+
lines touched by more recent commits first (i.e. the lines will
171+
be annotated out of order) and is meant to be used by
172+
interactive viewers.
173+
174+
The output format is similar to the Porcelain format, but it
175+
does not contain the actual lines from the file that is being
176+
annotated.
177+
178+
. Each blame entry always starts with a line of:
179+
180+
<40-byte hex sha1> <sourceline> <resultline> <num_lines>
181+
+
182+
Line numbers count from 1.
183+
184+
. The first time that commit shows up in the stream, it has various
185+
other information about it printed out with a one-word tag at the
186+
beginning of each line about that "extended commit info" (author,
187+
email, committer, dates, summary etc).
188+
189+
. Unlike Porcelain format, the filename information is always
190+
given and terminates the entry:
191+
192+
"filename" <whitespace-quoted-filename-goes-here>
193+
+
194+
and thus it's really quite easy to parse for some line- and word-oriented
195+
parser (which should be quite natural for most scripting languages).
196+
+
197+
[NOTE]
198+
For people who do parsing: to make it more robust, just ignore any
199+
lines in between the first and last one ("<sha1>" and "filename" lines)
200+
where you don't recognize the tag-words (or care about that particular
201+
one) at the beginning of the "extended information" lines. That way, if
202+
there is ever added information (like the commit encoding or extended
203+
commit commentary), a blame viewer won't ever care.
204+
205+
161206
SEE ALSO
162207
--------
163208
gitlink:git-annotate[1]

0 commit comments

Comments
 (0)