Module: Git::Repository::Maintenance
- Included in:
- Git::Repository
- Defined in:
- lib/git/repository/maintenance.rb
Overview
Facade methods for repository maintenance and optimization operations
These methods pack objects, compress history, prune unreachable objects, and otherwise keep the repository in good health.
Included by Git::Repository.
Instance Method Summary collapse
-
#gc ⇒ String
Run garbage collection to optimize and clean up the repository.
-
#repack ⇒ String
Repack loose objects into pack files.
Instance Method Details
#gc ⇒ String
Run garbage collection to optimize and clean up the repository
Runs git gc to perform housekeeping tasks including object compression,
pruning of unreachable objects, and ref packing. This is equivalent to
running git gc --prune --aggressive --auto.
This method uses the fixed options prune: true, aggressive: true, auto: true
(matching the 4.x behavior). No additional options are exposed.
60 61 62 |
# File 'lib/git/repository/maintenance.rb', line 60 def gc Git::Commands::Gc.new(@execution_context).call(prune: true, aggressive: true, auto: true).stdout end |
#repack ⇒ String
Repack loose objects into pack files
Packs all unpacked objects and removes redundant pack files. This is
equivalent to running git repack -a -d, which packs all objects into a
single pack and deletes any packs that become redundant.
This method uses the fixed options a: true, d: true (matching the 4.x
behavior). No additional options are exposed.
37 38 39 |
# File 'lib/git/repository/maintenance.rb', line 37 def repack Git::Commands::Repack.new(@execution_context).call(a: true, d: true).stdout end |