remote: make guess_remote_head() use exact HEAD lookup if it is available
Our usual method for determining the ref pointed to by HEAD is to compare HEAD's sha1 to the sha1 of all refs, trying to find a unique match. However, some transports actually get to look at HEAD directly; we should make use of that information when it is available. Currently, only http remotes support this feature. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Jay Soffian <jaysoffian@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
bc14fac825
commit
fbb074c253
8
remote.c
8
remote.c
@ -1476,6 +1476,14 @@ struct ref *guess_remote_head(const struct ref *head,
|
||||
if (!head)
|
||||
return NULL;
|
||||
|
||||
/*
|
||||
* Some transports support directly peeking at
|
||||
* where HEAD points; if that is the case, then
|
||||
* we don't have to guess.
|
||||
*/
|
||||
if (head->symref)
|
||||
return copy_ref(find_ref_by_name(refs, head->symref));
|
||||
|
||||
/* If refs/heads/master could be right, it is. */
|
||||
if (!all) {
|
||||
r = find_ref_by_name(refs, "refs/heads/master");
|
||||
|
||||
Reference in New Issue
Block a user