blame: Document and add help text for -f, -n, and -p
New options --show-name, --show-number and --porcelain were not documented. Also add -p as a short-hand for --porcelain for consistency. Signed-off-by: Junio C Hamano <junkio@cox.net>
Junio C Hamano committed
Oct 12, 2006 at 00:44 UTC
b24642b2f27b2cf01f6e726d816a2a1f5955ae3e
2 files changed
+45
-4
Documentation/git-blame.txt
+38
-1
@@ -7,7 +7,7 @@ git-blame - Show what revision and author last modified each line of a file
7
8
SYNOPSIS
9
--------
10
-'git-blame' [-c] [-l] [-t] [-S <revs-file>] [--] <file> [<rev>]
10
+'git-blame' [-c] [-l] [-t] [-f] [-n] [-p] [-S <revs-file>] [--] <file> [<rev>]
11
12
DESCRIPTION
13
-----------
@@ -45,10 +45,47 @@ OPTIONS
45
-S, --rev-file <revs-file>::
46
Use revs from revs-file instead of calling gitlink:git-rev-list[1].
47
48
+-f, --show-name::
49
+ Show filename in the original commit. By default
50
+ filename is shown if there is any line that came from a
51
+ file with different name, due to rename detection.
52
+
53
+-n, --show-number::
54
+ Show line number in the original commit (Default: off).
55
+
56
+-p, --porcelain::
57
+ Show in a format designed for machine consumption.
58
+
59
-h, --help::
60
Show help message.
61
62
63
+THE PORCELAIN FORMAT
64
+--------------------
65
+
66
+In this format, each line is output after a header; the
67
+header at the minumum has the first line which has:
68
+
69
+- 40-byte SHA-1 of the commit the line is attributed to;
70
+- the line number of the line in the original file;
71
+- the line number of the line in the final file;
72
+- on a line that starts a group of line from a different
73
+ commit than the previous one, the number of lines in this
74
+ group. On subsequent lines this field is absent.
75
+
76
+This header line is followed by the following information
77
+at least once for each commit:
78
+
79
+- author name ("author"), email ("author-mail"), time
80
+ ("author-time"), and timezone ("author-tz"); similarly
81
+ for committer.
82
+- filename in the commit the line is attributed to.
83
+- the first line of the commit log message ("summary").
84
+
85
+The contents of the actual line is output after the above
86
+header, prefixed by a TAB. This is to allow adding more
87
+header elements later.
88
+
89
SEE ALSO
90
--------
91
gitlink:git-annotate[1]
blame.c
+7
-3
@@ -22,11 +22,14 @@
22
#define DEBUG 0
23
24
static const char blame_usage[] =
25
-"git-blame [-c] [-l] [-t] [-S <revs-file>] [--] file [commit]\n"
25
+"git-blame [-c] [-l] [-t] [-f] [-n] [-p] [-S <revs-file>] [--] file [commit]\n"
26
" -c, --compatibility Use the same output mode as git-annotate (Default: off)\n"
27
" -l, --long Show long commit SHA1 (Default: off)\n"
28
" -t, --time Show raw timestamp (Default: off)\n"
29
-" -S, --revs-file Use revisions from revs-file instead of calling git-rev-list\n"
29
+" -f, --show-name Show original filename (Default: auto)\n"
30
+" -n, --show-number Show original linenumber (Default: off)\n"
31
+" -p, --porcelain Show in a format designed for machine consumption\n"
32
+" -S revs-file Use revisions from revs-file instead of calling git-rev-list\n"
33
" -h, --help This message";
34
35
static struct commit **blame_lines;
@@ -951,7 +954,8 @@ int main(int argc, const char **argv)
954
show_number = 1;
955
continue;
956
}
954
- if (!strcmp(argv[i], "--porcelain")) {
957
+ if (!strcmp(argv[i], "-p") ||
958
+ !strcmp(argv[i], "--porcelain")) {
959
porcelain = 1;
960
sha1_len = 40;
961
show_raw_time = 1;