diff options
| author | Stefan Beller <sbeller@google.com> | 2018-06-28 18:21:59 -0700 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2018-06-29 10:43:39 -0700 |
| commit | c1f5eb49620d4f287af28509621a364e3888cfe7 (patch) | |
| tree | 336aedde87d6008ed918ff3d58759e4dfdbceae5 /builtin | |
| parent | 2122f6754c93be8f02bfb5704ed96c88fc9837a8 (diff) | |
| download | git-c1f5eb49620d4f287af28509621a364e3888cfe7.tar.gz | |
commit: add repository argument to lookup_commit
Add a repository argument to allow callers of lookup_commit 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>
Diffstat (limited to 'builtin')
| -rw-r--r-- | builtin/am.c | 3 | ||||
| -rw-r--r-- | builtin/commit-tree.c | 4 | ||||
| -rw-r--r-- | builtin/diff-tree.c | 2 | ||||
| -rw-r--r-- | builtin/fast-export.c | 2 | ||||
| -rw-r--r-- | builtin/fmt-merge-msg.c | 2 | ||||
| -rw-r--r-- | builtin/merge-base.c | 2 | ||||
| -rw-r--r-- | builtin/verify-commit.c | 4 |
7 files changed, 12 insertions, 7 deletions
diff --git a/builtin/am.c b/builtin/am.c index 72e928cee7..b6eeb46c4b 100644 --- a/builtin/am.c +++ b/builtin/am.c @@ -1633,7 +1633,8 @@ static void do_commit(const struct am_state *state) if (!get_oid_commit("HEAD", &parent)) { old_oid = &parent; - commit_list_insert(lookup_commit(&parent), &parents); + commit_list_insert(lookup_commit(the_repository, &parent), + &parents); } else { old_oid = NULL; say(state, stderr, _("applying to an empty history")); diff --git a/builtin/commit-tree.c b/builtin/commit-tree.c index 9fbd3529fb..9ec36a82b6 100644 --- a/builtin/commit-tree.c +++ b/builtin/commit-tree.c @@ -6,6 +6,7 @@ #include "cache.h" #include "config.h" #include "object-store.h" +#include "repository.h" #include "commit.h" #include "tree.h" #include "builtin.h" @@ -60,7 +61,8 @@ int cmd_commit_tree(int argc, const char **argv, const char *prefix) if (get_oid_commit(argv[i], &oid)) die("Not a valid object name %s", argv[i]); assert_oid_type(&oid, OBJ_COMMIT); - new_parent(lookup_commit(&oid), &parents); + new_parent(lookup_commit(the_repository, &oid), + &parents); continue; } diff --git a/builtin/diff-tree.c b/builtin/diff-tree.c index a5718d96ee..91ba67070e 100644 --- a/builtin/diff-tree.c +++ b/builtin/diff-tree.c @@ -25,7 +25,7 @@ static int stdin_diff_commit(struct commit *commit, const char *p) /* Graft the fake parents locally to the commit */ while (isspace(*p++) && !parse_oid_hex(p, &oid, &p)) { - struct commit *parent = lookup_commit(&oid); + struct commit *parent = lookup_commit(the_repository, &oid); if (!pptr) { /* Free the real parent list */ free_commit_list(commit->parents); diff --git a/builtin/fast-export.c b/builtin/fast-export.c index 7d6b1d8aea..223499d7ca 100644 --- a/builtin/fast-export.c +++ b/builtin/fast-export.c @@ -963,7 +963,7 @@ static void import_marks(char *input_file) /* only commits */ continue; - commit = lookup_commit(&oid); + commit = lookup_commit(the_repository, &oid); if (!commit) die("not a commit? can't happen: %s", oid_to_hex(&oid)); diff --git a/builtin/fmt-merge-msg.c b/builtin/fmt-merge-msg.c index 5e44589b54..36318ef46e 100644 --- a/builtin/fmt-merge-msg.c +++ b/builtin/fmt-merge-msg.c @@ -572,7 +572,7 @@ static void find_merge_parents(struct merge_parents *result, commit_list_insert(parent, &parents); add_merge_parent(result, &obj->oid, &parent->object.oid); } - head_commit = lookup_commit(head); + head_commit = lookup_commit(the_repository, head); if (head_commit) commit_list_insert(head_commit, &parents); reduce_heads_replace(&parents); diff --git a/builtin/merge-base.c b/builtin/merge-base.c index bbead6f33e..08d91b1f0c 100644 --- a/builtin/merge-base.c +++ b/builtin/merge-base.c @@ -124,7 +124,7 @@ static void add_one_commit(struct object_id *oid, struct rev_collect *revs) if (is_null_oid(oid)) return; - commit = lookup_commit(oid); + commit = lookup_commit(the_repository, oid); if (!commit || (commit->object.flags & TMP_MARK) || parse_commit(commit)) diff --git a/builtin/verify-commit.c b/builtin/verify-commit.c index f6922da16d..7772c07ed7 100644 --- a/builtin/verify-commit.c +++ b/builtin/verify-commit.c @@ -9,6 +9,7 @@ #include "config.h" #include "builtin.h" #include "object-store.h" +#include "repository.h" #include "commit.h" #include "run-command.h" #include <signal.h> @@ -27,7 +28,8 @@ static int run_gpg_verify(const struct object_id *oid, const char *buf, unsigned memset(&signature_check, 0, sizeof(signature_check)); - ret = check_commit_signature(lookup_commit(oid), &signature_check); + ret = check_commit_signature(lookup_commit(the_repository, oid), + &signature_check); print_signature_buffer(&signature_check, flags); signature_check_clear(&signature_check); |
