Fix: replace git ls-files with glob-based file detection#19
Merged
Conversation
Remove dependency on `git ls-files` for auto-detecting target files. Use the doublestar glob library with a default pattern instead, which is simpler, does not require a git repository, and avoids potential hangs from shelling out to git. Also add cobra.NoArgs to check/run commands to reject unexpected positional arguments. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…try checks - Restore git ls-files for .gitignore support, filter results with defaultGlob pattern - Add glob-only fallback (skipping node_modules/vendor/.git) for non-git repos - Parallelize registry digest verification in check command with semaphore - Cache Exists() calls in CachedResolver for concurrent safety Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…on-git fallback Remove mutex in check.go since each goroutine exclusively owns its allResults[i] slot. Remove .git from skipDirs as doublestar glob already skips hidden directories. Update README to document non-git fallback behavior. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
… from default glob CachedResolver.Exists was incorrectly deriving the existence result from whether err was nil, ignoring the actual boolean returned by the inner resolver. This caused non-existent images to be cached as existing when no error occurred. Also removes the unused dockerfile_*.tmpl pattern from the default glob and updates README accordingly. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Handle errcheck: use `_, _ =` for cached.Exists in loop - Fix goimports formatting Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…cross-method interference Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Merged
azu
pushed a commit
that referenced
this pull request
Mar 31, 2026
<!-- Release notes generated using configuration in .github/release.yml at main --> ## What's Changed ### Bug Fixes * Fix: replace git ls-files with glob-based file detection by @azu in #19 **Full Changelog**: v1.0.3...v1.0.4 Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.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.
Summary
Replace the
git ls-filesbased auto-detection with a pure glob pattern using the doublestar library. This removes the dependency on being inside a git repository and eliminates potential hangs from shelling out to thegitcommand.Changes
isTargetFile()andfindFilesWithGit()functions that relied ongit ls-filesdefaultGlobconstant used when neither-fnor--globis specified--globand auto-detect now usedoublestar.FilepathGlobcobra.NoArgstocheckandruncommands to reject unexpected positional argumentsinitGitRepo/gitAddhelpers)Breaking Changes
.gitignoreis no longer respected in auto-detect mode (glob walks the filesystem directly)Test Plan
go test ./...to verify all tests passdockerfile-pin checkin a directory with Dockerfiles to verify auto-detection worksdockerfile-pin checkin a non-git directory to verify it works without git