How github/git-sizer works
Project type and purpose
• This is an open-source, command-line tool (“git-sizer”) written in Go. Its sole purpose is to analyze a local Git repository, compute size-related metrics (commits, trees, blobs, refs, checkouts, etc.), and flag potential scaling problems.
File structure
• Top-level:
• git-sizer.go: entry point (package main)
• go.mod, go.sum: module definitions
• Makefile, scripts/: build, test, release
• .github/: CI workflows (lint, test, release)
• Core packages:
• git/: wrappers for invoking Git and iterating objects (commit, tree, blob, refs)
• counts/: generic counters and “human” formatters for simple metrics
• sizes/: complex size analyzers (footnotes, graphs, grouping)
• meter/: progress reporting / throughput metering
• internal/refopts/: logic for filtering refs, grouping options
• Tests are collocated in each package (e.g., counts_test.go, gitconfig_test.go).
• docs/: BUILDING, RELEASING guidelines.
README for additional insights
• Describes the workflow: invoke git-sizer CLI → runs underlying git commands → processes objects → outputs tabular or JSON metrics.
Detailed capture of essential elements
• Tests and docs as side-components feeding into CI.
• Do not overcrowd: keep each package/component distinct.