class Git::FsckResult
Represents the result of running โgit fsck`
This class provides structured access to the objects found during a repository integrity check, categorized by their status.
@api public
Attributes
Objects not referenced by any other object @return [Array<Git::FsckObject>]
Objects that are referenced but not present in the repository @return [Array<Git::FsckObject>]
Root nodes (commits with no parents) when โroot is used @return [Array<Git::FsckObject>]
Tagged objects when โtags is used @return [Array<Git::FsckObject>]
Objects not reachable from any ref @return [Array<Git::FsckObject>]
Objects with warnings (each includes a message) @return [Array<Git::FsckObject>]
Public Class Methods
Source
# File lib/git/fsck_result.rb, line 47 def initialize(dangling: [], missing: [], unreachable: [], warnings: [], root: [], tagged: []) @dangling = dangling @missing = missing @unreachable = unreachable @warnings = warnings @root = root @tagged = tagged end
Create a new FsckResult
@param dangling [Array<Git::FsckObject>] dangling objects @param missing [Array<Git::FsckObject>] missing objects @param unreachable [Array<Git::FsckObject>] unreachable objects @param warnings [Array<Git::FsckObject>] objects with warnings @param root [Array<Git::FsckObject>] root nodes @param tagged [Array<Git::FsckObject>] tagged objects
Public Instance Methods
Source
# File lib/git/fsck_result.rb, line 90 def all_objects dangling + missing + unreachable + warnings end
Returns all objects from all categories (excluding informational root/tagged)
@return [Array<Git::FsckObject>]
@example
result = git.fsck result.all_objects.each { |obj| puts obj.sha }
Source
# File lib/git/fsck_result.rb, line 66 def any_issues? [dangling, missing, unreachable, warnings].any?(&:any?) end
Returns true if any issues were found
@return [Boolean]
@example
result = git.fsck puts "Repository has issues!" if result.any_issues?
Source
# File lib/git/fsck_result.rb, line 102 def count all_objects.size end
Returns the total number of issues found
@return [Integer]
@example
result = git.fsck puts "Found #{result.count} issues"
Source
# File lib/git/fsck_result.rb, line 78 def empty? !any_issues? end
Returns true if no issues were found
@return [Boolean]
@example
result = git.fsck puts "Repository is clean" if result.empty?
Source
# File lib/git/fsck_result.rb, line 114 def to_h { dangling: dangling, missing: missing, unreachable: unreachable, warnings: warnings, root: root, tagged: tagged } end
Returns a hash representation of the result
@return [Hash{Symbol => Array<Git::FsckObject>}]
@example
result = git.fsck result.to_h # => { dangling: [...], missing: [...], ... }