Add support for git repositories using reftable backend #1481
+524
−1
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
Fixes support for git repositories using the reftable backend format, which was introduced in git 2.37 and is expected to become the default in git 3.0.
Problem
When building projects in repositories cloned with
git clone --ref-format reftable, SourceLink would fail with:This occurred because:
refstorageextension was not recognized as a known git extension.git/reftable/instead of.git/refs/or.git/packed-refs)Solution
This PR implements full support for the reftable format as specified in the git reftable documentation:
1. Extension Recognition
Added
refstorageto the list of known repository extensions inGitRepository.cs, allowing repositories with this extension to be opened without errors.2. Reftable Format Reader
Implemented a new
GitReftableReaderclass that:.reffiles from the.git/reftable/directory3. Reference Resolution Integration
Updated
GitReferenceResolverto check for reftable references first, with graceful fallback:.git/reftable/(if present).git/packed-refs(traditional format).git/refs/(loose refs)This ensures full backward compatibility with existing repositories while adding support for the new format.
Testing
Added comprehensive unit tests:
refstorageis acceptedCompatibility
Implementation Notes
The implementation handles the essential parts of the reftable specification needed for reference resolution:
Advanced features not required for basic operation (index blocks, CRC validation, SHA-256 support) are not implemented but can be added in the future if needed.
Closes #[issue_number]
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
st8vsblobprodcus339.vsblob.vsassets.io/home/REDACTED/work/sourcelink/sourcelink/.dotnet/dotnet msbuild /m /nologo /clp:Summary /v:minimal /nr:true /warnaserror /p:TreatWarningsAsErrors=true /p:ContinuousIntegrationBuild=false /home/REDACTED/work/sourcelink/sourcelink/artifacts/toolset/restore.proj /t:__WriteToolsetLocation /clp:ErrorsOnly;NoSummary /p:__ToolsetLocationOutputFile=/home/REDACTED/work/sourcelink/sourcelink/artifacts/toolset/10.0.0-beta.25479.115.txt(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
Fixes #1470
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.