diff options
| author | Ben Straub <bs@github.com> | 2013-12-05 14:13:46 -0800 |
|---|---|---|
| committer | Ben Straub <bs@github.com> | 2013-12-05 14:13:46 -0800 |
| commit | c56c6d694563fdd28cd00ed246f35349522b836e (patch) | |
| tree | 14f200f4b218ecd1a3bfe50f75e1d3f0cf4c7197 /src/diff_tform.c | |
| parent | a6ebc2bdb314543a1fdf25f523f8793f4f52b8b3 (diff) | |
| download | libgit2-c56c6d694563fdd28cd00ed246f35349522b836e.tar.gz | |
Implement GIT_DIFF_FIND_BY_CONFIG
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; |
