Skip to content

lfs migrate info panic #5332

@recih

Description

@recih

Describe the bug

# git lfs migrate info --everything --fixup
migrate: Sorting commits: ..., done.
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x28 pc=0x395287]

goroutine 1 [running]:
github.com/git-lfs/wildmatch/v2.(*Wildmatch).consume(0x0, {0xc0058b3200?, 0xc0002052c0?}, {0x98?})
        github.com/git-lfs/wildmatch/[email protected]/wildmatch.go:267 +0x27
github.com/git-lfs/wildmatch/v2.(*Wildmatch).Match(...)
        github.com/git-lfs/wildmatch/[email protected]/wildmatch.go:248
github.com/git-lfs/git-lfs/v3/git/gitattr.(*Tree).Applied(0xc000205180, {0xc0058b3200, 0x22})
        github.com/git-lfs/git-lfs/v3/git/gitattr/tree.go:95 +0xc5
github.com/git-lfs/git-lfs/v3/commands.migrateInfoCommand.func1({0xc0058b3200, 0x22}, 0xc0002052c0)
        github.com/git-lfs/git-lfs/v3/commands/command_migrate_info.go:131 +0xa5
github.com/git-lfs/git-lfs/v3/git/githistory.(*Rewriter).rewriteBlob(0xc00013e4e0, {0xc000312720, 0x14, 0x27f01e?}, {0xc000605400, 0x14, 0x20}, {0xc0058b3200, 0x22}, 0xc0001b61e0, ...)
        github.com/git-lfs/git-lfs/v3/git/githistory/rewriter.go:469 +0xae
github.com/git-lfs/git-lfs/v3/git/githistory.(*Rewriter).rewriteTree(0xc00013e4e0, {0xc000312720, 0x14, 0x30}, {0xc000605100, 0x14, 0x20}, {0xc00049f2d8, 0x13}, 0xc0001b61e0, ...)
        github.com/git-lfs/git-lfs/v3/git/githistory/rewriter.go:397 +0x869
github.com/git-lfs/git-lfs/v3/git/githistory.(*Rewriter).rewriteTree(0xc00013e4e0, {0xc000312720, 0x14, 0x30}, {0xc000604fe0, 0x14, 0x20}, {0xc0004232c0, 0xc}, 0xc0001b61e0, ...)
        github.com/git-lfs/git-lfs/v3/git/githistory/rewriter.go:399 +0x805
github.com/git-lfs/git-lfs/v3/git/githistory.(*Rewriter).rewriteTree(0xc00013e4e0, {0xc000312720, 0x14, 0x30}, {0xc002510720, 0x14, 0x20}, {0xc000423cf6, 0x5}, 0xc0001b61e0, ...)
        github.com/git-lfs/git-lfs/v3/git/githistory/rewriter.go:399 +0x805
github.com/git-lfs/git-lfs/v3/git/githistory.(*Rewriter).rewriteTree(0xc00013e4e0, {0xc000312720, 0x14, 0x30}, {0xc000ed14d0, 0x14, 0x30}, {0x0, 0x0}, 0xc0001b61e0, ...)
        github.com/git-lfs/git-lfs/v3/git/githistory/rewriter.go:399 +0x805
github.com/git-lfs/git-lfs/v3/git/githistory.(*Rewriter).Rewrite(0xc00013e4e0, 0xc00007c3c0)
        github.com/git-lfs/git-lfs/v3/git/githistory/rewriter.go:247 +0x91b
github.com/git-lfs/git-lfs/v3/commands.migrate({0xc0002840e0, 0x0, 0x2}, 0x1?, 0xc0002a6000?, 0x70?)
        github.com/git-lfs/git-lfs/v3/commands/command_migrate.go:78 +0x8f
github.com/git-lfs/git-lfs/v3/commands.migrateInfoCommand(0xc000122000?, {0xc0002840e0, 0x0, 0x2})
        github.com/git-lfs/git-lfs/v3/commands/command_migrate_info.go:118 +0x68b
github.com/spf13/cobra.(*Command).execute(0xc000122000, {0xc0002840a0, 0x2, 0x2})
        github.com/spf13/[email protected]/command.go:766 +0x663
github.com/spf13/cobra.(*Command).ExecuteC(0xc000122780)
        github.com/spf13/[email protected]/command.go:852 +0x2e5
github.com/spf13/cobra.(*Command).Execute(...)
        github.com/spf13/[email protected]/command.go:800
github.com/git-lfs/git-lfs/v3/commands.Run()
        github.com/git-lfs/git-lfs/v3/commands/run.go:108 +0x307
main.main()
        github.com/git-lfs/git-lfs/v3/git-lfs.go:34 +0xe5

To Reproduce
just run git lfs migrate info --everything --fixup

Expected behavior
git migrate info print successfully.

System environment
tested on multiple platforms, including Win10, WSL(Ubuntu 20.04), Debian 10

Output of git lfs env

git-lfs/3.3.0 (GitHub; windows amd64; go 1.19.3; git 77deabdf)
git version 2.40.0.windows.1

Endpoint=****
  SSH=****
LocalWorkingDir=D:\projects\demo_project
LocalGitDir=D:\projects\demo_project\.git
LocalGitStorageDir=D:\projects\demo_project\.git
LocalMediaDir=D:\projects\demo_project\.git\lfs\objects
LocalReferenceDirs=
TempDir=D:\projects\demo_project\.git\lfs\tmp
ConcurrentTransfers=8
TusTransfers=false
BasicTransfersOnly=false
SkipDownloadErrors=false
FetchRecentAlways=false
FetchRecentRefsDays=7
FetchRecentCommitsDays=0
FetchRecentRefsIncludeRemotes=true
PruneOffsetDays=3
PruneVerifyRemoteAlways=false
PruneRemoteName=origin
LfsStorageDir=D:\projects\demo_project\.git\lfs
AccessDownload=none
AccessUpload=none
DownloadTransfers=basic,lfs-standalone-file,ssh
UploadTransfers=basic,lfs-standalone-file,ssh
GIT_EXEC_PATH=C:/Program Files/Git/mingw64/libexec/git-core
git config filter.lfs.process = "git-lfs filter-process"
git config filter.lfs.smudge = "git-lfs smudge -- %f"
git config filter.lfs.clean = "git-lfs clean -- %f"

Additional context
It appears there may be some issues within my Git repository. However, it is a private repository, and can not be public.
So I need some help to providing more info.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions