builtin/write-tree: convert to struct object_id
This is needed to convert parts of the cache-tree code. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
brian m. carlson committed
Mar 12, 2018 at 02:27 UTC
38b471fae0f2b961259201278b24b11262dc7596
1 file changed
+3
-3
builtin/write-tree.c
+3
-3
@@ -19,7 +19,7 @@ int cmd_write_tree(int argc, const char **argv, const char *unused_prefix)
19
{
20
int flags = 0, ret;
21
const char *prefix = NULL;
22
- unsigned char sha1[20];
22
+ struct object_id oid;
23
const char *me = "git-write-tree";
24
struct option write_tree_options[] = {
25
OPT_BIT(0, "missing-ok", &flags, N_("allow missing objects"),
@@ -38,10 +38,10 @@ int cmd_write_tree(int argc, const char **argv, const char *unused_prefix)
38
argc = parse_options(argc, argv, unused_prefix, write_tree_options,
39
write_tree_usage, 0);
40
41
- ret = write_cache_as_tree(sha1, flags, prefix);
41
+ ret = write_cache_as_tree(oid.hash, flags, prefix);
42
switch (ret) {
43
case 0:
44
- printf("%s\n", sha1_to_hex(sha1));
44
+ printf("%s\n", oid_to_hex(&oid));
45
break;
46
case WRITE_TREE_UNREADABLE_INDEX:
47
die("%s: error reading the index", me);