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

0.14.1 cannot find upstream branch #349

Closed
jameskyle opened this issue Aug 8, 2023 · 8 comments · Fixed by #351
Closed

0.14.1 cannot find upstream branch #349

jameskyle opened this issue Aug 8, 2023 · 8 comments · Fixed by #351

Comments

@jameskyle
Copy link

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

  • remote/branch set in config
  • set the upstream branch to my target branch develop
  • verified v0.14.1
❯ 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'

@kirilne
Copy link

kirilne commented Aug 15, 2023

Happens for me as well

➜  infra-core git:(feature/kirilne/create_utils) ✗ cat .spr.yml
requireChecks: false
requireApproval: false
githubRemote: origin
githubBranch: master
➜  infra-core git:(feature/kirilne/create_utils) ✗ git spr update --detail
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'

@ConnorSinnott
Copy link

+1 origin/master is not being detected. Could we re-add the option to override automated behavior via the config?

@jameskyle
Copy link
Author

@ConnorSinnott I believe the reintroduction of githubBranch was supposed to reintroduce that feature.

So I think the current behavior is a bug.

@jameskyle
Copy link
Author

@ejoffe any thoughts on this one?

ejoffe added a commit that referenced this issue Sep 7, 2023
fixes #349

commit-id:f9c27350
ejoffe added a commit that referenced this issue Sep 7, 2023
fixes #349

commit-id:f9c27350
ejoffe added a commit that referenced this issue Sep 7, 2023
fixes #349

commit-id:f9c27350
@ejoffe
Copy link
Owner

ejoffe commented Sep 8, 2023

Sorry, I was away for a bit.
In v0.14.1 the method of getting remote branch was changed to be fetched from the git upstream branch.
The advantage of this approach is that you can now have stacks targeted at different remote branches, and example use case we have is different environments like a staging or feature branch.
This however unfortunately was not backwards compatible and broke older configs.
This should be fixed in v0.14.2 now. Both the Repo config yaml and upstream is used for this configuration. If git upstream configuration is set for the branch, it will take precedence over the Repo config.

@vlad-ivanov-name
Copy link

@ejoffe thanks for the fix! out of curiosity -- how would one configure the remote branch properly before this fix? it didn't work for me on a fresh git clone where I created a branch from master with git switch -c

@ejoffe
Copy link
Owner

ejoffe commented Sep 8, 2023

Set the upstream of the branch:
git branch -u origin/master
This still works in v0.14.2.
So you can actually have different upstreams set per branch, not just one for the whole repo.

@jameskyle
Copy link
Author

I'll give the upstream a shot. Seems reasonable. Thanks for the work and explanation!

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

Successfully merging a pull request may close this issue.

5 participants