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
@ -744,7 +744,7 @@ static int find_symref(const char *refname, const unsigned char *sha1, int flag,
|
||||
|
||||
if ((flag & REF_ISSYMREF) == 0)
|
||||
return 0;
|
||||
symref_target = resolve_ref_unsafe(refname, unused, 0, &flag);
|
||||
symref_target = resolve_ref_unsafe(refname, 0, unused, &flag);
|
||||
if (!symref_target || (flag & REF_ISSYMREF) == 0)
|
||||
die("'%s' is a symref but it is not?", refname);
|
||||
item = string_list_append(cb_data, refname);
|
||||
|
Reference in New Issue
Block a user