Please sign in to comment.
remote-curl: auto-detect bundles when fetching refs
You can't currently fetch from a network bundle, like: git fetch http://example.com/foo.bundle This patch takes the first (and biggest) step towards that working: it auto-detects when fetching refs results in a bundle, and automatically spools the bundle to disk and fetches from it. There are a few important design decisions to note: 1. We auto-detect the bundle based on content, not based on a special token in the URL (like ending in ".bundle"). This lets the server side be flexible with its URLs (e.g., "http://example.com/bundle?repo=foo"). 2. When fetching refs, we don't actually fetch $URL, but start with $URL/info/refs, looking for smart or dumb http. Some servers, when file "foo.bundle" exists, will serve it to the client when "foo.bundle/info/refs" is requested. Therefore we may be "surprised" to receive a bundle when we thought we were just getting the list of refs, and need to handle it appropriately. 3. We spool the bundle to disk, and then run "index-pack --fix-thin" to create a packfile. That means we will momentarily use twice the size of the bundle in local disk space. Avoiding this would mean piping directly to "index-pack --fix-thin". However, if we want to be able to resume the transfer of the bundle after an interruption, then we need to save the bundle's pack. In theory a smart index-pack that was interrupted could write out its partial results along with a count of how many bytes it actually consumed (i.e., where to resume next time), and then pick up where it left off when fed the rest of the data. But index-pack isn't that smart yet, so let's start off with spooling. No tests yet, as apache is not one of the "surprising" servers from (2), and our test harness is based around that (though just with this patch, you can fetch from surprising servers like lighttpd).
- Loading branch information...