summaryrefslogtreecommitdiff
path: root/notes.c
diff options
context:
space:
mode:
authorPatryk Obara <patryk.obara@gmail.com>2018-01-28 00:13:19 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-01-30 18:42:36 (GMT)
commita09c985eae694db1cf31c72db0e2e1bf42f1274f (patch)
tree3acdfc26ab59d2ac822e4b4cf6ad93bf746fb65d /notes.c
parentbbca96d579b31900c9c0ad39299a3c9a3bd276f9 (diff)
downloadgit-a09c985eae694db1cf31c72db0e2e1bf42f1274f.zip
git-a09c985eae694db1cf31c72db0e2e1bf42f1274f.tar.gz
git-a09c985eae694db1cf31c72db0e2e1bf42f1274f.tar.bz2
sha1_file: convert write_sha1_file to object_id
Convert the definition and declaration of write_sha1_file to struct object_id and adjust usage of this function. This commit also converts static function write_sha1_file_prepare, as it is closely related. Rename these functions to write_object_file and write_object_file_prepare respectively. Replace sha1_to_hex, hashcpy and hashclr with their oid equivalents wherever possible. Signed-off-by: Patryk Obara <patryk.obara@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'notes.c')
-rw-r--r--notes.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/notes.c b/notes.c
index 09ef1ce..ce9a8f5 100644
--- a/notes.c
+++ b/notes.c
@@ -667,7 +667,7 @@ static int tree_write_stack_finish_subtree(struct tree_write_stack *tws)
ret = tree_write_stack_finish_subtree(n);
if (ret)
return ret;
- ret = write_sha1_file(n->buf.buf, n->buf.len, tree_type, s.hash);
+ ret = write_object_file(n->buf.buf, n->buf.len, tree_type, &s);
if (ret)
return ret;
strbuf_release(&n->buf);
@@ -825,7 +825,7 @@ int combine_notes_concatenate(struct object_id *cur_oid,
free(new_msg);
/* create a new blob object from buf */
- ret = write_sha1_file(buf, buf_len, blob_type, cur_oid->hash);
+ ret = write_object_file(buf, buf_len, blob_type, cur_oid);
free(buf);
return ret;
}
@@ -905,7 +905,7 @@ int combine_notes_cat_sort_uniq(struct object_id *cur_oid,
string_list_join_lines_helper, &buf))
goto out;
- ret = write_sha1_file(buf.buf, buf.len, blob_type, cur_oid->hash);
+ ret = write_object_file(buf.buf, buf.len, blob_type, cur_oid);
out:
strbuf_release(&buf);
@@ -1147,8 +1147,7 @@ int write_notes_tree(struct notes_tree *t, struct object_id *result)
ret = for_each_note(t, flags, write_each_note, &cb_data) ||
write_each_non_note_until(NULL, &cb_data) ||
tree_write_stack_finish_subtree(&root) ||
- write_sha1_file(root.buf.buf, root.buf.len, tree_type,
- result->hash);
+ write_object_file(root.buf.buf, root.buf.len, tree_type, result);
strbuf_release(&root.buf);
return ret;
}