Listen to this story
|
The open-source Git project unveiled Git 2.4, incorporating contributions from 95 contributors, 29 of whom are new. This update introduces various features and bug fixes.
Read more: Top 9 GitHub repositories for the TensorFlow community
Efficient Handling of Unreachable Objects
The handling of unreachable objects in Git repositories has been improved to enhance performance and reduce repository size. Objects in Git can be either “reachable” or “unreachable.” Reachable objects are those that can be accessed by following a branch or tag in the repository’s history. Unreachable objects are not reachable through any branch or tag.
Git periodically removes unreachable objects to compress the repository size. When running the git gc command, Git collects reachable objects into a pack, stores recently written unreachable objects separately, and discards the remaining unreachable objects. Previously, Git stored unreachable objects as loose copies, which could lead to repository bloat and inode exhaustion.
In Git 2.41, cruft pack generation is enabled by default during regular git gc operations. This means that a cruft pack will be generated in the repository, providing the benefits mentioned above. To learn more about cruft packs and their impact on Git’s garbage collection, you can refer to the previous post titled “Scaling Git’s garbage collection.”
Read more: Why Indian IT Prefers CodeNet over GitHub Copilot
On-Disk Reverse Indexes for Improved Performance
Starting from Git 2.41, a new “.rev” file will be present in the repository’s “.git/objects/pack” directory. This file stores information similar to the packfile index (stored in “.idx” files). Pack indexes map object positions in name order and pack order.
Previously, the reverse index was generated on-the-fly, but Git 2.31 introduced an on-disk reverse index. It generates and stores the reverse index alongside the packfile as a “*.rev” file. This pre-computed reverse index improves performance, especially in large repositories, for operations like pushing changes and determining object sizes.
In Git 2.41, reverse index generation is enabled by default. Running “git gc” after upgrading will result in faster operations. Tests have shown significant speed-ups, with improvements of up to 1.49x in pushing changes and nearly 77x in computing object sizes.
Read more: Rust Turns GitHub’s Long-standing Problem to Dust