Using getcord/spr

@jroelofs @vitalybuka I wonder whether you can shed light on how you use spr…

The following is my setup but I encounter an unknown git error occurred; code=NotFound (-3) errors when I invoke spr diff. (edit: solved by re-cloning git@github.com:llvm/llvm-project.git)

% cargo install spr
% spr --version
spr 1.3.4
% git remote -v
maskray git@github.com:MaskRay/llvm-project.git (fetch)
maskray git@github.com:MaskRay/llvm-project.git (push)
origin  git@github.com:llvm/llvm-project.git (fetch)
origin  git@github.com:llvm/llvm-project.git (push)

Invoke spr init and use a classic personal access token with read:org, repo, workflow permission. https://github.com/settings/tokens

~/.gitconfig

[spr]
        githubAuthToken = ghp_xxxxxxxxxxx
        githubRemoteName = origin
        githubRepository = llvm/llvm-project
        githubMasterBranch = main
        branchPrefix = users/MaskRay/spr/
        requireTestPlan = false
% git push -u maskray asan-stack-safety  # not needed, but I use my repository to save the work
% spr diff  # a PR is created in llvm/llvm-project and the commit message contains "Pull Request" now
% edit ...
% git commit --amend
% spr diff
  🛑  an unknown git error occurred; code=NotFound (-3)

% spr diff # a PR is created in llvm/llvm-project and the commit message contains “Pull Request” now
% edit …
% git commit --amend
% spr diff

That matches my workflow, but I see no such error.
The second spr diffasks for upload message, and update PR for me, as expected.

Is possible that githubAuthToken is missing some permissions? I use exactly as spr init suggested.

The permission is correct, so I am puzzled…

Nevertheless, I just re-cloned the repository using git clone 'git@github.com:llvm/llvm-project.git' and spr diff seems to work now.

I have tried copying .git/config from the new repo to the old repo but spr diff still doesn’t work for the old repo. I will just abandon my old repo…

edit: unfortunately, I still get an unknown git error occurred; code=NotFound (-3) errors for pull requests (e.g. [ELF] OVERLAY: support optional start address and LMA by MaskRay · Pull Request #77272 · llvm/llvm-project · GitHub)

I have filed `an unknown git error occurred; code=NotFound (-3)` · Issue #184 · getcord/spr · GitHub

I have problems using spr too.

When I run spr diff it tells:

error: unknown option `no-write-fetch-head'

I am not sure if it is a spr problem or a git problem. My spr version is 1.3.4 and my git version is 2.19.

I have figured it out. fetch = +refs/heads/*:refs/remotes/origin/* should be used. fetch = +refs/heads/main:refs/remotes/origin/main would lead to an unknown git error occurred; code=NotFound (-3).

error: unknown option `no-write-fetch-head’

git 2.19 looks too old. Perhaps 2.30+ or 2.40+ will work?