Skip to content

fix(cli): make lfsx gc fetch every ref and refuse clones that cannot see them - #652

Merged
BryanFRD merged 2 commits into
mainfrom
fix/gc-refs-safety
Oct 16, 2026
Merged

BryanFRD merged 2 commits into
mainfrom
fix/gc-refs-safety

Conversation

@BryanFRD

Copy link
Copy Markdown
Contributor

Closes #599

lfsx gc built its keep list from whatever the local clone happened to hold. Now it:

  • fetches all branches and tags (pruned) from origin first
  • fetches refs/pull/* and refs/merge-requests/* into refs/lfsx/ by default, --no-review-refs opts out
  • refuses a clone whose remote.origin.fetch is not a wildcard over refs/heads/*
  • reads --url and --repo from git config lfs.url when not given (--url/LFSX_URL is now optional for gc only), and refuses a mismatch with the clone
  • keeps the shallow-clone refusal

Behaviour change on a destructive command: runs that used to proceed now refuse (single-branch clone, --url/--repo not matching lfs.url), and gc now runs git fetch against origin. Not breaking for valid setups, so no !.

docs/reclaiming-space.md gets the scheduled CI recipe (admin PAT passed as LFSX_TOKEN).

@BryanFRD
BryanFRD enabled auto-merge (squash) October 16, 2026 11:16

@ferrfleet-interne ferrfleet-interne Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fetch, prune, shallow and single-branch handling and its tests look right. One blocking issue: inferring and checking lfs.url ignores .lfsconfig, which is how the docs tell users to configure it (see inline).

Comment thread cli/src/gc.rs Outdated

@ferrfleet-interne ferrfleet-interne Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The .lfsconfig blocker is fixed in 18d2029. Nothing else blocking.

@BryanFRD
BryanFRD disabled auto-merge October 16, 2026 11:35

@ferrfleet-interne ferrfleet-interne Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rebased onto main. The PR's code is unchanged since my approval of 18d2029, and the Server::new call now matches #648. One stale doc line, see inline.

Comment thread docs/reclaiming-space.md Outdated
Co-authored-by: ferrfleet-interne[bot] <342363332+ferrfleet-interne[bot]@users.noreply.github.com>
@BryanFRD
BryanFRD enabled auto-merge (squash) October 16, 2026 11:39

@ferrfleet-interne ferrfleet-interne Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

8958f5a applies the LFSX_TOKEN doc nit. It only touches docs, and nothing is outstanding.

@BryanFRD
BryanFRD merged commit 030fe79 into main Oct 16, 2026
27 checks passed
@BryanFRD
BryanFRD deleted the fix/gc-refs-safety branch October 16, 2026 11:43
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.

lfsx gc can sweep objects that live branches still use

1 participant