diff options
author | Russell Belfer <rb@github.com> | 2013-11-01 10:18:03 -0700 |
---|---|---|
committer | Russell Belfer <rb@github.com> | 2013-11-01 10:20:51 -0700 |
commit | a5c16f3cfb92f1129ef13124fc70147480141d69 (patch) | |
tree | 1f5e321b95d45d4808e61514d2aac353e2a46fb5 /src/diff.c | |
parent | 8e5a8ef86f1d528472884f737612083abda86e17 (diff) | |
download | libgit2-a5c16f3cfb92f1129ef13124fc70147480141d69.tar.gz |
Add git_diff_options_init helper
Sometimes the static initializer for git_diff_options cannot be
used and since setting them to all zeroes doesn't actually work
quite right, this adds a new helper for that situation.
This also adds an explicit new value to the submodule settings
options to be used when those enums need static initialization.
Diffstat (limited to 'src/diff.c')
-rw-r--r-- | src/diff.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/diff.c b/src/diff.c index 5c89b6e59..d94fb2c74 100644 --- a/src/diff.c +++ b/src/diff.c @@ -1311,6 +1311,19 @@ int git_diff_tree_to_workdir_with_index( return error; } +int git_diff_options_init(git_diff_options *options, unsigned int version) +{ + git_diff_options template = GIT_DIFF_OPTIONS_INIT; + + if (version != template.version) { + giterr_set(GITERR_INVALID, + "Invalid version %d for git_diff_options", (int)version); + return -1; + } + + memcpy(options, &template, sizeof(*options)); + return 0; +} size_t git_diff_num_deltas(const git_diff *diff) { |