vendor/libgit2/src/libgit2/merge.c in rugged-1.6.5 vs vendor/libgit2/src/libgit2/merge.c in rugged-1.7.1
- old
+ new
@@ -609,17 +609,17 @@
goto cleanup;
buffer = merge_head_file.ptr;
while ((line = git__strsep(&buffer, "\n")) != NULL) {
- if (strlen(line) != GIT_OID_SHA1_HEXSIZE) {
+ if (strlen(line) != git_oid_hexsize(repo->oid_type)) {
git_error_set(GIT_ERROR_INVALID, "unable to parse OID - invalid length");
error = -1;
goto cleanup;
}
- if ((error = git_oid__fromstr(&oid, line, GIT_OID_SHA1)) < 0)
+ if ((error = git_oid__fromstr(&oid, line, repo->oid_type)) < 0)
goto cleanup;
if ((error = cb(&oid, payload)) != 0) {
git_error_set_after_callback(error);
goto cleanup;
@@ -1059,19 +1059,21 @@
git_repository *repo,
git_index_entry *entry,
const git_merge_options *opts)
{
git_blob *blob;
- git_diff_file diff_file = { GIT_OID_SHA1_ZERO };
+ git_diff_file diff_file;
git_object_size_t blobsize;
int error;
if (*out || *out == &cache_invalid_marker)
return 0;
*out = NULL;
+ git_oid_clear(&diff_file.id, repo->oid_type);
+
if ((error = git_blob_lookup(&blob, repo, &entry->id)) < 0)
return error;
git_oid_cpy(&diff_file.id, &entry->id);
diff_file.path = entry->path;
@@ -1995,21 +1997,24 @@
}
return 0;
}
-static int index_from_diff_list(git_index **out,
- git_merge_diff_list *diff_list, bool skip_reuc)
+static int index_from_diff_list(
+ git_index **out,
+ git_merge_diff_list *diff_list,
+ git_oid_t oid_type,
+ bool skip_reuc)
{
git_index *index;
size_t i;
git_merge_diff *conflict;
int error = 0;
*out = NULL;
- if ((error = git_index_new(&index)) < 0)
+ if ((error = git_index__new(&index, oid_type)) < 0)
return error;
if ((error = git_index__fill(index, &diff_list->staged)) < 0)
goto on_error;
@@ -2155,11 +2160,11 @@
git_vector_insert(&diff_list->conflicts, conflict);
}
}
- error = index_from_diff_list(out, diff_list,
+ error = index_from_diff_list(out, diff_list, repo->oid_type,
(opts.flags & GIT_MERGE_SKIP_REUC));
done:
if (!given_opts || !given_opts->metric)
git__free(opts.metric);
@@ -2198,11 +2203,11 @@
result = their_tree;
else if (their_tree && !git_oid_cmp(ancestor_tree_id, git_tree_id(their_tree)))
result = our_tree;
if (result) {
- if ((error = git_index_new(out)) == 0)
- error = git_index_read_tree(*out, result);
+ if ((error = git_index__new(out, repo->oid_type)) == 0)
+ error = git_index_read_tree(*out, result);
return error;
}
}