Message ID | bdd5c664cde070a93d7e698aff2ab11ce7557ee2.1645641063.git.gitgitgadget@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Bundle URIs | expand |
On Wed, Feb 23 2022, Derrick Stolee via GitGitGadget wrote: > From: Derrick Stolee <derrickstolee@github.com> > [...] > @@ -460,6 +463,10 @@ static int cmd_bundle_fetch(int argc, const char **argv, const char *prefix) > (!info->filter_str || strcasecmp(filter, info->filter_str))) > continue; > > + old_uri = info->uri; > + info->uri = relative_url(bundle_uri, info->uri, NULL); > + free(old_uri); > + I had it on my TODO to look into how to do this, and hadn't dug yet, it's really pleasing that we have an API to make it this simple.
diff --git a/builtin/bundle.c b/builtin/bundle.c index 27da5e3737f..ec969a62ae1 100644 --- a/builtin/bundle.c +++ b/builtin/bundle.c @@ -10,6 +10,7 @@ #include "config.h" #include "packfile.h" #include "list-objects-filter-options.h" +#include "remote.h" /* * Basic handler for bundle files to connect repositories via sneakernet. @@ -453,6 +454,8 @@ static int cmd_bundle_fetch(int argc, const char **argv, const char *prefix) /* initialize stack using timestamp heuristic. */ hashmap_for_each_entry(&toc, &iter, info, ent) { + char *old_uri; + /* Skip if filter does not match. */ if (!filter && info->filter_str) continue; @@ -460,6 +463,10 @@ static int cmd_bundle_fetch(int argc, const char **argv, const char *prefix) (!info->filter_str || strcasecmp(filter, info->filter_str))) continue; + old_uri = info->uri; + info->uri = relative_url(bundle_uri, info->uri, NULL); + free(old_uri); + /* * Now that the filter matches, start with the * bundle with largest timestamp.