-
Notifications
You must be signed in to change notification settings - Fork 1k
Fix: Resolve git-lfs and husky hooks conflict in devcontainer setup #481
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
Open
aicodexp
wants to merge
19
commits into
microsoft:main
Choose a base branch
from
aicodexp:workaround-husky-git-lfs-devcontainer
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Fix: Resolve git-lfs and husky hooks conflict in devcontainer setup #481
aicodexp
wants to merge
19
commits into
microsoft:main
from
aicodexp:workaround-husky-git-lfs-devcontainer
+209
−8
Conversation
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
as it is redundant to git-lfs feature
'git lfs install' which sets the .git/hooks CAUTION: relies heavily on current implementation of https://github.com/devcontainers/features/blob/main/src/git-lfs/install.sh - an option like 'skipHooks' over there is an idea maybe
that as this will be set up properly using git lfs install
…and header extraction
to postCreateCommand
…sions in merge_hooks function
to ensure proper execution order with Husky
…-Husky integration script
@microsoft-github-policy-service agree |
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.
Problem
When starting the devcontainer, the setup fails due to a conflict between git-lfs and husky hooks:
Root Cause Analysis
The issue occurs because:
npm install
and setscore.hookspath
to.husky/_
Note: Reversing the execution order wouldn't solve the problem either. If git-lfs ran first and modified .git/hooks, husky would later change core.hookspath to .husky/_, effectively bypassing the git-lfs hooks and leaving git-lfs silently improperly configured.
Current Hook Structure
.husky/_/
that source.husky/_/h
h
script then calls any matching hook script in.husky/
if it existsSolution
This PR implements a controlled merge of git-lfs hooks with husky's hook system:
Implementation Details
The solution adds a custom script that:
Related Issues
git-lfs
typicode/husky#1431) - Similar conflict reported