commit: add repository argument to lookup_commit_reference
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>
This commit is contained in:
committed by
Junio C Hamano
parent
21e1ee8f4f
commit
2122f6754c
@ -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, ¤t_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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user