-
Notifications
You must be signed in to change notification settings - Fork 160
Add --include-unreachable flag and related processing #141
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces a new flag, --include-unreachable, to optionally include unreachable objects when reporting repository statistics. Key changes include adding new fields for unreachable objects and .git directory size in the statistics structure, updating output formatting to display these new values, and implementing the processing logic (via git fsck and git cat‐file batch mode) to compute unreachable object stats.
Reviewed Changes
Copilot reviewed 6 out of 10 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
sizes/sizes.go | Added new fields to HistorySize for unreachable object stats and the .git directory size. |
sizes/output.go | Updated repository statistics output with a new section for unreachable objects and on-disk size. |
sizes/dirsize.go | Introduced a helper function to calculate the size of the .git directory. |
git/git.go | Added GetUnreachableStats and helper function to compute unreachable objects’ total size. |
git-sizer.go | Added --include-unreachable flag and integrated unreachable stats processing. |
CONTRIBUTING.md | Updated dependency installation instructions for Unix and Windows environments. |
Files not reviewed (4)
- Makefile.win: Language not supported
- script/bootstrap.ps1: Language not supported
- script/ensure-go-installed.ps1: Language not supported
- script/go.ps1: Language not supported
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…eit/git-sizer into Add-unreachable-objects
This PR adds a new flag to git-sizer,
--include-unreachable
, to include unreachable objects in the counts displayed in the output.Changes
It adds the following:
--include-unreachable
so that the new functionality only runs when requestedgit cat-file --batch-check
Considerations
Getting the uncompressed size of the unreachable objects means listing them and then running
git cat-file --batch-check
with each unreachable oid input tostdin
. This is, obviously, an O(n) operation, and that's why I've stuck it behind a new flag rather than including it in processing by default.For repos with a lot of unreachable objects, this will take some time to run.
Sample output
Here's an example of the output including the new section (at the bottom):