Repository navigation
Skip bare git repositories, CVS and _darcs when scanning [patch] - #205
Merged
Merged
Conversation
A bare repository keeps HEAD, objects/ and refs/ directly in a folder of any name, so the .git name check missed it and Deduplicate deleted one of two branch refs at the same commit. Recognise a gitdir by that structure, and add CVS and _darcs to the skipped metadata names. Fixes #198 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017vfJW2ncKULZZ8pQtc75wf
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017vfJW2ncKULZZ8pQtc75wf
|
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.



Fixes #198
What was wrong
The #192 fix skipped version-control metadata by directory name only. A bare git repository (
project.giton a server,git clone --mirroroutput, the bare-dotfiles~/.cfg) keepsHEAD,objects/andrefs/directly in a folder of any name. Two branches at the same commit are byte-identical ref files, soDeduplicatedeleted one of them and left the repository without a validHEAD. CVS checkouts had a similar problem, because everyCVS/RootandCVS/Repositoryfile is identical.Change
FileScanner.ShouldRecursePredicatenow also refuses to descend into a directory that is a git directory by structure: aHEADfile next toobjects/andrefs/directories, which is the test git itself uses for a gitdir. The check runs once per directory.CVSand_darcsare added to the skipped metadata names.Tests
TheScanSkipsABareGitRepositoryWhateverItsName(srv/project.git,mirror,.cfg) andDeduplicateLeavesTheBranchesOfABareRepositoryAlone, which is the issue's reproduction run end to end.TheScanStillReadsAFolderThatHasOnlyPartOfAGitDirectoryLayout: anotes.gitfolder withHEADandrefs/but noobjects/is still scanned. The existingmirror.git/HEADcase also still passes.CVSand_darcsrows added toTheScanSkipsVersionControlMetadataDirectories.FileScanner.cschange reverted, those 6 tests fail. With it in place, the full suite passes: 125 passed, 3 skipped. The 3 skips are the existing permission tests, which can't be set up when running as root.Generated by Claude Code