diff options
Diffstat (limited to 'builtin/unpack-file.c')
| -rw-r--r-- | builtin/unpack-file.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/builtin/unpack-file.c b/builtin/unpack-file.c index 6da2825753..87877a9fab 100644 --- a/builtin/unpack-file.c +++ b/builtin/unpack-file.c @@ -1,9 +1,11 @@ #define USE_THE_REPOSITORY_VARIABLE #include "builtin.h" #include "config.h" +#include "environment.h" #include "hex.h" +#include "object-file.h" #include "object-name.h" -#include "object-store-ll.h" +#include "odb.h" static char *create_temp_file(struct object_id *oid) { @@ -13,7 +15,7 @@ static char *create_temp_file(struct object_id *oid) unsigned long size; int fd; - buf = repo_read_object_file(the_repository, oid, &type, &size); + buf = odb_read_object(the_repository->objects, oid, &type, &size); if (!buf || type != OBJ_BLOB) die("unable to read blob object %s", oid_to_hex(oid)); @@ -26,6 +28,9 @@ static char *create_temp_file(struct object_id *oid) return path; } +static const char usage_msg[] = +"git unpack-file <blob>"; + int cmd_unpack_file(int argc, const char **argv, const char *prefix UNUSED, @@ -33,12 +38,13 @@ int cmd_unpack_file(int argc, { struct object_id oid; - if (argc != 2 || !strcmp(argv[1], "-h")) - usage("git unpack-file <blob>"); + show_usage_if_asked(argc, argv, usage_msg); + if (argc != 2) + usage(usage_msg); if (repo_get_oid(the_repository, argv[1], &oid)) die("Not a valid object name %s", argv[1]); - git_config(git_default_config, NULL); + repo_config(the_repository, git_default_config, NULL); puts(create_temp_file(&oid)); return 0; |
