summary refs log tree commit diff
path: root/merge-ort.c
diff options
context:
space:
mode:
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>2022-02-05 00:48:26 +0100
committerJunio C Hamano <gitster@pobox.com>2022-02-25 17:16:31 -0800
commitc80d226a046170b1c8dd82ef72a27373ddd5880e (patch)
treeb4929eb612436c3ec74193cfc99472bc8da443d7 /merge-ort.c
parentb04cdea46cf5ae60066fa6dd12d5449bf3ef283f (diff)
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>
Diffstat (limited to 'merge-ort.c')
-rw-r--r--merge-ort.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/merge-ort.c b/merge-ort.c
index c319797021..d4ba2955f1 100644
--- a/merge-ort.c
+++ b/merge-ort.c
@@ -1888,7 +1888,7 @@ static int handle_content_merge(struct merge_options *opt,
 
 		if (!ret &&
 		    write_object_file(result_buf.ptr, result_buf.size,
-				      blob_type, &result->oid))
+				      OBJ_BLOB, &result->oid))
 			ret = err(opt, _("Unable to add %s to database"),
 				  path);
 
@@ -3343,7 +3343,7 @@ static void write_tree(struct object_id *result_oid,
 	}
 
 	/* Write this object file out, and record in result_oid */
-	write_object_file(buf.buf, buf.len, tree_type, result_oid);
+	write_object_file(buf.buf, buf.len, OBJ_TREE, result_oid);
 	strbuf_release(&buf);
 }