GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Add --include-unreachable flag and related processing by ScottArbeit · Pull Request #141 · github/git-sizer

Conversation

@ScottArbeit

@ScottArbeit ScottArbeit commented Apr 16, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

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:

  • A new command-line flag --include-unreachable so that the new functionality only runs when requested
  • Processing of each unreachable object using git cat-file --batch-check
  • Output of the count and uncompressed total size of unreachable objects in a new section in the output

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 to stdin. 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):

(5:53:24 PM) D:\Source\Grace>D:\Source\github\git-sizer\bin\git-sizer.exe -v --include-unreachable
Processing blobs: 2593
Processing trees: 1427
Processing commits: 207
Matching commits to trees: 207
Processing annotated tags: 1
Processing references: 7

| Name                         | Value     | Level of concern               |
| ---------------------------- | --------- | ------------------------------ |
| Repository statistics        |           |                                |
| * Commits                    |           |                                |
|   * Count                    |   207     |                                |
|   * Total size               |  72.4 KiB |                                |
| * Trees                      |           |                                |
|   * Count                    |  1.43 k   |                                |
|   * Total size               |   777 KiB |                                |
|   * Total tree entries       |  18.1 k   |                                |
| * Blobs                      |           |                                |
|   * Count                    |  2.59 k   |                                |
|   * Uncompressed total size  |  57.4 MiB |                                |
| * On-disk size               |           |                                |
|   * Compressed total size    |  2.74 MiB |                                |
| * Annotated tags             |           |                                |
|   * Count                    |     1     |                                |
| * References                 |           |                                |
|   * Count                    |     7     |                                |
|     * Branches               |     3     |                                |
|     * Tags                   |     1     |                                |
|     * Remote-tracking refs   |     3     |                                |
|                              |           |                                |
| Biggest objects              |           |                                |
| * Commits                    |           |                                |
|   * Maximum size         [1] |  1.51 KiB |                                |
|   * Maximum parents      [2] |     2     |                                |
| * Trees                      |           |                                |
|   * Maximum entries      [3] |    41     |                                |
| * Blobs                      |           |                                |
|   * Maximum size         [4] |   946 KiB |                                |
|                              |           |                                |
| History structure            |           |                                |
| * Maximum history depth      |   197     |                                |
| * Maximum tag depth      [5] |     1     |                                |
|                              |           |                                |
| Biggest checkouts            |           |                                |
| * Number of directories  [6] |    55     |                                |
| * Maximum path depth     [6] |     7     |                                |
| * Maximum path length    [6] |    72 B   |                                |
| * Number of files        [6] |   258     |                                |
| * Total size of files    [6] |  4.28 MiB |                                |
| * Number of symlinks         |     0     |                                |
| * Number of submodules       |     0     |                                |
|                              |           |                                |
| Unreachable objects          |           |                                |  <--- new output section
| * Blobs                      |           |                                |
|   * Count                    |    21     |                                |
|   * Uncompressed total size  |   428 KiB |                                |
| * Trees                      |           |                                |
|   * Count                    |    30     |                                |
|   * Total size               |  22.1 KiB |                                |
| * Commits                    |           |                                |
|   * Count                    |    18     |                                |
|   * Total size               |  5.30 KiB |                                |
| * Tags                       |           |                                |
|   * Count                    |     0     |                                |
|   * Total size               |     0 B   |                                |

_detailed refs redacted_

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Scott Arbeit added 9 commits March 31, 2025 23:55
Scott Arbeit
Adding support for contributing using Windows.
5bbde89
Scott Arbeit
Added compressed size and updated a few labels.
25b2390
Scott Arbeit
Updating CONTRIBUTING.md
ed44788
Scott Arbeit
Linter updates.
469485b
Scott Arbeit
More linter updates.
56839e5
Scott Arbeit
Linter updates.
5d3b4ab
Scott Arbeit
Simplified Makefile.win
f6a16d7
Scott Arbeit
Repaired tabs in makefile 🙄; added variable set in script.
5b50428
Scott Arbeit
Added --include-unreachable flag and related processing and output.
d9da39e
Copilot AI review requested due to automatic review settings April 16, 2025 01:15
@ScottArbeit
ScottArbeit requested a review from a team as a code owner April 16, 2025 01:15
Copilot AI reviewed Apr 16, 2025
View reviewed changes

Copilot AI left a comment

Copy link
Copy Markdown

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

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread git/git.go Resolved

Uh oh!

There was an error while loading. Please reload this page.

ScottArbeit and others added 5 commits April 15, 2025 18:23
@ScottArbeit
Update git/git.go
470d43e
Co-authored-by: Copilot <[email protected]>
Scott Arbeit
Fixed int32-int64 error.
13288f3
Scott Arbeit
Merge branch 'Add-unreachable-objects' of https://github.com/ScottArb…
146a800
…eit/git-sizer into Add-unreachable-objects
Scott Arbeit
Linter error fixes.
e284089
Scott Arbeit
Separated unreachable objects by type in the output.
99ec1bf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

Copilot code review Copilot
Copilot review effort
Applies to this pull request for everyone.Learn more about Copilot code review.
Copilot left review comments

At least 1 approving review is required to merge this pull request.

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@ScottArbeit
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.