mbox series

[0/2] builtin/receive-pack: convert to use git-maintenance(1)

Message ID cover.1713334241.git.ps@pks.im (mailing list archive)
Headers show
Series builtin/receive-pack: convert to use git-maintenance(1) | expand

Message

Patrick Steinhardt April 17, 2024, 6:16 a.m. UTC
Hi,

this small patch series adapts git-receive-pack(1) to spawn `git
maintenance run --auto` instead of `git gc --auto` like all the other
parts of our codebase do nowadays. This removes the last internal user
of `git gc --auto`.

Patrick

Patrick Steinhardt (2):
  run-command: introduce function to prepare auto-maintenance process
  builtin/receive-pack: convert to use git-maintenance(1)

 Documentation/config/receive.txt |  2 +-
 builtin/receive-pack.c           | 21 ++++++++++-----------
 run-command.c                    | 19 +++++++++++++------
 run-command.h                    |  7 +++++++
 4 files changed, 31 insertions(+), 18 deletions(-)

Comments

Karthik Nayak April 17, 2024, 4:19 p.m. UTC | #1
Patrick Steinhardt <ps@pks.im> writes:

> Hi,
>
> this small patch series adapts git-receive-pack(1) to spawn `git
> maintenance run --auto` instead of `git gc --auto` like all the other
> parts of our codebase do nowadays. This removes the last internal user
> of `git gc --auto`.
>

I don't have enough context here, so why do this?
Junio C Hamano April 17, 2024, 4:53 p.m. UTC | #2
Karthik Nayak <karthik.188@gmail.com> writes:

>> this small patch series adapts git-receive-pack(1) to spawn `git
>> maintenance run --auto` instead of `git gc --auto` like all the other
>> parts of our codebase do nowadays. This removes the last internal user
>> of `git gc --auto`.
>
> I don't have enough context here, so why do this?

I think the intent of a95ce124 (maintenance: replace run_auto_gc(),
2020-09-17) was to update all codepaths that run "git gc --auto" to
instead run "git maintenance --auto", but only updated the ones that
used to call run_auto_gc().  The codepath Patrick found runs "git gc
--auto" without using run_auto_gc() and was left behind when the
others were converted.

So why do this?  I think "To follow through a95ce124 started" would
probably be a good enough reason, if a reader is on board with what
a95ce124 wanted to do.

Do we have a handy reference that compares "gc --auto" and
"maintenance --auto"?  Are they essentially the same thing these
days?  What are the things that is done by one but not by the other?

THanks.
Patrick Steinhardt April 18, 2024, 5:43 a.m. UTC | #3
On Wed, Apr 17, 2024 at 09:53:58AM -0700, Junio C Hamano wrote:
> Karthik Nayak <karthik.188@gmail.com> writes:
> 
> >> this small patch series adapts git-receive-pack(1) to spawn `git
> >> maintenance run --auto` instead of `git gc --auto` like all the other
> >> parts of our codebase do nowadays. This removes the last internal user
> >> of `git gc --auto`.
> >
> > I don't have enough context here, so why do this?

Fair enough, I was a bit lazy with the cover letter as I thought that
the second patch already explains it well enough. But true, I should've
set the stage a bit better.

> I think the intent of a95ce124 (maintenance: replace run_auto_gc(),
> 2020-09-17) was to update all codepaths that run "git gc --auto" to
> instead run "git maintenance --auto", but only updated the ones that
> used to call run_auto_gc().  The codepath Patrick found runs "git gc
> --auto" without using run_auto_gc() and was left behind when the
> others were converted.

Yup, that was triggered this patch series. I was puzzled that we still
run `git gc --auto` at all.

> So why do this?  I think "To follow through a95ce124 started" would
> probably be a good enough reason, if a reader is on board with what
> a95ce124 wanted to do.
> 
> Do we have a handy reference that compares "gc --auto" and
> "maintenance --auto"?  Are they essentially the same thing these
> days?  What are the things that is done by one but not by the other?

git-maintenance(1) is a superset of what git-gc(1) does. It is
structured around different "tasks" that the user can enable or disable
at a whim. By default, only a single "gc" task is enabled, which makes
it a drop-in replacement for what we had before the conversion.

But users can ask git-maintenance(1) to perform housekeeping to their
will. Instead of running git-gc(1), they can configure indididual tasks
to repack objects via multi-pack indices, pack only loose objects,
update the commit-graph or repack references.

So overall, git-maintenance(1) is the modern and more flexible
replacement for git-gc(1) that gives more tuning knobs.

Patrick