Repository navigation
fix(tooling): push Git LFS objects from the shared pre-push hook - #61
Merged
Merged
Conversation
A repository that stores files with Git LFS had to add git lfs pre-push to its own .githooks/pre-push, because the shared hook replaced the one git lfs install writes. The website did, so its stub differs from the standard's and would lose the step if owned hooks were ever restored. The shared hook now keeps the refs Git passes on standard input and, after pnpm check passes, runs git lfs pre-push with them when git-lfs is installed and .gitattributes has a filter=lfs rule. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Publish Git LFS support in the shared pre-push hook as a patch release of the shared web standard. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
TL;DR
A repository that stores files with Git LFS can use the standard's pre-push hook unchanged: the
shared hook now uploads LFS objects with the push, after
pnpm checkpasses. Fixes #58.Overview of Changes
Why
The website stores images with Git LFS. Our hooks replace the one
git lfs installwrites, so thewebsite kept its own
git lfs pre-pushstep below the shared line in.githooks/pre-push. Thatmakes its copy of a standard-owned file differ, and v0.5.0 already warns about it. v0.6.0 plans to
restore owned files to the standard's copies, which would have silently dropped the LFS step and
let pushes go out without their objects.
How
Git passes the refs being pushed on standard input. The shared hook now keeps them, runs
pnpm checkas before, and then, ifgit-lfsis installed and.gitattributeshas afilter=lfsrule, pipes them to
git lfs pre-pushwith the hook's arguments. A repository without LFS sees nodifference.
A question for v0.6.0
The example's hook stubs say repository-specific steps go below the shared line, which conflicts
with treating the hooks as owned files. LFS was the only such step in use. Before v0.6.0 enforces
hook ownership, the stubs' wording has to change or the hooks come off the owned list; I noted this
on #58.
Testing
pnpm checkpasses. A new hook test runs the shared hook in a scratch repository with a fakepnpmandgit-lfs. It shows that nothing is uploaded without an LFS rule. With a rule, the checkruns first and
git lfs pre-pushreceives the remote, the URL, and the refs from standard input.ShellCheck passes on the hook.
Follow-ups
🤖 Generated with Claude Code