ejoffe / spr

Stacked Pull Requests on GitHub
MIT License
796 stars 68 forks source link

Unable to determine github branch #346

Closed jameskyle closed 1 year ago

jameskyle commented 1 year ago

Looks like spr is defaulting to origin/main though this branch does not exist in my project.

git spr status
error: unable to fetch remote branch info, using defaults> git rev-parse --show-toplevel
> github fetch pull requests
> git log --format=medium --no-color origin/main..HEAD
git error: fatal: ambiguous argument 'origin/main..HEAD': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
panic: exit status 128
ejoffe commented 1 year ago

To solve this you can either set the upstream for your branch or update the .spr.yml in your repo to point to the correct upstream branch.

alexmirrington commented 1 year ago

@ejoffe Been running into the same issue since v0.13.0. Adding the following to .spr.yml does not fix the issue, as the config seems to get re-written when running git spr s:

githubRemote: origin
githubBranch: master

Seems to be related to #336

jameskyle commented 1 year ago

+1 on config being rewritten.

 git spr status
> git rev-parse --show-toplevel
> github fetch pull requests
> git log --format=medium --no-color origin/data-sanity-system..HEAD
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x10 pc=0x1378b12]

goroutine 1 [running]:
github.com/ejoffe/spr/github/githubclient.(*client).GetInfo(0xc00012b128, {0x1532ad0, 0xc000120000}, {0x1532c58, 0xc00012b0f8})
        /Users/runner/work/spr/spr/github/githubclient/client.go:188 +0x132
github.com/ejoffe/spr/spr.(*stackediff).StatusPullRequests(0xc0001310e0, {0x1532ad0, 0xc000120000})
        /Users/runner/work/spr/spr/spr/spr.go:334 +0x70
main.main.func2(0xc000230920)
        /Users/runner/work/spr/spr/cmd/spr/main.go:128 +0x25
github.com/urfave/cli/v2.(*Command).Run(0xc000226900, 0xc00013f340)
        /Users/runner/go/pkg/mod/github.com/urfave/cli/v2@v2.3.0/command.go:163 +0x64a
github.com/urfave/cli/v2.(*App).RunContext(0xc000189040, {0x1532ad0, 0xc000120000}, {0xc000134000, 0x2, 0x2})
        /Users/runner/go/pkg/mod/github.com/urfave/cli/v2@v2.3.0/app.go:313 +0x81e
github.com/urfave/cli/v2.(*App).Run(...)
        /Users/runner/go/pkg/mod/github.com/urfave/cli/v2@v2.3.0/app.go:224
main.main()
        /Users/runner/work/spr/spr/cmd/spr/main.go:224 +0x1325
❯ git diff
diff --git a/.spr.yml b/.spr.yml
index 2e938462a7..714eb3c7d5 100644
--- a/.spr.yml
+++ b/.spr.yml
@@ -3,9 +3,6 @@ githubRepoName: galaxy
 githubHost: github.com
 requireChecks: true
 requireApproval: true
-githubRemote: origin
-githubBranch: develop
-remoteBranches: []
 mergeMethod: rebase
 mergeQueue: true
 forceFetchTags: false
ejoffe commented 1 year ago

fixed in v0.14.1

jameskyle commented 1 year ago

I'm still seeing this issue, though it no longer overwrites the config.

❯ egrep "githubRemote|githubBranch" .spr.yml
githubRemote: origin
githubBranch: develop
❯ ls -l $(which git-spr)
lrwxr-xr-x@ 1 jkyle  admin  32 Aug  8 11:19 /usr/local/bin/git-spr -> ../Cellar/spr/0.14.1/bin/git-spr
❯ git branch -vv | grep 658
* ef-658-customer-config-filtering-features        5e6c0e3a0a [develop: ahead 1] ef-660: add code coverage to effected methods
❯ git spr update
error: unable to fetch remote branch info, using defaults> git rev-parse --show-toplevel
> git fetch
> git rebase origin/main --autostash
git error: fatal: invalid upstream 'origin/main'
jameskyle commented 1 year ago

I don't think I can reopen this, filing new bug.