diff options
author | Stefan Beller <sbeller@google.com> | 2018-06-28 18:21:51 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-06-29 10:43:38 -0700 |
commit | 109cd76dd3467bd05f8d2145b857006649741d5c (patch) | |
tree | 3b3baf8fb9861083f665e91e77e5ee07ec504747 /builtin/name-rev.c | |
parent | Merge branch 'sb/object-store-grafts' into sb/object-store-lookup (diff) | |
download | tgif-109cd76dd3467bd05f8d2145b857006649741d5c.tar.xz |
object: add repository argument to parse_object
Add a repository argument to allow the callers of parse_object
to be more specific about which repository to act on. This is a small
mechanical change; it doesn't change the implementation to handle
repositories other than the_repository yet.
As with the previous commits, use a macro to catch callers passing a
repository other than the_repository at compile time.
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/name-rev.c')
-rw-r--r-- | builtin/name-rev.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/builtin/name-rev.c b/builtin/name-rev.c index 0eb440359d..de54fa93e4 100644 --- a/builtin/name-rev.c +++ b/builtin/name-rev.c @@ -1,5 +1,6 @@ #include "builtin.h" #include "cache.h" +#include "repository.h" #include "config.h" #include "commit.h" #include "tag.h" @@ -203,7 +204,7 @@ static int tipcmp(const void *a_, const void *b_) static int name_ref(const char *path, const struct object_id *oid, int flags, void *cb_data) { - struct object *o = parse_object(oid); + struct object *o = parse_object(the_repository, oid); struct name_ref_data *data = cb_data; int can_abbreviate_output = data->tags_only && data->name_only; int deref = 0; @@ -261,7 +262,7 @@ static int name_ref(const char *path, const struct object_id *oid, int flags, vo struct tag *t = (struct tag *) o; if (!t->tagged) break; /* broken repository */ - o = parse_object(&t->tagged->oid); + o = parse_object(the_repository, &t->tagged->oid); deref = 1; taggerdate = t->date; } @@ -451,7 +452,7 @@ int cmd_name_rev(int argc, const char **argv, const char *prefix) } commit = NULL; - object = parse_object(&oid); + object = parse_object(the_repository, &oid); if (object) { struct object *peeled = deref_tag(object, *argv, 0); if (peeled && peeled->type == OBJ_COMMIT) |