gruntwork-io / git-xargs

git-xargs is a command-line tool (CLI) for making updates across multiple Github repositories with a single command.
https://blog.gruntwork.io/introducing-git-xargs-an-open-source-tool-to-update-multiple-github-repos-753f9f3675ec
Apache License 2.0
921 stars 63 forks source link

panic: runtime error: invalid memory address or nil pointer dereference #114

Closed jduan-highnote closed 1 year ago

jduan-highnote commented 1 year ago

Describe the bug I'm using version 0.1.3 and this is how I use git-xargs:

git-xargs \
    --no-skip-ci \
    --branch-name "upgrade jira-description-action" \
    --commit-message "Use latest version of jira-description-action" \
    --repos ~/repos.txt \
    --pull-request-title "SINF-672 Use latest version of jira-description-action" \
    --pull-request-description "Use latest version of jira-description-action" \
    --draft \
    --loglevel DEBUG \
    ~/repos/git-xargs.sh

~/repos/git-xargs.sh looks like this:

#!/usr/bin/env bash

rg jira-description-action .github -l | xargs sed -i '' 's/jira-description-action@v0.3.2/jira-description-action@v0.4.0/'

and that gives this error:

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

goroutine 50 [running]:
github.com/go-git/go-git/v5/plumbing/protocol/packp.(*ReportStatus).Error(0x104997290?)
        github.com/go-git/go-git/v5@v5.3.0/plumbing/protocol/packp/report_status.go:31 +0x1c
github.com/go-git/go-git/v5.(*Remote).PushContext(0x140008ae138, {0x104997290, 0x140001ae008}, 0x14000a69418)
        github.com/go-git/go-git/v5@v5.3.0/remote.go:216 +0xaa8
github.com/go-git/go-git/v5.(*Repository).PushContext(0x10474241f?, {0x104997290, 0x140001ae008}, 0x14000a69418)
        github.com/go-git/go-git/v5@v5.3.0/repository.go:1143 +0x70
github.com/go-git/go-git/v5.(*Repository).Push(...)
        github.com/go-git/go-git/v5@v5.3.0/repository.go:1123
github.com/gruntwork-io/git-xargs/repository.pushLocalBranch(0x140001f69a0, 0x1400027c700, 0x4?)
        github.com/gruntwork-io/git-xargs/repository/repo-operations.go:377 +0x290
github.com/gruntwork-io/git-xargs/repository.updateRepo(0x140001f69a0, {0x14000152e10, 0x4a}, 0x1400027c700?, 0x1400027c700, 0x0?, {0x14000330540, 0x2a})
        github.com/gruntwork-io/git-xargs/repository/repo-operations.go:280 +0x438
github.com/gruntwork-io/git-xargs/repository.processRepo(0x0?, 0x1400027c700)
        github.com/gruntwork-io/git-xargs/repository/process.go:120 +0x208
github.com/gruntwork-io/git-xargs/repository.ProcessRepos.func1(0x0?, 0x1400027c700)
        github.com/gruntwork-io/git-xargs/repository/process.go:58 +0x90
created by github.com/gruntwork-io/git-xargs/repository.ProcessRepos
        github.com/gruntwork-io/git-xargs/repository/process.go:52 +0x21c

To Reproduce Steps to reproduce the behavior including the relevant Terraform/Terragrunt/Packer version number and any code snippets and module inputs you used.

// paste code snippets here

Expected behavior A clear and concise description of what you expected to happen.

Nice to have

Additional context Add any other context about the problem here.

zackproser commented 1 year ago

Hi thanks for reporting. I'm pretty confident this was a bad release, and the issue has since been resolved. Feel free to re-open if you can produce a minimal test case. Thanks!

TCainNutrien commented 3 months ago

To anyone here in the future, check the encoding on your repo list, this was happening to me because my repo list wasn't encoded with UTF-8.