Thread (33 messages) flat view 33 messages, 3 authors, 2016-06-15

Re: [PATCH 08/21] remote: let guess_remote_head() optionally return all matches

From: Jeff King <hidden>
Date: 2016-06-15 22:46:17

On Wed, Feb 25, 2009 at 03:32:15AM -0500, Jay Soffian wrote:
+struct ref *copy_ref_with_peer(const struct ref *src)
+{
+	struct ref *dst = copy_ref(src);
+	dst->peer_ref = copy_ref(src->peer_ref);
+	return dst;
+}
Hmm. This should probably be:

  dst->peer_ref = src->peer_ref ? copy_ref(src->peer_ref) : NULL;

(or copy_ref should return NULL when given NULL). I also wonder if the
copied ref's peer_ref should be explicitly NULL'd.

I don't think it matters for the current code, since we always feed it
"matched refs" which have a peer, but I think it is good to be a little
more defensive in such a generically-named function.

And yes, this bug was in my original patch. :)

-Peff
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help