path: root/remote-curl.c
diff options
authorBjörn Steinbrink <>2009-10-13 22:11:09 (GMT)
committerJunio C Hamano <>2009-10-14 08:19:15 (GMT)
commitd01a8e32fe10f1086e5e427f85237baff218fb01 (patch)
tree4e5977b6d6487dcaf58add28d06dedbda342c3b7 /remote-curl.c
parentc6dfb399448f6de17ce417052f1bb345c9e022c9 (diff)
clone: Supply the right commit hash to post-checkout when -b is used
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 <> Signed-off-by: Björn Steinbrink <> Acked-by: Jeff King <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'remote-curl.c')
1 files changed, 1 insertions, 0 deletions
diff --git a/remote-curl.c b/remote-curl.c
index d8d276a..2faf1c6 100644
--- a/remote-curl.c
+++ b/remote-curl.c
@@ -3,6 +3,7 @@
#include "strbuf.h"
#include "walker.h"
#include "http.h"
+#include "exec_cmd.h"
static struct ref *get_refs(struct walker *walker, const char *url)