Skip to content
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

git: get info from a 'bare' repo instead #487

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

TvdW
Copy link

@TvdW TvdW commented Aug 28, 2024

For git repositories you basically always pay the storage cost twice:
once for the tree in .git, once for the actual files being checked out.
Additionally, the tree in .git is compressed, so in many cases it can be
smaller than the actual files being checked out.

This commit updates Hound to optionally process git files from the
actual git files instead of the checked out tree.

For me, this saves a significant amount of disk space. Why does it
matter? Because I run hound on a laptop instead of a datacenter, and
space is limited. It does cost a few more CPU cycles, but that's fine by
me.

What kind of change does this PR introduce? (check at least one)

  • Bugfix
  • Feature
  • Code style update
  • Refactor
  • Build-related changes
  • Other, please describe:

The PR fulfills these requirements:

  • All tests are passing?
  • New/updated tests are included?
  • If any static assets have been updated, has ui/bindata.go been regenerated?
  • Are there doc blocks for functions that I updated/created?

If adding a new feature, the PR's description includes:

  • A convincing reason for adding this feature (to avoid wasting your time, it's best to open a suggestion issue first and wait for approval before working on it)

Other information:

I'm creating this as a draft PR because it's obviously not ready to be merged (missing tests), and I first want to know if the upstream project would even be interested in this (the go.mod diff is probably already a blocker...). If yes I'll happily expand on the PR a bit more, if not I'm also fine with that. This was quickly hacked up as a POC (and to stop my laptop from running out of disk space!)

This just shuffles some APIs around, no real changes other than adding
some indirection.
For git repositories you basically always pay the storage cost twice:
once for the tree in .git, once for the actual files being checked out.
Additionally, the tree in .git is compressed, so in many cases it can be
smaller than the actual files being checked out.

This commit updates Hound to optionally process git files from the
actual git files instead of the checked out tree.

For me, this saves a significant amount of disk space. Why does it
matter? Because I run hound on a laptop instead of a datacenter, and
space is limited. It does cost a few more CPU cycles, but that's fine by
me.
Code is simpler, faster, and we can get rid of ref detection (could
previously already have done that, just need to pull HEAD).
git doesn't really have a concept of a directory, only files, so we have
to figure them out ourselves. My previous code for that was a bit silly,
this one still is.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant