Skip to content

Panic when working in -q mode with working directories created with git worktree #128

@nstetich

Description

@nstetich

I work in a situation where I need to track multiple branches of multiple repositories and I use git worktree to create working directories without cloning the repository repeatedly.

When I attempt to run gitbatch -m pull -q in a directory containing working copy directories of git repositories that were created with git worktree add -b <BRANCH> <WORKING LOCATION> from the main cloned location, I see an error like the following:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x18 pc=0x10507eb70]

goroutine 37 [running]:
github.com/go-git/go-git/v5/plumbing.(*Reference).Hash(...)
        github.com/go-git/go-git/[email protected]/plumbing/reference.go:183
github.com/isacikgoz/gitbatch/internal/command.pullWithGit(0x14000214340, 0x140000a4ea0)
        github.com/isacikgoz/gitbatch/internal/command/pull.go:72 +0x230
github.com/isacikgoz/gitbatch/internal/command.Pull(0x1400016eaf0?, 0x43?)
        github.com/isacikgoz/gitbatch/internal/command/pull.go:47 +0x58
github.com/isacikgoz/gitbatch/internal/app.operate({0x1400016eaf0?, 0x0?}, {0x16b1a3444, 0x4})
        github.com/isacikgoz/gitbatch/internal/app/quick.go:43 +0x84
github.com/isacikgoz/gitbatch/internal/app.quick.func1({0x1400016eaf0, 0x43}, {0x16b1a3444, 0x4})
        github.com/isacikgoz/gitbatch/internal/app/quick.go:19 +0x60
created by github.com/isacikgoz/gitbatch/internal/app.quick in goroutine 1
        github.com/isacikgoz/gitbatch/internal/app/quick.go:17 +0x60

When I run gitbatch in interactive mode in the same directory, I simply don't see these working directories in the list of git projects.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions