Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/libgit2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRussell Belfer <rb@github.com>2013-11-01 21:18:03 +0400
committerRussell Belfer <rb@github.com>2013-11-01 21:20:51 +0400
commita5c16f3cfb92f1129ef13124fc70147480141d69 (patch)
tree1f5e321b95d45d4808e61514d2aac353e2a46fb5 /src/diff.c
parent8e5a8ef86f1d528472884f737612083abda86e17 (diff)
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.c13
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)
{