Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

git spr panics if a husky pre-push hook exits with exit status 1 #389

Open
jonathanloske opened this issue Feb 16, 2024 · 0 comments
Open

Comments

@jonathanloske
Copy link
Contributor

Just what it says in the description. I put a little checker in a pre-push hook that looks like this:

echo "Checking if port 3000 is free"

portbusy="$(lsof -i 4tcp:3000 || true)"

if [[ "${#portbusy}" -gt 0 ]]; then
    echo "port 3000 in use, exiting because E2E tests require it to be free"
    exit 1
fi

It works as expected but git spr isn't very happy about it, returning this:

❯ git spr update
> git rev-parse --show-toplevel
> git fetch
> git rebase origin/master --autostash
> github fetch pull requests
> git log --format=medium --no-color origin/master..HEAD
> git branch --no-color
> git log --format=medium --no-color origin/master..HEAD
> git status --porcelain --untracked-files=no
> git push --force --atomic origin 0fbfccffdddb4db5673151a1bd03b1a9c24edce1:refs/heads/spr/master/dfcf08bc 282e88f78ab723f2f5403ea1e30b7be0ec0533e3:refs/heads/spr/master/3b65cc73
git error: Checking if port 3000 is free
port 3000 in use, exiting because E2E tests require it to be free
husky - pre-push hook exited with code 1 (error)
error: failed to push some refs to 'https://github.es.ecg.tools/mobile-de/obs-inventory-node.git'
panic: exit status 1

goroutine 1 [running]:
github.com/ejoffe/spr/git/realgit.(*gitcmd).MustGit(0x14000319b00?, {0x14000348000?, 0x2?}, 0x140000b8480?)
        /Users/runner/work/spr/spr/git/realgit/realcmd.go:44 +0x4c
github.com/ejoffe/spr/spr.(*stackediff).syncCommitStackToGitHub(0x140000ae540, {0x14000167610?, 0x140000bcd5b?}, {0x14000248360, 0x2, 0x102aa008c?}, 0x1400021c190)
        /Users/runner/work/spr/spr/spr/spr.go:556 +0x5b4
github.com/ejoffe/spr/spr.(*stackediff).UpdatePullRequests(0x140000ae540, {0x102f0c4f0?, 0x103229460}, {0x103229460, 0x0, 0x0}, 0x0)
        /Users/runner/work/spr/spr/spr/spr.go:180 +0x790
main.main.func4(0x140000ab0e0?)
        /Users/runner/work/spr/spr/cmd/spr/main.go:161 +0x100
github.com/urfave/cli/v2.(*Command).Run(0x140000ab0e0, 0x140000c43c0)
        /Users/runner/go/pkg/mod/github.com/urfave/cli/v2@v2.8.1/command.go:169 +0x4f8
github.com/urfave/cli/v2.(*App).RunContext(0x14000082340, {0x102f0c4f0?, 0x103229460}, {0x1400001e040, 0x2, 0x2})
        /Users/runner/go/pkg/mod/github.com/urfave/cli/v2@v2.8.1/app.go:341 +0x85c
github.com/urfave/cli/v2.(*App).Run(...)
        /Users/runner/go/pkg/mod/github.com/urfave/cli/v2@v2.8.1/app.go:247
main.main()
        /Users/runner/work/spr/spr/cmd/spr/main.go:230 +0x1208

Expected behavior
git spr exits gracefully

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant