From 7695d118e5a3c9c6fcb4cb15eb766a1c57422aed Mon Sep 17 00:00:00 2001 From: Ronnie Sahlberg Date: Tue, 15 Jul 2014 12:59:36 -0700 Subject: 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 Signed-off-by: Jonathan Nieder Signed-off-by: Junio C Hamano --- transport.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'transport.c') diff --git a/transport.c b/transport.c index 055d2a27d..b56620ed7 100644 --- a/transport.c +++ b/transport.c @@ -168,7 +168,8 @@ static void set_upstreams(struct transport *transport, struct ref *refs, /* Follow symbolic refs (mainly for HEAD). */ localname = ref->peer_ref->name; remotename = ref->name; - tmp = resolve_ref_unsafe(localname, sha, 1, &flag); + tmp = resolve_ref_unsafe(localname, RESOLVE_REF_READING, + sha, &flag); if (tmp && flag & REF_ISSYMREF && starts_with(tmp, "refs/heads/")) localname = tmp; @@ -743,7 +744,7 @@ void transport_print_push_status(const char *dest, struct ref *refs, unsigned char head_sha1[20]; char *head; - head = resolve_refdup("HEAD", head_sha1, 1, NULL); + head = resolve_refdup("HEAD", RESOLVE_REF_READING, head_sha1, NULL); if (verbose) { for (ref = refs; ref; ref = ref->next) -- cgit v1.2.1