mirror of
https://github.com/git/git.git
synced 2025-12-12 20:36:24 +01:00
object-file API: have write_object_file() take "enum object_type"
Change the write_object_file() function to take an "enum object_type"
instead of a "const char *type". Its callers either passed
{commit,tree,blob,tag}_type and can pass the corresponding OBJ_* type
instead, or were hardcoding strings like "blob".
This avoids the back & forth fragility where the callers of
write_object_file() would have the enum type, and convert it
themselves via type_name(). We do have to now do that conversion
ourselves before calling write_object_file_prepare(), but those
codepaths will be similarly adjusted in subsequent commits.
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
b04cdea46c
commit
c80d226a04
@@ -474,7 +474,7 @@ static int create_graft(int argc, const char **argv, int force, int gentle)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (write_object_file(buf.buf, buf.len, commit_type, &new_oid)) {
|
||||
if (write_object_file(buf.buf, buf.len, OBJ_COMMIT, &new_oid)) {
|
||||
strbuf_release(&buf);
|
||||
return error(_("could not write replacement commit for: '%s'"),
|
||||
old_ref);
|
||||
|
||||
Reference in New Issue
Block a user