diff options
Diffstat (limited to 'builtin/unpack-file.c')
| -rw-r--r-- | builtin/unpack-file.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/builtin/unpack-file.c b/builtin/unpack-file.c index 9e8119dd35..00179180c7 100644 --- a/builtin/unpack-file.c +++ b/builtin/unpack-file.c @@ -1,6 +1,8 @@ #include "builtin.h" #include "config.h" +#include "hex.h" #include "object-store.h" +#include "wrapper.h" static char *create_temp_file(struct object_id *oid) { @@ -10,7 +12,7 @@ static char *create_temp_file(struct object_id *oid) unsigned long size; int fd; - buf = read_object_file(oid, &type, &size); + buf = repo_read_object_file(the_repository, oid, &type, &size); if (!buf || type != OBJ_BLOB) die("unable to read blob object %s", oid_to_hex(oid)); @@ -19,16 +21,17 @@ static char *create_temp_file(struct object_id *oid) if (write_in_full(fd, buf, size) < 0) die_errno("unable to write temp-file"); close(fd); + free(buf); return path; } -int cmd_unpack_file(int argc, const char **argv, const char *prefix) +int cmd_unpack_file(int argc, const char **argv, const char *prefix UNUSED) { struct object_id oid; if (argc != 2 || !strcmp(argv[1], "-h")) usage("git unpack-file <blob>"); - if (get_oid(argv[1], &oid)) + if (repo_get_oid(the_repository, argv[1], &oid)) die("Not a valid object name %s", argv[1]); git_config(git_default_config, NULL); |
