Class: Git::Commands::Fsck Private

Inherits:
Base
  • Object
show all
Defined in:
lib/git/commands/fsck.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-fsck/2.53.0

Implements the git fsck command

Verifies the connectivity and validity of objects in the database. It checks the integrity of the repository, reporting any dangling, missing, or unreachable objects.

Examples:

Typical usage

fsck = Git::Commands::Fsck.new(execution_context)
fsck.call
fsck.call('abc1234', 'def5678')
fsck.call(unreachable: true, strict: true)
fsck.call(no_dangling: true)

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(*object, **options) ⇒ Git::CommandLineResult

Execute the git fsck command

Parameters:

  • object (Array<String>)

    zero or more object identifiers to check

    When none are given, git fsck defaults to using the index file and all references as heads.

  • options (Hash)

    command options

Options Hash (**options):

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

    report tags

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

    report root nodes

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

    print out objects that exist but are not reachable from any of the reference nodes

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

    consider any object recorded in the index also as a head node for reachability

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

    do not consider commits referenced only by reflogs to be reachable

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

    check not just objects in GIT_OBJECT_DIRECTORY but also those in alternate object pools and packed archives (--full)

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

    skip checking alternate object pools and packed archives (--no-full)

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

    enable more strict checking, catching files with g+w bits set

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

    be chatty

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

    write dangling objects into .git/lost-found/commit/ or .git/lost-found/other/

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

    print dangling objects (--dangling)

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

    suppress dangling object reporting (--no-dangling)

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

    show progress status on standard error (--progress)

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

    suppress progress output when attached to a terminal (--no-progress)

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

    check only the connectivity of reachable objects; faster but does not validate blob content

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

    show the name of each reachable object alongside its identifier (--name-objects)

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

    suppress object name display (--no-name-objects)

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

    check reference database consistency via git refs verify (--references)

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

    skip reference checking (--no-references)

Returns:

Raises:

  • (ArgumentError)

    if unsupported options are provided

  • (Git::FailedError)

    if git exits outside the allowed range (exit code > 7)



# File 'lib/git/commands/fsck.rb', line 58