-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Description
Describe the bug
We were trying to migrate a repo to git lfs which had a malformed local reference:
refs/head/some-description instead of refs/heads/some-description
After running git lfs migrate import everything that reference was ignored silently. Then when we tried to push it to the remote, it failed because we still have files larger than the size limit in that reference.
Root cause
In this part of the code
git-lfs/commands/command_migrate.go
Lines 193 to 213 in ee3088d
| for _, ref := range refs { | |
| switch ref.Type { | |
| case git.RefTypeLocalBranch, git.RefTypeLocalTag, | |
| git.RefTypeRemoteBranch: | |
| include = append(include, ref.Refspec()) | |
| case git.RefTypeOther: | |
| parts := strings.SplitN(ref.Refspec(), "/", 3) | |
| if len(parts) < 2 { | |
| continue | |
| } | |
| switch parts[1] { | |
| // The following are GitLab-, GitHub-, VSTS-, | |
| // and BitBucket-specific reference naming | |
| // conventions. | |
| case "merge-requests", "pull", "pull-requests": | |
| include = append(include, ref.Refspec()) | |
| } | |
| } | |
| } |
The reference was recognized as
RefTypeOther and got skipped because it doesn't fit the case "merge-requests", "pull", "pull-requests"
Questions
I understand this is more of an user issue that caused by crazy input but when we are trying to automate things and migrate code bases in batch, errors like this is very hard to debug.
Would be better to give some warnings on the refs that was ignored?
Also is there any concern to just try to migrate all the refs with RefTypeOther?