spr icon indicating copy to clipboard operation
spr copied to clipboard

Regression: cannot update pull requests after update

Open arichardson opened this issue 3 months ago • 6 comments

I updated to the latest version and now get the following error whenever I try to update a pull request:

❯ spr diff --cherry-pick --update-message
4fe0e7f [DataLayout][LangRef] Split non-integral and unstable pointer properties
  #️⃣   Pull Request #105735: https://github.com/llvm/llvm-project/pull/105735
Message (leave empty to abort):   ⚾  Commit was rebased - updating Pull Request #105735
  ⚾  Commit was rebased - updating Pull Request #105735
  🛑  git push failed
  🛑  unsupported URL protocol; class=Net (12)

I am currently bisecting and it works as expected with d90b197dc18715e7e230362b3a905f664e7f12c3, will report back once I have figured out which commit is causing this.

arichardson avatar Sep 20 '25 01:09 arichardson

Completed bisecting and it points me to this commit:

d8061347cd3166172d57ed16ae1141f8a0117147 is the first bad commit
commit d8061347cd3166172d57ed16ae1141f8a0117147 (HEAD)
Author: Sven Over <[email protected]>
Date:   Tue Sep 9 09:48:54 2025 +0100

    Remove all uses of git command line tool (#232)
    
    Instead of using the git command line tool for fetching and pushing, we
    now use the git2 crate with an anonymous remote (which is the GitHub
    https url of the repo) and the GitHub token for auth.
    
    Side effects are that spr will no longer prompt you to enter your
    passphrase for your SSH key, because SSH is not used for fetching and
    pushing. Also, spr will not update any remote refs (like
    `refs/remotes/origin/master`), because we don't use a named remote
    anymore. In that sense, doing an `spr diff` will have less side effects
    overall - it purely updates the branch on GitHub.
    
    Another side effect of this change is that our GitHub auth token now
    needs to have the `workflow` scope, or else pushes that include changes
    to GitHub workflows would potentially fail.

The commit before works, but this one does not.

I wonder if part of the problem is that I have my remote configured with push via ssh and fetch over https:?

origin  https://github.com/llvm/llvm-project.git (fetch)
origin  [email protected]:llvm/llvm-project.git (push)

arichardson avatar Sep 21 '25 00:09 arichardson

Hi @arichardson!

This is interesting.

spr doesn't look at any remotes defined in the repository anymore. So your setup using ssh and https for push and fetch shouldn't cause any problems.

Instead, the remote URL spr uses is now hardcoded to be https://github.com/OWNER/REPO.git.

It looks as if your build of spr doesn't support the "https" protocol. It should, via the https feature of the git2 crate. Could you try again with the latest master of spr? The error message should now include the url that spr tried to connect to.

spacedentist avatar Sep 21 '25 12:09 spacedentist

Thanks for adding the debug code! I am now getting this error:

Error: git push failed

Caused by:
   0: Connection to git remote failed, url: https://github.com/llvm/llvm-project.git
   1: unsupported URL protocol; class=Net (12)

Location:
    src/git_remote.rs:40:54

arichardson avatar Sep 21 '25 21:09 arichardson

I just saw I have [email protected]:.pushinsteadof=https://github.com/ in my global gitconfig, so maybe this is causing the problems.

arichardson avatar Sep 21 '25 21:09 arichardson

When I add "ssh" to the git2 features I now get:

Error: git push failed

Caused by:
   0: Connection to git remote failed, url: https://github.com/llvm/llvm-project.git
   1: authentication required but no callback set; class=Ssh (23); code=Auth (-16)

Location:
    src/git_remote.rs:40:54

But with the URL rewrite entry commented in my gitconfig I now get:

Error: git push failed

Caused by:
   0: Connection to git remote failed, url: https://github.com/llvm/llvm-project.git
   1: unexpected http status code: 403; class=Http (34)

Location:
    src/git_remote.rs:40:54

Not sure what could be causing this one.

arichardson avatar Sep 21 '25 22:09 arichardson

Should be fixed by https://github.com/spacedentist/spr/pull/244

arichardson avatar Sep 22 '25 01:09 arichardson