refs.c: change resolve_ref_unsafe reading argument to be a flags field
resolve_ref_unsafe takes a boolean argument for reading (a nonexistent ref resolves successfully for writing but not for reading). Change this to be a flags field instead, and pass the new constant RESOLVE_REF_READING when we want this behaviour. While at it, swap two of the arguments in the function to put output arguments at the end. As a nice side effect, this ensures that we can catch callers that were unaware of the new API so they can be audited. Give the wrapper functions resolve_refdup and read_ref_full the same treatment for consistency. Signed-off-by: Ronnie Sahlberg <sahlberg@google.com> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
aae383db8c
commit
7695d118e5
@ -909,7 +909,7 @@ static void check_aliased_update(struct command *cmd, struct string_list *list)
|
||||
int flag;
|
||||
|
||||
strbuf_addf(&buf, "%s%s", get_git_namespace(), cmd->ref_name);
|
||||
dst_name = resolve_ref_unsafe(buf.buf, sha1, 0, &flag);
|
||||
dst_name = resolve_ref_unsafe(buf.buf, 0, sha1, &flag);
|
||||
strbuf_release(&buf);
|
||||
|
||||
if (!(flag & REF_ISSYMREF))
|
||||
@ -1070,7 +1070,7 @@ static void execute_commands(struct command *commands,
|
||||
check_aliased_updates(commands);
|
||||
|
||||
free(head_name_to_free);
|
||||
head_name = head_name_to_free = resolve_refdup("HEAD", sha1, 0, NULL);
|
||||
head_name = head_name_to_free = resolve_refdup("HEAD", 0, sha1, NULL);
|
||||
|
||||
checked_connectivity = 1;
|
||||
for (cmd = commands; cmd; cmd = cmd->next) {
|
||||
|
Reference in New Issue
Block a user