mirror of
https://github.com/git/git
synced 2024-08-27 11:39:22 +00:00
blame -s: suppress author name and time.
With this "git blame -b -s HEAD~n..HEAD" becomes a nicer way to review the result of recent changes in context. Signed-off-by: Junio C Hamano <junkio@cox.net>
This commit is contained in:
parent
28a94f885a
commit
093dc5bee6
|
@ -8,7 +8,7 @@ git-blame - Show what revision and author last modified each line of a file
|
||||||
SYNOPSIS
|
SYNOPSIS
|
||||||
--------
|
--------
|
||||||
[verse]
|
[verse]
|
||||||
'git-blame' [-c] [-l] [-t] [-f] [-n] [-p] [--incremental] [-L n,m]
|
'git-blame' [-c] [-b] [--root] [-s] [-l] [-t] [-f] [-n] [-p] [--incremental] [-L n,m]
|
||||||
[-S <revs-file>] [-M] [-C] [-C] [--since=<date>]
|
[-S <revs-file>] [-M] [-C] [-C] [--since=<date>]
|
||||||
[<rev> | --contents <file>] [--] <file>
|
[<rev> | --contents <file>] [--] <file>
|
||||||
|
|
||||||
|
@ -60,6 +60,9 @@ include::blame-options.txt[]
|
||||||
-n, --show-number::
|
-n, --show-number::
|
||||||
Show line number in the original commit (Default: off).
|
Show line number in the original commit (Default: off).
|
||||||
|
|
||||||
|
-s::
|
||||||
|
Suppress author name and timestamp from the output.
|
||||||
|
|
||||||
THE PORCELAIN FORMAT
|
THE PORCELAIN FORMAT
|
||||||
--------------------
|
--------------------
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
#include "cache-tree.h"
|
#include "cache-tree.h"
|
||||||
|
|
||||||
static char blame_usage[] =
|
static char blame_usage[] =
|
||||||
"git-blame [-c] [-l] [-t] [-f] [-n] [-p] [-L n,m] [-S <revs-file>] [-M] [-C] [-C] [--contents <filename>] [--incremental] [commit] [--] file\n"
|
"git-blame [-c] [-b] [-l] [--root] [-t] [-f] [-n] [-s] [-p] [-L n,m] [-S <revs-file>] [-M] [-C] [-C] [--contents <filename>] [--incremental] [commit] [--] file\n"
|
||||||
" -c Use the same output mode as git-annotate (Default: off)\n"
|
" -c Use the same output mode as git-annotate (Default: off)\n"
|
||||||
" -b Show blank SHA-1 for boundary commits (Default: off)\n"
|
" -b Show blank SHA-1 for boundary commits (Default: off)\n"
|
||||||
" -l Show long commit SHA1 (Default: off)\n"
|
" -l Show long commit SHA1 (Default: off)\n"
|
||||||
|
@ -26,6 +26,7 @@ static char blame_usage[] =
|
||||||
" -t Show raw timestamp (Default: off)\n"
|
" -t Show raw timestamp (Default: off)\n"
|
||||||
" -f, --show-name Show original filename (Default: auto)\n"
|
" -f, --show-name Show original filename (Default: auto)\n"
|
||||||
" -n, --show-number Show original linenumber (Default: off)\n"
|
" -n, --show-number Show original linenumber (Default: off)\n"
|
||||||
|
" -s Suppress author name and timestamp (Default: off)\n"
|
||||||
" -p, --porcelain Show in a format designed for machine consumption\n"
|
" -p, --porcelain Show in a format designed for machine consumption\n"
|
||||||
" -L n,m Process only line range n,m, counting from 1\n"
|
" -L n,m Process only line range n,m, counting from 1\n"
|
||||||
" -M, -C Find line movements within and across files\n"
|
" -M, -C Find line movements within and across files\n"
|
||||||
|
@ -1483,6 +1484,7 @@ static const char *format_time(unsigned long time, const char *tz_str,
|
||||||
#define OUTPUT_SHOW_NAME 020
|
#define OUTPUT_SHOW_NAME 020
|
||||||
#define OUTPUT_SHOW_NUMBER 040
|
#define OUTPUT_SHOW_NUMBER 040
|
||||||
#define OUTPUT_SHOW_SCORE 0100
|
#define OUTPUT_SHOW_SCORE 0100
|
||||||
|
#define OUTPUT_NO_AUTHOR 0200
|
||||||
|
|
||||||
static void emit_porcelain(struct scoreboard *sb, struct blame_entry *ent)
|
static void emit_porcelain(struct scoreboard *sb, struct blame_entry *ent)
|
||||||
{
|
{
|
||||||
|
@ -1577,10 +1579,15 @@ static void emit_other(struct scoreboard *sb, struct blame_entry *ent, int opt)
|
||||||
if (opt & OUTPUT_SHOW_NUMBER)
|
if (opt & OUTPUT_SHOW_NUMBER)
|
||||||
printf(" %*d", max_orig_digits,
|
printf(" %*d", max_orig_digits,
|
||||||
ent->s_lno + 1 + cnt);
|
ent->s_lno + 1 + cnt);
|
||||||
printf(" (%-*.*s %10s %*d) ",
|
|
||||||
longest_author, longest_author, ci.author,
|
if (!(opt & OUTPUT_NO_AUTHOR))
|
||||||
format_time(ci.author_time, ci.author_tz,
|
printf(" (%-*.*s %10s",
|
||||||
show_raw_time),
|
longest_author, longest_author,
|
||||||
|
ci.author,
|
||||||
|
format_time(ci.author_time,
|
||||||
|
ci.author_tz,
|
||||||
|
show_raw_time));
|
||||||
|
printf(" %*d) ",
|
||||||
max_digits, ent->lno + 1 + cnt);
|
max_digits, ent->lno + 1 + cnt);
|
||||||
}
|
}
|
||||||
do {
|
do {
|
||||||
|
@ -2092,6 +2099,8 @@ int cmd_blame(int argc, const char **argv, const char *prefix)
|
||||||
output_option |= OUTPUT_RAW_TIMESTAMP;
|
output_option |= OUTPUT_RAW_TIMESTAMP;
|
||||||
else if (!strcmp("-l", arg))
|
else if (!strcmp("-l", arg))
|
||||||
output_option |= OUTPUT_LONG_OBJECT_NAME;
|
output_option |= OUTPUT_LONG_OBJECT_NAME;
|
||||||
|
else if (!strcmp("-s", arg))
|
||||||
|
output_option |= OUTPUT_NO_AUTHOR;
|
||||||
else if (!strcmp("-S", arg) && ++i < argc)
|
else if (!strcmp("-S", arg) && ++i < argc)
|
||||||
revs_file = argv[i];
|
revs_file = argv[i];
|
||||||
else if (!prefixcmp(arg, "-M")) {
|
else if (!prefixcmp(arg, "-M")) {
|
||||||
|
|
Loading…
Reference in a new issue