Commit f4774446 by Edward Thomson

merge: support sha256

parent 47868ee4
...@@ -39,8 +39,8 @@ static int annotated_commit_init( ...@@ -39,8 +39,8 @@ static int annotated_commit_init(
if ((error = git_commit_dup(&annotated_commit->commit, commit)) < 0) if ((error = git_commit_dup(&annotated_commit->commit, commit)) < 0)
goto done; goto done;
git_oid_fmt(annotated_commit->id_str, git_commit_id(commit)); git_oid_tostr(annotated_commit->id_str, GIT_OID_MAX_HEXSIZE + 1,
annotated_commit->id_str[GIT_OID_SHA1_HEXSIZE] = '\0'; git_commit_id(commit));
if (!description) if (!description)
description = annotated_commit->id_str; description = annotated_commit->id_str;
......
...@@ -41,7 +41,7 @@ struct git_annotated_commit { ...@@ -41,7 +41,7 @@ struct git_annotated_commit {
const char *ref_name; const char *ref_name;
const char *remote_url; const char *remote_url;
char id_str[GIT_OID_SHA1_HEXSIZE+1]; char id_str[GIT_OID_MAX_HEXSIZE + 1];
}; };
extern int git_annotated_commit_from_head(git_annotated_commit **out, extern int git_annotated_commit_from_head(git_annotated_commit **out,
......
...@@ -611,13 +611,13 @@ int git_repository_mergehead_foreach( ...@@ -611,13 +611,13 @@ int git_repository_mergehead_foreach(
buffer = merge_head_file.ptr; buffer = merge_head_file.ptr;
while ((line = git__strsep(&buffer, "\n")) != NULL) { 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"); git_error_set(GIT_ERROR_INVALID, "unable to parse OID - invalid length");
error = -1; error = -1;
goto cleanup; 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; goto cleanup;
if ((error = cb(&oid, payload)) != 0) { if ((error = cb(&oid, payload)) != 0) {
...@@ -1061,7 +1061,7 @@ static int index_entry_similarity_calc( ...@@ -1061,7 +1061,7 @@ static int index_entry_similarity_calc(
const git_merge_options *opts) const git_merge_options *opts)
{ {
git_blob *blob; git_blob *blob;
git_diff_file diff_file = { GIT_OID_SHA1_ZERO }; git_diff_file diff_file;
git_object_size_t blobsize; git_object_size_t blobsize;
int error; int error;
...@@ -1070,6 +1070,8 @@ static int index_entry_similarity_calc( ...@@ -1070,6 +1070,8 @@ static int index_entry_similarity_calc(
*out = NULL; *out = NULL;
git_oid_clear(&diff_file.id, repo->oid_type);
if ((error = git_blob_lookup(&blob, repo, &entry->id)) < 0) if ((error = git_blob_lookup(&blob, repo, &entry->id)) < 0)
return error; return error;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment