diff options
Diffstat (limited to 'src/diff_tform.c')
-rw-r--r-- | src/diff_tform.c | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/src/diff_tform.c b/src/diff_tform.c index 0a28e58c7..6f29f25da 100644 --- a/src/diff_tform.c +++ b/src/diff_tform.c @@ -279,23 +279,29 @@ static int normalize_find_opts( git_repository_config__weakptr(&cfg, diff->repo) < 0) return -1; - if (given != NULL) + if (given) { memcpy(opts, given, sizeof(*opts)); - else { - const char *val = NULL; - + } else { GIT_INIT_STRUCTURE(opts, GIT_DIFF_FIND_OPTIONS_VERSION); + } - opts->flags = GIT_DIFF_FIND_RENAMES; + if (!given || + (given->flags & GIT_DIFF_FIND_ALL) == GIT_DIFF_FIND_BY_CONFIG) + { + const char *val = NULL; if (git_config_get_string(&val, cfg, "diff.renames") < 0) giterr_clear(); - else if (val && - (!strcasecmp(val, "copies") || !strcasecmp(val, "copy"))) - opts->flags = GIT_DIFF_FIND_RENAMES | GIT_DIFF_FIND_COPIES; + else if (val) { + if (!strcasecmp(val, "false")) + return GIT_PASSTHROUGH; + else if (!strcasecmp(val, "copies") || !strcasecmp(val, "copy")) + opts->flags = GIT_DIFF_FIND_RENAMES | GIT_DIFF_FIND_COPIES; + else + opts->flags = GIT_DIFF_FIND_RENAMES; + } } - - GITERR_CHECK_VERSION(opts, GIT_DIFF_FIND_OPTIONS_VERSION, "git_diff_find_options"); + GITERR_CHECK_VERSION(given, GIT_DIFF_FIND_OPTIONS_VERSION, "git_diff_find_options"); /* some flags imply others */ @@ -828,7 +834,7 @@ int git_diff_find_similar( git_diff_file swap; if ((error = normalize_find_opts(diff, &opts, given_opts)) < 0) - return error; + return (error == GIT_PASSTHROUGH) ? 0 : error; num_deltas = diff->deltas.length; |