diff options
Diffstat (limited to 'src/cli/cmd_hash_object.c')
-rw-r--r-- | src/cli/cmd_hash_object.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/cli/cmd_hash_object.c b/src/cli/cmd_hash_object.c index 93b980d..741debb 100644 --- a/src/cli/cmd_hash_object.c +++ b/src/cli/cmd_hash_object.c @@ -6,7 +6,7 @@ */ #include <git2.h> -#include "cli.h" +#include "common.h" #include "cmd.h" #include "futils.h" @@ -19,9 +19,7 @@ static int write_object, read_stdin, literally; static char **filenames; static const cli_opt_spec opts[] = { - { CLI_OPT_TYPE_SWITCH, "help", 0, &show_help, 1, - CLI_OPT_USAGE_HIDDEN | CLI_OPT_USAGE_STOP_PARSING, NULL, - "display help about the " COMMAND_NAME " command" }, + CLI_COMMON_OPT, { CLI_OPT_TYPE_VALUE, NULL, 't', &type_name, 0, CLI_OPT_USAGE_DEFAULT, "type", "the type of object to hash (default: \"blob\")" }, @@ -92,6 +90,7 @@ static int hash_buf( int cmd_hash_object(int argc, char **argv) { + cli_repository_open_options open_opts = { argv + 1, argc - 1}; git_repository *repo = NULL; git_odb *odb = NULL; git_oid_t oid_type; @@ -113,7 +112,7 @@ int cmd_hash_object(int argc, char **argv) return cli_error_usage("invalid object type '%s'", type_name); if (write_object && - (git_repository_open_ext(&repo, ".", GIT_REPOSITORY_OPEN_FROM_ENV, NULL) < 0 || + (cli_repository_open(&repo, &open_opts) < 0 || git_repository_odb(&odb, repo) < 0)) { ret = cli_error_git(); goto done; |