Skip to content

Commit

Permalink
Merge branch 'maint'
Browse files Browse the repository at this point in the history
* maint:
  merge-recursive: do not return NULL only to cause segfault
  retry request without query when info/refs?query fails
  • Loading branch information
gitster committed Jan 22, 2010
2 parents b28a1ce + 19c6a4f commit 2d0d706
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
8 changes: 4 additions & 4 deletions merge-recursive.c
Expand Up @@ -202,14 +202,14 @@ struct tree *write_tree_from_memory(struct merge_options *o)

if (unmerged_cache()) {
int i;
output(o, 0, "There are unmerged index entries:");
fprintf(stderr, "BUG: There are unmerged index entries:\n");
for (i = 0; i < active_nr; i++) {
struct cache_entry *ce = active_cache[i];
if (ce_stage(ce))
output(o, 0, "%d %.*s", ce_stage(ce),
(int)ce_namelen(ce), ce->name);
fprintf(stderr, "BUG: %d %.*s", ce_stage(ce),
(int)ce_namelen(ce), ce->name);
}
return NULL;
die("Bug in merge-recursive.c");
}

if (!active_cache_tree)
Expand Down
18 changes: 16 additions & 2 deletions remote-curl.c
Expand Up @@ -102,7 +102,7 @@ static struct discovery* discover_refs(const char *service)
struct strbuf buffer = STRBUF_INIT;
struct discovery *last = last_discovery;
char *refs_url;
int http_ret, is_http = 0;
int http_ret, is_http = 0, proto_git_candidate = 1;

if (last && !strcmp(service, last->service))
return last;
Expand All @@ -121,6 +121,19 @@ static struct discovery* discover_refs(const char *service)

init_walker();
http_ret = http_get_strbuf(refs_url, &buffer, HTTP_NO_CACHE);

/* try again with "plain" url (no ? or & appended) */
if (http_ret != HTTP_OK) {
free(refs_url);
strbuf_reset(&buffer);

proto_git_candidate = 0;
strbuf_addf(&buffer, "%s/info/refs", url);
refs_url = strbuf_detach(&buffer, NULL);

http_ret = http_get_strbuf(refs_url, &buffer, HTTP_NO_CACHE);
}

switch (http_ret) {
case HTTP_OK:
break;
Expand All @@ -137,7 +150,8 @@ static struct discovery* discover_refs(const char *service)
last->buf_alloc = strbuf_detach(&buffer, &last->len);
last->buf = last->buf_alloc;

if (is_http && 5 <= last->len && last->buf[4] == '#') {
if (is_http && proto_git_candidate
&& 5 <= last->len && last->buf[4] == '#') {
/* smart HTTP response; validate that the service
* pkt-line matches our request.
*/
Expand Down

0 comments on commit 2d0d706

Please sign in to comment.