Re: [PATCH 00/21] Maintenance builtin, allowing 'gc --auto' customization
- From
Jeff King <peff@peff.net>
- Date
- Jul 9, 2020, 23:16 UTC
- Message-ID
- <20200709231624.GE664420@coredump.intra.peff.net>
- In-Reply-To
- <d0d30dab-7883-199a-3beb-48c87cde3550@gmail.com>
On Thu, Jul 09, 2020 at 08:43:48AM -0400, Derrick Stolee wrote:
Show 15 quoted lines
> >> Is it infeasible to ask for 'git maintenance' to learn something like > >> '--on /<path-to-repo> --on /<path-to-second-repo>'? Or better yet, some > >> config like "maintenance.targetRepo = /<path-to-repo>"? > > Sorry that I missed this comment on my first reply. > > The intention is that this cron entry will be simpler after I follow up > with the "background" part of maintenance. The idea is to use global > or system config to register a list of repositories that want background > maintenance and have cron execute something like "git maintenance run --all-repos" > to span "git -C <repo> maintenance run --scheduled" for all repos in > the config. > > For now, this manual setup does end up a bit cluttered if you have a > lot of repos to maintain.
I think it might be useful to have a general command to run a subcommand in a bunch of repositories. Something like:
git for-each-repo --recurse /path/to/repos git maintenance ...
which would root around in /path/to/repos for any git-dirs and run "git --git-dir=$GIT_DIR maintenance ..." on each of them.
And/or:
git for-each-repo --config maintenance.repos git maintenance ...
which would pull the set of repos from the named config variable instead of looking around the filesystem.
You could use either as a one-liner in the crontab (depending on which is easier with your repo layout).
-Peff