ejoffe / spr

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

`git-spr --version` etc., working outside of #333

Open ggoretkin-bdai opened 1 year ago

ggoretkin-bdai commented 1 year ago

Not in a git repo:

/tmp$ git-spr --version
git error: fatal: not a git repository (or any of the parent directories): .git

In a git repo without .spr.yml

/tmp/testrepo$ git init
Initialized empty Git repository in /tmp/testrepo/.git/
/tmp/testrepo$ git-spr --version
rake: config file /tmp/testrepo/.spr.yml not found
unable to auto configure repository owner - must be set manually in .spr.yml
visma-alexander-maslov commented 8 months ago

I hit the same bug. And for me it seems to be because username contains '-' As the GitHub states when you create new account

Username may only contain alphanumeric characters or single hyphens, and cannot begin or end with a hyphen.

https://github.com/ejoffe/spr/blob/master/config/config_parser/remote_source.go#L48 regex is

repoFormat := `(?P<githubHost>[a-z0-9._\-]+)(/|:)(?P<repoOwner>\w+)/(?P<repoName>[\w-]+)`

and it has only \w -> word characters (== [0-9A-Za-z_]) for the repoOwner

visma-alexander-maslov commented 6 months ago

393 seems address this