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

Re: [PATCH] clone: Supply the right commit hash to post-checkout when -b is used

From: Jeff King <hidden>
Date: 2016-06-15 22:47:33

On Wed, Oct 14, 2009 at 12:11:09AM +0200, Björn Steinbrink wrote:
When we use -b <branch>, we may checkout something else than what the
remote's HEAD references, but we still used remote_head to supply the
new ref value to the post-checkout hook, which is wrong.

So instead of using remote_head to find the value to be passed to the
post-checkout hook, we have to use our_head_points_at, which is always
correctly setup, even if -b is not used.

This also fixes a segfault when "clone -b <branch>" is used with a
remote repo that doesn't have a valid HEAD, as in such a case
remote_head is NULL, but we still tried to access it.

Reported-by: Devin Cofer <redacted>
Signed-off-by: Björn Steinbrink <redacted>
Acked-by: Jeff King <redacted>

Thanks.

When splitting remote_head versus our_head, I tried to find every use of
the remote head and pick the appropriate variable, but I think I just
missed this one. I gave the code another once-over and didn't see any
other spots that needed fixing.

-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