diff options
Diffstat (limited to 'builtin/show-ref.c')
-rw-r--r-- | builtin/show-ref.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/builtin/show-ref.c b/builtin/show-ref.c index 41e5e71cad..6456da70cc 100644 --- a/builtin/show-ref.c +++ b/builtin/show-ref.c @@ -1,6 +1,8 @@ #include "builtin.h" #include "cache.h" +#include "config.h" #include "refs.h" +#include "object-store.h" #include "object.h" #include "tag.h" #include "string-list.h" @@ -22,14 +24,14 @@ static void show_one(const char *refname, const struct object_id *oid) const char *hex; struct object_id peeled; - if (!has_sha1_file(oid->hash)) + if (!has_object_file(oid)) die("git show-ref: bad ref %s (%s)", refname, oid_to_hex(oid)); if (quiet) return; - hex = find_unique_abbrev(oid->hash, abbrev); + hex = find_unique_abbrev(oid, abbrev); if (hash_only) printf("%s\n", hex); else @@ -39,7 +41,7 @@ static void show_one(const char *refname, const struct object_id *oid) return; if (!peel_ref(refname, &peeled)) { - hex = find_unique_abbrev(peeled.hash, abbrev); + hex = find_unique_abbrev(&peeled, abbrev); printf("%s %s^{}\n", hex, refname); } } @@ -150,6 +152,7 @@ static int hash_callback(const struct option *opt, const char *arg, int unset) static int exclude_existing_callback(const struct option *opt, const char *arg, int unset) { + BUG_ON_OPT_NEG(unset); exclude_arg = 1; *(const char **)opt->value = arg; return 0; @@ -180,6 +183,8 @@ static const struct option show_ref_options[] = { int cmd_show_ref(int argc, const char **argv, const char *prefix) { + git_config(git_default_config, NULL); + argc = parse_options(argc, argv, prefix, show_ref_options, show_ref_usage, 0); |