]> git.ipfire.org Git - thirdparty/git.git/commitdiff
commit: add repository argument to lookup_commit_reference
authorStefan Beller <sbeller@google.com>
Fri, 29 Jun 2018 01:21:58 +0000 (18:21 -0700)
committerJunio C Hamano <gitster@pobox.com>
Fri, 29 Jun 2018 17:43:39 +0000 (10:43 -0700)
Add a repository argument to allow callers of lookup_commit_reference
to be more specific about which repository to handle. 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: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
27 files changed:
bisect.c
blame.c
branch.c
builtin/branch.c
builtin/clone.c
builtin/describe.c
builtin/diff-tree.c
builtin/log.c
builtin/merge-base.c
builtin/notes.c
builtin/pull.c
builtin/replace.c
builtin/reset.c
builtin/rev-parse.c
builtin/show-branch.c
builtin/tag.c
bundle.c
commit.c
commit.h
merge-recursive.c
notes-merge.c
parse-options-cb.c
remote.c
revision.c
sequencer.c
sha1-name.c
submodule.c

index 6de1abd407ba3f8b7698133d469389913bfd92c3..e1275ba79e8e7368f5448043e321db2b9376aa71 100644 (file)
--- a/bisect.c
+++ b/bisect.c
@@ -724,7 +724,7 @@ static int bisect_checkout(const struct object_id *bisect_rev, int no_checkout)
 
 static struct commit *get_commit_reference(const struct object_id *oid)
 {
-       struct commit *r = lookup_commit_reference(oid);
+       struct commit *r = lookup_commit_reference(the_repository, oid);
        if (!r)
                die(_("Not a valid commit name %s"), oid_to_hex(oid));
        return r;
diff --git a/blame.c b/blame.c
index 5b022cc22541f5438a9a111e7dfcd360a7caeca7..8a0655a5997c55a750b6b727d31c36ae01c603a9 100644 (file)
--- a/blame.c
+++ b/blame.c
@@ -119,7 +119,7 @@ static struct commit_list **append_parent(struct commit_list **tail, const struc
 {
        struct commit *parent;
 
-       parent = lookup_commit_reference(oid);
+       parent = lookup_commit_reference(the_repository, oid);
        if (!parent)
                die("no such commit %s", oid_to_hex(oid));
        return &commit_list_insert(parent, tail)->next;
index 6a35dd31f2a9c9171a866c66f65cbb30e2e511a8..ecd710d7308c9d2be85cd3bcde4fd9d38dec0edc 100644 (file)
--- a/branch.c
+++ b/branch.c
@@ -302,7 +302,7 @@ void create_branch(const char *name, const char *start_name,
                break;
        }
 
-       if ((commit = lookup_commit_reference(&oid)) == NULL)
+       if ((commit = lookup_commit_reference(the_repository, &oid)) == NULL)
                die(_("Not a valid branch point: '%s'."), start_name);
        oidcpy(&oid, &commit->object.oid);
 
index 1876ca9e7969019e1db1c97aedcf1064903b80a2..a50632fb23f52e3bad6de8a8e225498f4071fc58 100644 (file)
@@ -121,7 +121,8 @@ static int branch_merged(int kind, const char *name,
                    (reference_name = reference_name_to_free =
                     resolve_refdup(upstream, RESOLVE_REF_READING,
                                    &oid, NULL)) != NULL)
-                       reference_rev = lookup_commit_reference(&oid);
+                       reference_rev = lookup_commit_reference(the_repository,
+                                                               &oid);
        }
        if (!reference_rev)
                reference_rev = head_rev;
@@ -154,7 +155,7 @@ static int check_branch_commit(const char *branchname, const char *refname,
                               const struct object_id *oid, struct commit *head_rev,
                               int kinds, int force)
 {
-       struct commit *rev = lookup_commit_reference(oid);
+       struct commit *rev = lookup_commit_reference(the_repository, oid);
        if (!rev) {
                error(_("Couldn't look up commit object for '%s'"), refname);
                return -1;
@@ -208,7 +209,7 @@ static int delete_branches(int argc, const char **argv, int force, int kinds,
        }
 
        if (!force) {
-               head_rev = lookup_commit_reference(&head_oid);
+               head_rev = lookup_commit_reference(the_repository, &head_oid);
                if (!head_rev)
                        die(_("Couldn't look up commit object for HEAD"));
        }
index 1d939af9d8cb93bd233549c44d891f3f9df803cc..4b3b48ee84ac59a546038a0dd9a84521e96e3cd7 100644 (file)
@@ -696,7 +696,8 @@ static void update_head(const struct ref *our, const struct ref *remote,
                        install_branch_config(0, head, option_origin, our->name);
                }
        } else if (our) {
-               struct commit *c = lookup_commit_reference(&our->old_oid);
+               struct commit *c = lookup_commit_reference(the_repository,
+                                                          &our->old_oid);
                /* --branch specifies a non-branch (i.e. tags), detach HEAD */
                update_ref(msg, "HEAD", &c->object.oid, NULL, REF_NO_DEREF,
                           UPDATE_REFS_DIE_ON_ERR);
index 0b5d8562331ff542bb19756588cec60694f7bb65..c8ff64766d04c9dad38dc8f2ccccb7c9ffecaa63 100644 (file)
@@ -303,7 +303,7 @@ static void describe_commit(struct object_id *oid, struct strbuf *dst)
        unsigned long seen_commits = 0;
        unsigned int unannotated_cnt = 0;
 
-       cmit = lookup_commit_reference(oid);
+       cmit = lookup_commit_reference(the_repository, oid);
 
        n = find_commit_name(&cmit->object.oid);
        if (n && (tags || all || n->prio == 2)) {
index 29901515a13491c2d2c3145998733109e531d3d4..a5718d96ee2c5304ed19fe633c7fdd86dc18ec8e 100644 (file)
@@ -11,7 +11,7 @@ static struct rev_info log_tree_opt;
 
 static int diff_tree_commit_oid(const struct object_id *oid)
 {
-       struct commit *commit = lookup_commit_reference(oid);
+       struct commit *commit = lookup_commit_reference(the_repository, oid);
        if (!commit)
                return -1;
        return log_tree_commit(&log_tree_opt, commit);
index 05217596a2ba5507295cd7660d23c10decbf510d..55a6286d7f4a954db80a1564f15d0db465f9b1d6 100644 (file)
@@ -907,8 +907,8 @@ static void get_patch_ids(struct rev_info *rev, struct patch_ids *ids)
        o2 = rev->pending.objects[1].item;
        flags1 = o1->flags;
        flags2 = o2->flags;
-       c1 = lookup_commit_reference(&o1->oid);
-       c2 = lookup_commit_reference(&o2->oid);
+       c1 = lookup_commit_reference(the_repository, &o1->oid);
+       c2 = lookup_commit_reference(the_repository, &o2->oid);
 
        if ((flags1 & UNINTERESTING) == (flags2 & UNINTERESTING))
                die(_("Not a range."));
@@ -1864,7 +1864,8 @@ static int add_pending_commit(const char *arg, struct rev_info *revs, int flags)
 {
        struct object_id oid;
        if (get_oid(arg, &oid) == 0) {
-               struct commit *commit = lookup_commit_reference(&oid);
+               struct commit *commit = lookup_commit_reference(the_repository,
+                                                               &oid);
                if (commit) {
                        commit->object.flags |= flags;
                        add_pending_object(revs, &commit->object, arg);
index 3b7600150b66c4bf814e21b74b2d931f44c83805..bbead6f33e5c5449da3ff02b98b7c2ab993a54b7 100644 (file)
@@ -6,6 +6,7 @@
 #include "diff.h"
 #include "revision.h"
 #include "parse-options.h"
+#include "repository.h"
 
 static int show_merge_base(struct commit **rev, int rev_nr, int show_all)
 {
@@ -42,7 +43,7 @@ static struct commit *get_commit_reference(const char *arg)
 
        if (get_oid(arg, &revkey))
                die("Not a valid object name %s", arg);
-       r = lookup_commit_reference(&revkey);
+       r = lookup_commit_reference(the_repository, &revkey);
        if (!r)
                die("Not a valid commit name %s", arg);
 
@@ -171,7 +172,7 @@ static int handle_fork_point(int argc, const char **argv)
        if (get_oid(commitname, &oid))
                die("Not a valid object name: '%s'", commitname);
 
-       derived = lookup_commit_reference(&oid);
+       derived = lookup_commit_reference(the_repository, &oid);
        memset(&revs, 0, sizeof(revs));
        revs.initial = 1;
        for_each_reflog_ent(refname, collect_one_reflog_ent, &revs);
index a0a184004097a0892b3eaafae6ad31b331d6efd3..c05cd004abcbdcd1e4c3d140f3cf4251c416df36 100644 (file)
@@ -12,6 +12,7 @@
 #include "builtin.h"
 #include "notes.h"
 #include "object-store.h"
+#include "repository.h"
 #include "blob.h"
 #include "pretty.h"
 #include "refs.h"
@@ -711,7 +712,7 @@ static int merge_commit(struct notes_merge_options *o)
 
        if (get_oid("NOTES_MERGE_PARTIAL", &oid))
                die(_("failed to read ref NOTES_MERGE_PARTIAL"));
-       else if (!(partial = lookup_commit_reference(&oid)))
+       else if (!(partial = lookup_commit_reference(the_repository, &oid)))
                die(_("could not find commit from NOTES_MERGE_PARTIAL."));
        else if (parse_commit(partial))
                die(_("could not parse commit from NOTES_MERGE_PARTIAL."));
index 7197b22b165576ed599f1d01528c5ca2527032b1..4e789353922340c3d0727a2e2c3e60e5a9936ee5 100644 (file)
@@ -765,10 +765,13 @@ static int get_octopus_merge_base(struct object_id *merge_base,
 {
        struct commit_list *revs = NULL, *result;
 
-       commit_list_insert(lookup_commit_reference(curr_head), &revs);
-       commit_list_insert(lookup_commit_reference(merge_head), &revs);
+       commit_list_insert(lookup_commit_reference(the_repository, curr_head),
+                          &revs);
+       commit_list_insert(lookup_commit_reference(the_repository, merge_head),
+                          &revs);
        if (!is_null_oid(fork_point))
-               commit_list_insert(lookup_commit_reference(fork_point), &revs);
+               commit_list_insert(lookup_commit_reference(the_repository, fork_point),
+                                  &revs);
 
        result = get_octopus_merge_bases(revs);
        free_commit_list(revs);
@@ -944,9 +947,11 @@ int cmd_pull(int argc, const char **argv, const char *prefix)
                        struct commit_list *list = NULL;
                        struct commit *merge_head, *head;
 
-                       head = lookup_commit_reference(&orig_head);
+                       head = lookup_commit_reference(the_repository,
+                                                      &orig_head);
                        commit_list_insert(head, &list);
-                       merge_head = lookup_commit_reference(&merge_heads.oid[0]);
+                       merge_head = lookup_commit_reference(the_repository,
+                                                            &merge_heads.oid[0]);
                        if (is_descendant_of(merge_head, list)) {
                                /* we can fast-forward this without invoking rebase */
                                opt_ff = "--ff-only";
index deabda210127087188117e394e453373fa48991f..0232f98f020c084f06df449775c698d1ffe3ef06 100644 (file)
@@ -371,7 +371,7 @@ static int replace_parents(struct strbuf *buf, int argc, const char **argv)
                        return error(_("Not a valid object name: '%s'"),
                                     argv[i]);
                }
-               if (!lookup_commit_reference(&oid)) {
+               if (!lookup_commit_reference(the_repository, &oid)) {
                        strbuf_release(&new_parents);
                        return error(_("could not parse %s"), argv[i]);
                }
@@ -443,7 +443,7 @@ static int create_graft(int argc, const char **argv, int force, int gentle)
 
        if (get_oid(old_ref, &old_oid) < 0)
                return error(_("Not a valid object name: '%s'"), old_ref);
-       commit = lookup_commit_reference(&old_oid);
+       commit = lookup_commit_reference(the_repository, &old_oid);
        if (!commit)
                return error(_("could not parse %s"), old_ref);
 
index ffe41c924b4810d79872fb5faf600a47e19508e5..d9871e5b6c6f3f417baa7daa4d84d3b9bc9142a9 100644 (file)
@@ -319,7 +319,7 @@ int cmd_reset(int argc, const char **argv, const char *prefix)
                struct commit *commit;
                if (get_oid_committish(rev, &oid))
                        die(_("Failed to resolve '%s' as a valid revision."), rev);
-               commit = lookup_commit_reference(&oid);
+               commit = lookup_commit_reference(the_repository, &oid);
                if (!commit)
                        die(_("Could not parse object '%s'."), rev);
                oidcpy(&oid, &commit->object.oid);
@@ -396,7 +396,7 @@ int cmd_reset(int argc, const char **argv, const char *prefix)
                update_ref_status = reset_refs(rev, &oid);
 
                if (reset_type == HARD && !update_ref_status && !quiet)
-                       print_new_head_line(lookup_commit_reference(&oid));
+                       print_new_head_line(lookup_commit_reference(the_repository, &oid));
        }
        if (!pathspec.nr)
                remove_branch_state();
index 2a6cb298bdab7961a73df16c4984ff9eefef7795..0f09bbbf65a4bc8d6d064a985181ac547d9ee411 100644 (file)
@@ -280,8 +280,8 @@ static int try_difference(const char *arg)
                if (symmetric) {
                        struct commit_list *exclude;
                        struct commit *a, *b;
-                       a = lookup_commit_reference(&start_oid);
-                       b = lookup_commit_reference(&end_oid);
+                       a = lookup_commit_reference(the_repository, &start_oid);
+                       b = lookup_commit_reference(the_repository, &end_oid);
                        if (!a || !b) {
                                *dotdot = '.';
                                return 0;
@@ -333,7 +333,7 @@ static int try_parent_shorthands(const char *arg)
 
        *dotdot = 0;
        if (get_oid_committish(arg, &oid) ||
-           !(commit = lookup_commit_reference(&oid))) {
+           !(commit = lookup_commit_reference(the_repository, &oid))) {
                *dotdot = '^';
                return 0;
        }
index 2456b47d344ddb05ac1c6406b6dd574925c88c15..4b9d3c0059bb866a699ce7060fef1047e9019e3b 100644 (file)
@@ -831,7 +831,7 @@ int cmd_show_branch(int ac, const char **av, const char *prefix)
                               MAX_REVS), MAX_REVS);
                if (get_oid(ref_name[num_rev], &revkey))
                        die(_("'%s' is not a valid ref."), ref_name[num_rev]);
-               commit = lookup_commit_reference(&revkey);
+               commit = lookup_commit_reference(the_repository, &revkey);
                if (!commit)
                        die(_("cannot find commit %s (%s)"),
                            ref_name[num_rev], oid_to_hex(&revkey));
index 9919b03b2d601a74639553e8e61baef04ffd7cd9..9a19ffb49f68d7c0318f650d34d0edbcd6db81d3 100644 (file)
@@ -313,7 +313,7 @@ static void create_reflog_msg(const struct object_id *oid, struct strbuf *sb)
                }
                free(buf);
 
-               if ((c = lookup_commit_reference(oid)) != NULL)
+               if ((c = lookup_commit_reference(the_repository, oid)) != NULL)
                        strbuf_addf(sb, ", %s", show_date(c->date, 0, DATE_MODE(SHORT)));
                break;
        case OBJ_TREE:
index 0a9f4ee76b2efdef259b18776a0fd6c37feab6c4..24cbe409863a83e8bda453af637c2237504a531d 100644 (file)
--- a/bundle.c
+++ b/bundle.c
@@ -375,7 +375,8 @@ static int write_bundle_refs(int bundle_fd, struct rev_info *revs)
                         * in terms of a tag (e.g. v2.0 from the range
                         * "v1.0..v2.0")?
                         */
-                       struct commit *one = lookup_commit_reference(&oid);
+                       struct commit *one = lookup_commit_reference(the_repository,
+                                                                    &oid);
                        struct object *obj;
 
                        if (e->item == &(one->object)) {
index 756d557b3c9482df30db6f4b1e1e56b0120961a5..5e50a0793248ca364c9c9f3c9c61dfa7692c049c 100644 (file)
--- a/commit.c
+++ b/commit.c
@@ -35,14 +35,14 @@ struct commit *lookup_commit_reference_gently_the_repository(
        return object_as_type(the_repository, obj, OBJ_COMMIT, quiet);
 }
 
-struct commit *lookup_commit_reference(const struct object_id *oid)
+struct commit *lookup_commit_reference_the_repository(const struct object_id *oid)
 {
        return lookup_commit_reference_gently(the_repository, oid, 0);
 }
 
 struct commit *lookup_commit_or_die(const struct object_id *oid, const char *ref_name)
 {
-       struct commit *c = lookup_commit_reference(oid);
+       struct commit *c = lookup_commit_reference(the_repository, oid);
        if (!c)
                die(_("could not parse %s"), ref_name);
        if (oidcmp(oid, &c->object.oid)) {
@@ -68,7 +68,7 @@ struct commit *lookup_commit_reference_by_name(const char *name)
 
        if (get_oid_committish(name, &oid))
                return NULL;
-       commit = lookup_commit_reference(&oid);
+       commit = lookup_commit_reference(the_repository, &oid);
        if (parse_commit(commit))
                return NULL;
        return commit;
index 000d194f8aac0fb2953408d257d0398f5a667216..2a4111344573c9523364d493dddc13db8a01f021 100644 (file)
--- a/commit.h
+++ b/commit.h
@@ -64,7 +64,9 @@ void add_name_decoration(enum decoration_type type, const char *name, struct obj
 const struct name_decoration *get_name_decoration(const struct object *obj);
 
 struct commit *lookup_commit(const struct object_id *oid);
-struct commit *lookup_commit_reference(const struct object_id *oid);
+#define lookup_commit_reference(r, o) \
+               lookup_commit_reference_##r(o)
+struct commit *lookup_commit_reference_the_repository(const struct object_id *oid);
 #define lookup_commit_reference_gently(r, o, q) \
                lookup_commit_reference_gently_##r(o, q)
 struct commit *lookup_commit_reference_gently_the_repository(
index fbb044e6f6fd1b575622d37c1e15580ac95604d6..41366e75e20edbb086efcf99098495da27f1fe63 100644 (file)
@@ -1192,9 +1192,9 @@ static int merge_submodule(struct merge_options *o,
                return 0;
        }
 
-       if (!(commit_base = lookup_commit_reference(base)) ||
-           !(commit_a = lookup_commit_reference(a)) ||
-           !(commit_b = lookup_commit_reference(b))) {
+       if (!(commit_base = lookup_commit_reference(the_repository, base)) ||
+           !(commit_a = lookup_commit_reference(the_repository, a)) ||
+           !(commit_b = lookup_commit_reference(the_repository, b))) {
                output(o, 1, _("Failed to merge submodule %s (commits not present)"), path);
                return 0;
        }
index 9cc2ee16a8c04c43dabebd61b0b7d41627af40ee..76ab19e702423aeb511bfc1e939a7998c61fab61 100644 (file)
@@ -2,6 +2,7 @@
 #include "commit.h"
 #include "refs.h"
 #include "object-store.h"
+#include "repository.h"
 #include "diff.h"
 #include "diffcore.h"
 #include "xdiff-interface.h"
@@ -553,7 +554,7 @@ int notes_merge(struct notes_merge_options *o,
        else if (!check_refname_format(o->local_ref, 0) &&
                is_null_oid(&local_oid))
                local = NULL; /* local_oid == null_oid indicates unborn ref */
-       else if (!(local = lookup_commit_reference(&local_oid)))
+       else if (!(local = lookup_commit_reference(the_repository, &local_oid)))
                die("Could not parse local commit %s (%s)",
                    oid_to_hex(&local_oid), o->local_ref);
        trace_printf("\tlocal commit: %.7s\n", oid_to_hex(&local_oid));
@@ -571,7 +572,7 @@ int notes_merge(struct notes_merge_options *o,
                        die("Failed to resolve remote notes ref '%s'",
                            o->remote_ref);
                }
-       } else if (!(remote = lookup_commit_reference(&remote_oid))) {
+       } else if (!(remote = lookup_commit_reference(the_repository, &remote_oid))) {
                die("Could not parse remote commit %s (%s)",
                    oid_to_hex(&remote_oid), o->remote_ref);
        }
index 0f9f311a7a93350a584125c90da643fce96c34e7..e8236534ac8aa00fde2a5a9ae27e85c72d062f3a 100644 (file)
@@ -91,7 +91,7 @@ int parse_opt_commits(const struct option *opt, const char *arg, int unset)
                return -1;
        if (get_oid(arg, &oid))
                return error("malformed object name %s", arg);
-       commit = lookup_commit_reference(&oid);
+       commit = lookup_commit_reference(the_repository, &oid);
        if (!commit)
                return error("no such commit %s", arg);
        commit_list_insert(commit, opt->value);
index 0f1a84d67a365323139f5fc9444ed5616e73a779..8c75c45fe65fca6e37ce526b58289878530dba04 100644 (file)
--- a/remote.c
+++ b/remote.c
@@ -1865,13 +1865,13 @@ int stat_tracking_info(struct branch *branch, int *num_ours, int *num_theirs,
        /* Cannot stat if what we used to build on no longer exists */
        if (read_ref(base, &oid))
                return -1;
-       theirs = lookup_commit_reference(&oid);
+       theirs = lookup_commit_reference(the_repository, &oid);
        if (!theirs)
                return -1;
 
        if (read_ref(branch->refname, &oid))
                return -1;
-       ours = lookup_commit_reference(&oid);
+       ours = lookup_commit_reference(the_repository, &oid);
        if (!ours)
                return -1;
 
index 02e1296e36d2fe703d046d69869fd20931353116..4dbe406bed2aa13f0685d98f0932f997e88b4972 100644 (file)
@@ -1591,8 +1591,8 @@ static int handle_dotdot_1(const char *arg, char *dotdot,
                struct commit *a, *b;
                struct commit_list *exclude;
 
-               a = lookup_commit_reference(&a_obj->oid);
-               b = lookup_commit_reference(&b_obj->oid);
+               a = lookup_commit_reference(the_repository, &a_obj->oid);
+               b = lookup_commit_reference(the_repository, &b_obj->oid);
                if (!a || !b)
                        return dotdot_missing(arg, dotdot, revs, symmetric);
 
index b4170b748cca94510602a269fe371a7e435fcd89..cc7b19199e8da2de59cf531b3feaae864f037734 100644 (file)
@@ -1176,7 +1176,7 @@ static int parse_head(struct commit **head)
        if (get_oid("HEAD", &oid)) {
                current_head = NULL;
        } else {
-               current_head = lookup_commit_reference(&oid);
+               current_head = lookup_commit_reference(the_repository, &oid);
                if (!current_head)
                        return error(_("could not parse HEAD"));
                if (oidcmp(&oid, &current_head->object.oid)) {
@@ -1511,7 +1511,7 @@ static int update_squash_messages(enum todo_command command,
 
                if (get_oid("HEAD", &head))
                        return error(_("need a HEAD to fixup"));
-               if (!(head_commit = lookup_commit_reference(&head)))
+               if (!(head_commit = lookup_commit_reference(the_repository, &head)))
                        return error(_("could not read HEAD"));
                if (!(head_message = get_commit_buffer(head_commit, NULL)))
                        return error(_("could not read HEAD's commit message"));
@@ -2009,7 +2009,7 @@ static int parse_insn_line(struct todo_item *item, const char *bol, char *eol)
        if (status < 0)
                return -1;
 
-       item->commit = lookup_commit_reference(&commit_oid);
+       item->commit = lookup_commit_reference(the_repository, &commit_oid);
        return !item->commit;
 }
 
index 473611879bf9c12000a5123907ce633c206af1c9..325915fb276b50b67d565a022094510f68345106 100644 (file)
@@ -844,7 +844,7 @@ static int get_parent(const char *name, int len,
 
        if (ret)
                return ret;
-       commit = lookup_commit_reference(&oid);
+       commit = lookup_commit_reference(the_repository, &oid);
        if (parse_commit(commit))
                return -1;
        if (!idx) {
@@ -872,7 +872,7 @@ static int get_nth_ancestor(const char *name, int len,
        ret = get_oid_1(name, len, &oid, GET_OID_COMMITTISH);
        if (ret)
                return ret;
-       commit = lookup_commit_reference(&oid);
+       commit = lookup_commit_reference(the_repository, &oid);
        if (!commit)
                return -1;
 
index 0998ea2345800449c08bca12fbedd236f6b55eb6..6688dd5d45949597d7d5761c9b88ea9fcceabf2d 100644 (file)
@@ -517,8 +517,8 @@ static void show_submodule_header(struct diff_options *o, const char *path,
         * Attempt to lookup the commit references, and determine if this is
         * a fast forward or fast backwards update.
         */
-       *left = lookup_commit_reference(one);
-       *right = lookup_commit_reference(two);
+       *left = lookup_commit_reference(the_repository, one);
+       *right = lookup_commit_reference(the_repository, two);
 
        /*
         * Warn about missing commits in the submodule project, but only if