should git maintenance prefetch be taught to honor remote.fetch refspec?
From: Tom Saeger <hidden>
Date: 2021-04-01 18:53:00
I've recently setup git maintenance and noticed prefetch task
fetches ALL remote refs (well not tags) and does not honor
remote fetch config settings.
Details:
# narrowed set of remote refs produced by `git fetch --all --prune`
$ git show-ref | grep "refs/remotes/" | wc -l
81
# git maintenance prefetch refs
$ git show-ref | grep "refs/prefetch/" | wc -l
262
# git worktree with 7 remotes
$ git remote | wc -l
7
# some remotes configured to fetch narrowed set of remote refs
$ git config --local --list | grep ".fetch=" | wc -l
11
# concrete example of remote fetch config
$ git config --local --list | grep "stable.fetch="
remote.stable.fetch=+refs/heads/linux-4.14.y:refs/remotes/stable/linux-4.14.y
remote.stable.fetch=+refs/heads/linux-5.4.y:refs/remotes/stable/linux-5.4.y
Should git maintenance prefetch task be taught to honor remote fetch config settings?
Something equivalent to:
git config --local --list \
| sed -ne '/remote\..*fetch=/{s#refs/remotes/#refs/prefetch/#;s#^remote\.\([^\.]\+\)\.fetch=#\1 #;p;};' \
| while read -r remote refspec ; do
git fetch ${remote} --prune --no-tags --no-write-fetch-head --recurse-submodules=no --refmap= --quiet ${refspec};
done
Regards,
--Tom