git: include SHA1 in ref-less revisions #2982
Merged
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.
This pull request likely fixes an issue pointed out by @dalemyers in #2974:
The issue, I believe is related to invocations of
git-lfs-fetch(1)
that use a sha1 instead of a qualified reference name. For example:Code later in the command finds the attached
ref
by callinggit.ResolveRefs()
, and then usesref.Sha
throughout:git-lfs/commands/command_fetch.go
Line 87 in 1a98fa5
all the way down (via
fetchRef()
,pointerstoFetchForRef()
,lfs.GitScanner.ScanTree()
,lfs.runScanTree()
,lfs.lsTreeBlobs()
) togit.LsTree()
:git-lfs/git/git.go
Lines 223 to 232 in 1a98fa5
If
ref.Sha
is empty, Git will not be able to scan it:To ensure that Git LFS faithfully reports the Sha1 to scan, assign it when we parse a non-symbolic "reference". (While looking at this code, I noticed that the terminology in this part of the project is incorrect, but that will be for a later change).
/cc @git-lfs/core