Class: Git::FsckResult
- Inherits:
-
Object
- Object
- Git::FsckResult
- Defined in:
- lib/git/fsck_result.rb
Overview
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.
Instance Attribute Summary collapse
-
#dangling ⇒ Array<Git::FsckObject>
readonly
Objects not referenced by any other object.
-
#missing ⇒ Array<Git::FsckObject>
readonly
Objects that are referenced but not present in the repository.
-
#root ⇒ Array<Git::FsckObject>
readonly
Root nodes (commits with no parents) when --root is used.
-
#tagged ⇒ Array<Git::FsckObject>
readonly
Tagged objects when --tags is used.
-
#unreachable ⇒ Array<Git::FsckObject>
readonly
Objects not reachable from any ref.
-
#warnings ⇒ Array<Git::FsckObject>
readonly
Objects with warnings (each includes a message).
Instance Method Summary collapse
-
#all_objects ⇒ Array<Git::FsckObject>
Returns all objects from all categories (excluding informational root/tagged).
-
#any_issues? ⇒ Boolean
Returns true if any issues were found.
-
#count ⇒ Integer
Returns the total number of issues found.
-
#empty? ⇒ Boolean
Returns true if no issues were found.
-
#initialize(dangling: [], missing: [], unreachable: [], warnings: [], root: [], tagged: []) ⇒ FsckResult
constructor
Create a new FsckResult.
-
#to_h ⇒ Hash{Symbol => Array<Git::FsckObject>}
Returns a hash representation of the result.
Constructor Details
#initialize(dangling: [], missing: [], unreachable: [], warnings: [], root: [], tagged: []) ⇒ FsckResult
Create a new FsckResult
47 48 49 50 51 52 53 54 |
# 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 |
Instance Attribute Details
#dangling ⇒ Array<Git::FsckObject> (readonly)
Objects not referenced by any other object
14 15 16 |
# File 'lib/git/fsck_result.rb', line 14 def dangling @dangling end |
#missing ⇒ Array<Git::FsckObject> (readonly)
Objects that are referenced but not present in the repository
18 19 20 |
# File 'lib/git/fsck_result.rb', line 18 def missing @missing end |
#root ⇒ Array<Git::FsckObject> (readonly)
Root nodes (commits with no parents) when --root is used
30 31 32 |
# File 'lib/git/fsck_result.rb', line 30 def root @root end |
#tagged ⇒ Array<Git::FsckObject> (readonly)
Tagged objects when --tags is used
34 35 36 |
# File 'lib/git/fsck_result.rb', line 34 def tagged @tagged end |
#unreachable ⇒ Array<Git::FsckObject> (readonly)
Objects not reachable from any ref
22 23 24 |
# File 'lib/git/fsck_result.rb', line 22 def unreachable @unreachable end |
#warnings ⇒ Array<Git::FsckObject> (readonly)
Objects with warnings (each includes a message)
26 27 28 |
# File 'lib/git/fsck_result.rb', line 26 def warnings @warnings end |
Instance Method Details
#all_objects ⇒ Array<Git::FsckObject>
Returns all objects from all categories (excluding informational root/tagged)
90 91 92 |
# File 'lib/git/fsck_result.rb', line 90 def all_objects dangling + missing + unreachable + warnings end |
#any_issues? ⇒ Boolean
Returns true if any issues were found
66 67 68 |
# File 'lib/git/fsck_result.rb', line 66 def any_issues? [dangling, missing, unreachable, warnings].any?(&:any?) end |
#count ⇒ Integer
Returns the total number of issues found
102 103 104 |
# File 'lib/git/fsck_result.rb', line 102 def count all_objects.size end |
#empty? ⇒ Boolean
Returns true if no issues were found
78 79 80 |
# File 'lib/git/fsck_result.rb', line 78 def empty? !any_issues? end |
#to_h ⇒ Hash{Symbol => Array<Git::FsckObject>}
Returns a hash representation of the result
114 115 116 117 118 119 |
# File 'lib/git/fsck_result.rb', line 114 def to_h { dangling: dangling, missing: missing, unreachable: unreachable, warnings: warnings, root: root, tagged: tagged } end |