On Mon, Apr 05 2021, Derrick Stolee via GitGitGadget wrote: > This changes the names of the refs that would be fetched by the default > refspec. Instead of "refs/prefetch/<remote>/<branch>" they will now go > to "refs/prefetch/remotes/<remote>/<branch>". While this is a change, it > is not a seriously breaking one: these refs are intended to be hidden > and not used. Not "a seriously breaking one" just because we'll assume nobody had a remote they'd named "remotes" and they'll need to manually clean that mess up (if needed), or ...? > [...] > objects from all registered remotes. For each remote, a `git fetch` > command is run. The refmap is custom to avoid updating local or remote > branches (those in `refs/heads` or `refs/remotes`). Instead, the > - remote refs are stored in `refs/prefetch/<remote>/`. Also, tags are > - not updated. > + refs are stored in `refs/prefetch/`. Also, tags are not updated. So, "tags are not updated", but: > > - strvec_pushf(&child.args, "+refs/heads/*:refs/prefetch/%s/*", remote->name); > + for (i = 0; i < remote->fetch.nr; i++) { > + struct refspec_item replace; > + struct refspec_item *rsi = &remote->fetch.items[i]; > + struct strbuf new_dst = STRBUF_INIT; > + size_t ignore_len = 0; > + > + if (rsi->negative) { > + strvec_push(&child.args, remote->fetch.raw[i]); > + continue; > + } > + > + refspec_item_init(&replace, remote->fetch.raw[i], 1); > + > + /* > + * If a refspec dst starts with "refs/" at the start, > + * then we will replace "refs/" with "refs/prefetch/". > + * Otherwise, we will prepend the dst string with > + * "refs/prefetch/". > + */ > + if (!strncmp(replace.dst, "refs/", 5)) > + ignore_len = 5; > + > + strbuf_addstr(&new_dst, "refs/prefetch/"); > + strbuf_addstr(&new_dst, replace.dst + ignore_len); > + free(replace.dst); > + replace.dst = strbuf_detach(&new_dst, NULL); > + > + strvec_push(&child.args, refspec_item_format(&replace)); > + > + refspec_item_clear(&replace); > + } Isn't a blanket replacement of refs/heads/* with refs/* going to change that? I haven't tested this so maybe it still doesn't work, but: > GIT_TRACE2_EVENT="$(pwd)/run-prefetch.txt" git maintenance run --task=prefetch 2>/dev/null && > fetchargs="--prune --no-tags --no-write-fetch-head --recurse-submodules=no --refmap= --quiet" && > - test_subcommand git fetch remote1 $fetchargs +refs/heads/*:refs/prefetch/remote1/* <run-prefetch.txt && > - test_subcommand git fetch remote2 $fetchargs +refs/heads/*:refs/prefetch/remote2/* <run-prefetch.txt && > + test_subcommand git fetch remote1 $fetchargs +refs/heads/*:refs/prefetch/remotes/remote1/* <run-prefetch.txt && > + test_subcommand git fetch remote2 $fetchargs +refs/heads/*:refs/prefetch/remotes/remote2/* <run-prefetch.txt && > [...] > > + fetchargs="--prune --no-tags --no-write-fetch-head --recurse-submodules=no --refmap= --quiet" && It seems we should at least have a test for the case of having a refspec that pulls down tags. I suspect that we could document this as an absolute before, as refs/heads/* is the only namespace that'll refuse tags, but now that we fetch refs/<whatever> that'll no longer be the case. I'd think that this new behavior (if I'm right) is a feature, but that we need to update the docs/tests appropriately.