зеркало из https://github.com/microsoft/git.git
Merge branch 'jc/blame-no-follow'
Teaches "--no-follow" option to "git blame" to disable its whole-file rename detection. * jc/blame-no-follow: blame: pay attention to --no-follow diff: accept --no-follow option
This commit is contained in:
Коммит
90d0b8a9f0
|
@ -42,6 +42,7 @@ static int blank_boundary;
|
||||||
static int incremental;
|
static int incremental;
|
||||||
static int xdl_opts;
|
static int xdl_opts;
|
||||||
static int abbrev = -1;
|
static int abbrev = -1;
|
||||||
|
static int no_whole_file_rename;
|
||||||
|
|
||||||
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;
|
||||||
|
@ -1226,7 +1227,7 @@ static void pass_blame(struct scoreboard *sb, struct origin *origin, int opt)
|
||||||
* The first pass looks for unrenamed path to optimize for
|
* The first pass looks for unrenamed path to optimize for
|
||||||
* common cases, then we look for renames in the second pass.
|
* common cases, then we look for renames in the second pass.
|
||||||
*/
|
*/
|
||||||
for (pass = 0; pass < 2; pass++) {
|
for (pass = 0; pass < 2 - no_whole_file_rename; pass++) {
|
||||||
struct origin *(*find)(struct scoreboard *,
|
struct origin *(*find)(struct scoreboard *,
|
||||||
struct commit *, struct origin *);
|
struct commit *, struct origin *);
|
||||||
find = pass ? find_rename : find_origin;
|
find = pass ? find_rename : find_origin;
|
||||||
|
@ -2403,6 +2404,7 @@ int cmd_blame(int argc, const char **argv, const char *prefix)
|
||||||
init_revisions(&revs, NULL);
|
init_revisions(&revs, NULL);
|
||||||
revs.date_mode = blame_date_mode;
|
revs.date_mode = blame_date_mode;
|
||||||
DIFF_OPT_SET(&revs.diffopt, ALLOW_TEXTCONV);
|
DIFF_OPT_SET(&revs.diffopt, ALLOW_TEXTCONV);
|
||||||
|
DIFF_OPT_SET(&revs.diffopt, FOLLOW_RENAMES);
|
||||||
|
|
||||||
save_commit_buffer = 0;
|
save_commit_buffer = 0;
|
||||||
dashdash_pos = 0;
|
dashdash_pos = 0;
|
||||||
|
@ -2426,6 +2428,8 @@ int cmd_blame(int argc, const char **argv, const char *prefix)
|
||||||
parse_revision_opt(&revs, &ctx, options, blame_opt_usage);
|
parse_revision_opt(&revs, &ctx, options, blame_opt_usage);
|
||||||
}
|
}
|
||||||
parse_done:
|
parse_done:
|
||||||
|
no_whole_file_rename = !DIFF_OPT_TST(&revs.diffopt, FOLLOW_RENAMES);
|
||||||
|
DIFF_OPT_CLR(&revs.diffopt, FOLLOW_RENAMES);
|
||||||
argc = parse_options_end(&ctx);
|
argc = parse_options_end(&ctx);
|
||||||
|
|
||||||
if (0 < abbrev)
|
if (0 < abbrev)
|
||||||
|
|
2
diff.c
2
diff.c
|
@ -3626,6 +3626,8 @@ int diff_opt_parse(struct diff_options *options, const char **av, int ac)
|
||||||
DIFF_OPT_SET(options, FIND_COPIES_HARDER);
|
DIFF_OPT_SET(options, FIND_COPIES_HARDER);
|
||||||
else if (!strcmp(arg, "--follow"))
|
else if (!strcmp(arg, "--follow"))
|
||||||
DIFF_OPT_SET(options, FOLLOW_RENAMES);
|
DIFF_OPT_SET(options, FOLLOW_RENAMES);
|
||||||
|
else if (!strcmp(arg, "--no-follow"))
|
||||||
|
DIFF_OPT_CLR(options, FOLLOW_RENAMES);
|
||||||
else if (!strcmp(arg, "--color"))
|
else if (!strcmp(arg, "--color"))
|
||||||
options->use_color = 1;
|
options->use_color = 1;
|
||||||
else if (!prefixcmp(arg, "--color=")) {
|
else if (!prefixcmp(arg, "--color=")) {
|
||||||
|
|
Загрузка…
Ссылка в новой задаче