File tree Expand file tree Collapse file tree 1 file changed +12
-19
lines changed Expand file tree Collapse file tree 1 file changed +12
-19
lines changed Original file line number Diff line number Diff line change @@ -2004,29 +2004,22 @@ static void update_remote_info_refs(struct remote_lock *lock)
2004
2004
static int remote_exists (const char * path )
2005
2005
{
2006
2006
char * url = xmalloc (strlen (repo -> url ) + strlen (path ) + 1 );
2007
- struct active_request_slot * slot ;
2008
- struct slot_results results ;
2009
- int ret = -1 ;
2007
+ int ret ;
2010
2008
2011
2009
sprintf (url , "%s%s" , repo -> url , path );
2012
2010
2013
- slot = get_active_slot ();
2014
- slot -> results = & results ;
2015
- curl_easy_setopt (slot -> curl , CURLOPT_URL , url );
2016
- curl_easy_setopt (slot -> curl , CURLOPT_NOBODY , 1 );
2017
-
2018
- if (start_active_slot (slot )) {
2019
- run_active_slot (slot );
2020
- if (results .http_code == 404 )
2021
- ret = 0 ;
2022
- else if (results .curl_result == CURLE_OK )
2023
- ret = 1 ;
2024
- else
2025
- fprintf (stderr , "HEAD HTTP error %ld\n" , results .http_code );
2026
- } else {
2027
- fprintf (stderr , "Unable to start HEAD request\n" );
2011
+ switch (http_get_strbuf (url , NULL , 0 )) {
2012
+ case HTTP_OK :
2013
+ ret = 1 ;
2014
+ break ;
2015
+ case HTTP_MISSING_TARGET :
2016
+ ret = 0 ;
2017
+ break ;
2018
+ case HTTP_ERROR :
2019
+ http_error (url , HTTP_ERROR );
2020
+ default :
2021
+ ret = -1 ;
2028
2022
}
2029
-
2030
2023
free (url );
2031
2024
return ret ;
2032
2025
}
You can’t perform that action at this time.
0 commit comments