Class: Git::Commands::Maintenance::Run Private

Inherits:
Base
  • Object
show all
Defined in:
lib/git/commands/maintenance/run.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Note:

arguments block audited against https://git-scm.com/docs/git-maintenance/2.54.0

Run one or more maintenance tasks

Examples:

Run all enabled maintenance tasks

Git::Commands::Maintenance::Run.new(execution_context).call

Run specific tasks in order

Git::Commands::Maintenance::Run.new(execution_context).call(task: ['gc', 'commit-graph'])

Run tasks only if thresholds are met

Git::Commands::Maintenance::Run.new(execution_context).call(auto: true)

Run scheduled tasks at a specific frequency

Git::Commands::Maintenance::Run.new(execution_context).call(schedule: 'hourly')

See Also:

Instance Method Summary collapse

Methods inherited from Base

allow_exit_status, arguments, #initialize, requires_git_version, skip_version_validation

Constructor Details

This class inherits a constructor from Git::Commands::Base

Instance Method Details

#call(**options) ⇒ Git::CommandLineResult

Run one or more maintenance tasks

Parameters:

  • options (Hash)

    command options

Options Hash (**options):

  • :auto (Boolean, nil) — default: nil

    run tasks only if thresholds are met (--auto)

    Not compatible with the :schedule option.

  • :no_auto (Boolean, nil) — default: nil

    disable threshold-based execution (--no-auto)

  • :detach (Boolean, nil) — default: nil

    detach the maintenance process from the current terminal (--detach)

  • :no_detach (Boolean, nil) — default: nil

    do not detach the maintenance process (--no-detach)

  • :scheduled (Boolean, nil) — default: nil

    run tasks that are due according to schedule config (--scheduled)

  • :no_scheduled (Boolean, nil) — default: nil

    do not limit runs to scheduled tasks (--no-scheduled)

  • :schedule (Boolean, String, nil) — default: nil

    run tasks only if time conditions are met (--schedule)

    When a String ('hourly', 'daily', or 'weekly'), runs only tasks scheduled for that frequency; the string is emitted as --schedule=<frequency>.

  • :no_schedule (Boolean, nil) — default: nil

    disable schedule-based filtering (--no-schedule)

  • :quiet (Boolean, nil) — default: nil

    suppress progress and informational messages (--quiet)

  • :no_quiet (Boolean, nil) — default: nil

    enable progress and informational messages (--no-quiet)

  • :task (Array<String>, String) — default: nil

    specify which task(s) to run

    If specified, only the given tasks are run in the specified order. Otherwise, tasks are determined by config options. Valid task names: commit-graph, prefetch, gc, loose-objects, incremental-repack, pack-refs, reflog-expire, rerere-gc, worktree-prune.

  • :env (Hash) — default: nil

    environment variables to set for the git process; merged with the default environment; not passed to the git CLI

Returns:

Raises:

  • (ArgumentError)

    if unsupported options are provided

  • (Git::FailedError)

    if git exits with a non-zero exit status

  • (Git::VersionError)

    if git version is below 2.30.0



# File 'lib/git/commands/maintenance/run.rb', line 46