-
Notifications
You must be signed in to change notification settings - Fork 488
Fix git-lfs unnecessary hook installation #1416
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
yaegashi
wants to merge
2
commits into
devcontainers:main
Choose a base branch
from
yaegashi:fix-git-lfs-unnecessary-hook-installation
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
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
# Test for git-lfs behavior with repos that have no LFS files | ||
# This tests the fix for the issue where git lfs install was running unnecessarily | ||
|
||
# Optional: Import test library | ||
source dev-container-features-test-lib | ||
|
||
# Test that git-lfs is installed | ||
check "git-lfs version" git-lfs --version | ||
|
||
# Test the generated script exists | ||
check "pull script exists" test -f /usr/local/share/pull-git-lfs-artifacts.sh | ||
|
||
# We should already be in a git repository created by initializeCommand | ||
# Verify we're in a git repository | ||
check "in git repository" git rev-parse --is-inside-work-tree | ||
|
||
# Test that git lfs ls-files returns empty output | ||
check "git lfs ls-files returns empty output" test -z "$(git lfs ls-files 2>/dev/null)" | ||
|
||
# Verify no LFS hooks exist initially (the script should have already run during postCreateCommand) | ||
HOOKS_COUNT=$(find .git/hooks -type f ! -name '*.sample' | wc -l) | ||
check "no git hooks installed after postCreateCommand" test "$HOOKS_COUNT" -eq 0 | ||
|
||
# Double check: specifically look for the hooks that git lfs install would create | ||
check "no post-merge hook" test ! -f .git/hooks/post-merge | ||
check "no pre-push hook" test ! -f .git/hooks/pre-push | ||
check "no post-commit hook" test ! -f .git/hooks/post-commit | ||
check "no post-checkout hook" test ! -f .git/hooks/post-checkout | ||
|
||
# Report results | ||
reportResults |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,14 @@ | |
} | ||
} | ||
}, | ||
"noLfsFiles": { | ||
"image": "mcr.microsoft.com/devcontainers/base:ubuntu", | ||
"initializeCommand": "git init && git config user.email '[email protected]' && git config user.name 'Test User' && echo 'regular file content' > regular.txt && git add regular.txt && git commit -m 'Initial commit without LFS'", | ||
yaegashi marked this conversation as resolved.
Show resolved
Hide resolved
yaegashi marked this conversation as resolved.
Show resolved
Hide resolved
yaegashi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"remoteUser": "vscode", | ||
"features": { | ||
"git-lfs": {} | ||
} | ||
}, | ||
"use_github": { | ||
"image": "mcr.microsoft.com/devcontainers/base:ubuntu", | ||
"remoteUser": "vscode", | ||
|
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.
Uh oh!
There was an error while loading. Please reload this page.