git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* "git maintenance" - detect status?
@ 2023-02-14 10:50 Tao Klerks
  2023-02-14 17:07 ` Derrick Stolee
  0 siblings, 1 reply; 2+ messages in thread
From: Tao Klerks @ 2023-02-14 10:50 UTC (permalink / raw)
  To: git

Hi folks,

I'm trying to understand how to expose "git maintenance" state to
users, and suspect I'm missing something:

I see in the doc (https://git-scm.com/docs/git-maintenance) that "git
maintenance start" does three things:
 * sets maintenance.auto = false in the current repo
 * registers the current repo into a --global maintenance.repo entry
 * starts the global schedule

Also see there that "undoing" this requires three separate steps:
 * "git maintenance stop" for the schedule
 * "git maintenance unregister" for the maintenance.repo entry
 * "git config --unset maintenance.auto to resume legacy maintenance

However, I can't figure out how to test the current state of
scheduling, from within git:
 * There's no config value representing "scheduling is enabled" (as
far as I can tell)
 * There's no "git maintenance" subcommand for "check on the
scheduling tasks" (as far as I can tell)

In principle I guess it's possible to check for the Task Scheduler
entries and their status in Windows, for example, but that sounds...
like relying on implementation details.

Is there any correct cross-platform way to detect the scheduling state?

Thanks,
Tao

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: "git maintenance" - detect status?
  2023-02-14 10:50 "git maintenance" - detect status? Tao Klerks
@ 2023-02-14 17:07 ` Derrick Stolee
  0 siblings, 0 replies; 2+ messages in thread
From: Derrick Stolee @ 2023-02-14 17:07 UTC (permalink / raw)
  To: Tao Klerks, git

On 2/14/2023 5:50 AM, Tao Klerks wrote:

> However, I can't figure out how to test the current state of
> scheduling, from within git:
>  * There's no config value representing "scheduling is enabled" (as
> far as I can tell)
>  * There's no "git maintenance" subcommand for "check on the
> scheduling tasks" (as far as I can tell)
> 
> In principle I guess it's possible to check for the Task Scheduler
> entries and their status in Windows, for example, but that sounds...
> like relying on implementation details.
> 
> Is there any correct cross-platform way to detect the scheduling state?

Not currently, but you do make a good point about the scheduler
being an implementation detail.

You're making a good case for a new subcommand like 'git maintenance
status' that would report these details. It could even be a three-
tiered result:

  $ git maintenance status
  global scheduler: on
  repository schedule: enabled
  foreground maintenance: disabled

...or something like that. Not sure how to properly describe the
maintenance.auto config option as anything other than "foreground
maintenance", even if it launches maintenance processes in the
background on most platforms.

Of course, it could be worth exploring more about the specific
schedule the repository is scheduled for. It could describe the
maintenance.strategy value that is assumed (if there is one) or
even break down the tasks that will be run on different cadences:

  $ git maintenance status
  global scheduler: on
  repository schedule: enabled
    strategy: incremental
    hourly: prefetch, commit-graph
    daily: incremental-repack
    weekly: pack-refs
  foreground maintenance: disabled

Finally, making this something machine-readable (say, key=value
lines or JSON output) could be valuable behind an argument.

These are all just "top of mind" thoughts when I read your
questions, so feel free to disregard any or all of it. Just
ideas to think about.

Thanks,
-Stolee

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-02-14 17:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-14 10:50 "git maintenance" - detect status? Tao Klerks
2023-02-14 17:07 ` Derrick Stolee

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).