Merge branch 'po/object-id'
Conversion from uchar[20] to struct object_id continues. * po/object-id: sha1_file: rename hash_sha1_file_literally sha1_file: convert write_loose_object to object_id sha1_file: convert force_object_loose to object_id sha1_file: convert write_sha1_file to object_id notes: convert write_notes_tree to object_id notes: convert combine_notes_* to object_id commit: convert commit_tree* to object_id match-trees: convert splice_tree to object_id cache: clear whole hash buffer with oidclr sha1_file: convert hash_sha1_file to object_id dir: convert struct sha1_stat to use object_id sha1_file: convert pretend_sha1_file to object_id
This commit is contained in:
15
commit.c
15
commit.c
@ -1378,9 +1378,8 @@ void free_commit_extra_headers(struct commit_extra_header *extra)
|
||||
}
|
||||
}
|
||||
|
||||
int commit_tree(const char *msg, size_t msg_len,
|
||||
const unsigned char *tree,
|
||||
struct commit_list *parents, unsigned char *ret,
|
||||
int commit_tree(const char *msg, size_t msg_len, const struct object_id *tree,
|
||||
struct commit_list *parents, struct object_id *ret,
|
||||
const char *author, const char *sign_commit)
|
||||
{
|
||||
struct commit_extra_header *extra = NULL, **tail = &extra;
|
||||
@ -1509,8 +1508,8 @@ N_("Warning: commit message did not conform to UTF-8.\n"
|
||||
"variable i18n.commitencoding to the encoding your project uses.\n");
|
||||
|
||||
int commit_tree_extended(const char *msg, size_t msg_len,
|
||||
const unsigned char *tree,
|
||||
struct commit_list *parents, unsigned char *ret,
|
||||
const struct object_id *tree,
|
||||
struct commit_list *parents, struct object_id *ret,
|
||||
const char *author, const char *sign_commit,
|
||||
struct commit_extra_header *extra)
|
||||
{
|
||||
@ -1518,7 +1517,7 @@ int commit_tree_extended(const char *msg, size_t msg_len,
|
||||
int encoding_is_utf8;
|
||||
struct strbuf buffer;
|
||||
|
||||
assert_sha1_type(tree, OBJ_TREE);
|
||||
assert_sha1_type(tree->hash, OBJ_TREE);
|
||||
|
||||
if (memchr(msg, '\0', msg_len))
|
||||
return error("a NUL byte in commit log message not allowed.");
|
||||
@ -1527,7 +1526,7 @@ int commit_tree_extended(const char *msg, size_t msg_len,
|
||||
encoding_is_utf8 = is_encoding_utf8(git_commit_encoding);
|
||||
|
||||
strbuf_init(&buffer, 8192); /* should avoid reallocs for the headers */
|
||||
strbuf_addf(&buffer, "tree %s\n", sha1_to_hex(tree));
|
||||
strbuf_addf(&buffer, "tree %s\n", oid_to_hex(tree));
|
||||
|
||||
/*
|
||||
* NOTE! This ordering means that the same exact tree merged with a
|
||||
@ -1566,7 +1565,7 @@ int commit_tree_extended(const char *msg, size_t msg_len,
|
||||
goto out;
|
||||
}
|
||||
|
||||
result = write_sha1_file(buffer.buf, buffer.len, commit_type, ret);
|
||||
result = write_object_file(buffer.buf, buffer.len, commit_type, ret);
|
||||
out:
|
||||
strbuf_release(&buffer);
|
||||
return result;
|
||||
|
||||
Reference in New Issue
Block a user