diff options
author | Russell Belfer <rb@github.com> | 2013-06-11 11:22:22 -0700 |
---|---|---|
committer | Russell Belfer <rb@github.com> | 2013-06-11 11:22:22 -0700 |
commit | 5dc98298a14a9adae3cf8b21fb01f682791c29c7 (patch) | |
tree | ed0e5ab97a3e7d6d03b9959265693665f950cef6 /src/diff_xdiff.c | |
parent | 3eadfecd325d355d3f8a9631d9c89b7e8eede98b (diff) | |
download | libgit2-5dc98298a14a9adae3cf8b21fb01f682791c29c7.tar.gz |
Implement regex pattern diff driver
This implements the loading of regular expression pattern lists
for diff drivers that search for function context in that way.
This also changes the way that diff drivers update options and
interface with xdiff APIs to make them a little more flexible.
Diffstat (limited to 'src/diff_xdiff.c')
-rw-r--r-- | src/diff_xdiff.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/diff_xdiff.c b/src/diff_xdiff.c index 1d1c2d54c..91c56f727 100644 --- a/src/diff_xdiff.c +++ b/src/diff_xdiff.c @@ -109,6 +109,7 @@ static int git_xdiff(git_diff_output *output, git_diff_patch *patch) { git_xdiff_output *xo = (git_xdiff_output *)output; git_xdiff_info info; + git_diff_find_context_payload findctxt; mmfile_t old_xdiff_data, new_xdiff_data; memset(&info, 0, sizeof(info)); @@ -117,15 +118,18 @@ static int git_xdiff(git_diff_output *output, git_diff_patch *patch) xo->callback.priv = &info; - xo->config.find_func_priv = patch->ofile.driver; - xo->config.find_func = patch->ofile.driver ? - git_diff_driver_find_content_fn(patch->ofile.driver) : NULL; + git_diff_find_context_init( + &xo->config.find_func, &findctxt, patch->ofile.driver); + xo->config.find_func_priv = &findctxt; if (xo->config.find_func != NULL) xo->config.flags |= XDL_EMIT_FUNCNAMES; else xo->config.flags &= ~XDL_EMIT_FUNCNAMES; + /* TODO: check ofile.opts_flags to see if driver-specific per-file + * updates are needed to xo->params.flags + */ old_xdiff_data.ptr = patch->ofile.map.data; old_xdiff_data.size = patch->ofile.map.len; @@ -135,6 +139,8 @@ static int git_xdiff(git_diff_output *output, git_diff_patch *patch) xdl_diff(&old_xdiff_data, &new_xdiff_data, &xo->params, &xo->config, &xo->callback); + git_diff_find_context_clear(&findctxt); + return xo->output.error; } |