зеркало из https://github.com/microsoft/git.git
Merge branch 'nk/blame-abbrev'
* nk/blame-abbrev: blame: add --abbrev command line option and make it honor core.abbrev
This commit is contained in:
Коммит
18b33bf425
|
@ -9,7 +9,7 @@ SYNOPSIS
|
||||||
--------
|
--------
|
||||||
[verse]
|
[verse]
|
||||||
'git blame' [-c] [-b] [-l] [--root] [-t] [-f] [-n] [-s] [-e] [-p] [-w] [--incremental] [-L n,m]
|
'git blame' [-c] [-b] [-l] [--root] [-t] [-f] [-n] [-s] [-e] [-p] [-w] [--incremental] [-L n,m]
|
||||||
[-S <revs-file>] [-M] [-C] [-C] [-C] [--since=<date>]
|
[-S <revs-file>] [-M] [-C] [-C] [-C] [--since=<date>] [--abbrev=<n>]
|
||||||
[<rev> | --contents <file> | --reverse <rev>] [--] <file>
|
[<rev> | --contents <file> | --reverse <rev>] [--] <file>
|
||||||
|
|
||||||
DESCRIPTION
|
DESCRIPTION
|
||||||
|
@ -73,6 +73,11 @@ include::blame-options.txt[]
|
||||||
Ignore whitespace when comparing the parent's version and
|
Ignore whitespace when comparing the parent's version and
|
||||||
the child's to find where the lines came from.
|
the child's to find where the lines came from.
|
||||||
|
|
||||||
|
--abbrev=<n>::
|
||||||
|
Instead of using the default 7+1 hexadecimal digits as the
|
||||||
|
abbreviated object name, use <n>+1 digits. Note that 1 column
|
||||||
|
is used for a caret to mark the boundary commit.
|
||||||
|
|
||||||
|
|
||||||
THE PORCELAIN FORMAT
|
THE PORCELAIN FORMAT
|
||||||
--------------------
|
--------------------
|
||||||
|
|
|
@ -41,6 +41,7 @@ static int reverse;
|
||||||
static int blank_boundary;
|
static int blank_boundary;
|
||||||
static int incremental;
|
static int incremental;
|
||||||
static int xdl_opts;
|
static int xdl_opts;
|
||||||
|
static int abbrev = -1;
|
||||||
|
|
||||||
static enum date_mode blame_date_mode = DATE_ISO8601;
|
static enum date_mode blame_date_mode = DATE_ISO8601;
|
||||||
static size_t blame_date_width;
|
static size_t blame_date_width;
|
||||||
|
@ -1670,7 +1671,7 @@ static void emit_other(struct scoreboard *sb, struct blame_entry *ent, int opt)
|
||||||
cp = nth_line(sb, ent->lno);
|
cp = nth_line(sb, ent->lno);
|
||||||
for (cnt = 0; cnt < ent->num_lines; cnt++) {
|
for (cnt = 0; cnt < ent->num_lines; cnt++) {
|
||||||
char ch;
|
char ch;
|
||||||
int length = (opt & OUTPUT_LONG_OBJECT_NAME) ? 40 : 8;
|
int length = (opt & OUTPUT_LONG_OBJECT_NAME) ? 40 : abbrev;
|
||||||
|
|
||||||
if (suspect->commit->object.flags & UNINTERESTING) {
|
if (suspect->commit->object.flags & UNINTERESTING) {
|
||||||
if (blank_boundary)
|
if (blank_boundary)
|
||||||
|
@ -2310,6 +2311,7 @@ int cmd_blame(int argc, const char **argv, const char *prefix)
|
||||||
{ OPTION_CALLBACK, 'C', NULL, &opt, "score", "Find line copies within and across files", PARSE_OPT_OPTARG, blame_copy_callback },
|
{ OPTION_CALLBACK, 'C', NULL, &opt, "score", "Find line copies within and across files", PARSE_OPT_OPTARG, blame_copy_callback },
|
||||||
{ OPTION_CALLBACK, 'M', NULL, &opt, "score", "Find line movements within and across files", PARSE_OPT_OPTARG, blame_move_callback },
|
{ OPTION_CALLBACK, 'M', NULL, &opt, "score", "Find line movements within and across files", PARSE_OPT_OPTARG, blame_move_callback },
|
||||||
OPT_CALLBACK('L', NULL, &bottomtop, "n,m", "Process only line range n,m, counting from 1", blame_bottomtop_callback),
|
OPT_CALLBACK('L', NULL, &bottomtop, "n,m", "Process only line range n,m, counting from 1", blame_bottomtop_callback),
|
||||||
|
OPT__ABBREV(&abbrev),
|
||||||
OPT_END()
|
OPT_END()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -2345,6 +2347,11 @@ int cmd_blame(int argc, const char **argv, const char *prefix)
|
||||||
parse_done:
|
parse_done:
|
||||||
argc = parse_options_end(&ctx);
|
argc = parse_options_end(&ctx);
|
||||||
|
|
||||||
|
if (abbrev == -1)
|
||||||
|
abbrev = default_abbrev;
|
||||||
|
/* one more abbrev length is needed for the boundary commit */
|
||||||
|
abbrev++;
|
||||||
|
|
||||||
if (revs_file && read_ancestry(revs_file))
|
if (revs_file && read_ancestry(revs_file))
|
||||||
die_errno("reading graft file '%s' failed", revs_file);
|
die_errno("reading graft file '%s' failed", revs_file);
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче