Convert commit_tree() to take strbuf as message
There wan't a way for commit_tree() to notice if the message the caller prepared contained a NUL byte, as it did not take the length of the message as a parameter. Use a pointer to a strbuf instead, so that we can either choose to allow low-level plumbing commands to make commits that contain NUL byte in its message, or forbid NUL everywhere by adding the check in commit_tree(), in later patches. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
6b3c4c0547
commit
13f8b72d8c
@ -1483,7 +1483,7 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (commit_tree(sb.buf, active_cache_tree->sha1, parents, sha1,
|
||||
if (commit_tree(&sb, active_cache_tree->sha1, parents, sha1,
|
||||
author_ident.buf)) {
|
||||
rollback_index_files();
|
||||
die(_("failed to write commit object"));
|
||||
|
||||
Reference in New Issue
Block a user