Closed franklouwers closed 3 months ago
I use this feature all the time, so I don't think its broken. More likely an edge case with the remote? In your ./.git/config
file, whats the url of the remote?
[remote "origin"]
url = https://github.com/my-org/myrepo
replaced the org with my-org and the repository with myrepo to protect clients. All lowercase, no funky chars, the real my-org has a dash in the name (just like my-org) does
For completeness, this is my full (unmodified) ~/.gitconfig
:
[user]
email = frank@louwers.be
name = Frank Louwers
signingkey = ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPzAulvKp8l2cHRIVhi1c3Z8uprO7UrwENZShOT5S/gu
[gpg]
format = ssh
[gpg "ssh"]
program = /Applications/1Password.app/Contents/MacOS/op-ssh-sign
[commit]
gpgsign = true
# force ssh for github.com and gitlab.com
[url "ssh://git@github.com/"]
insteadOf = https://github.com/
[url "ssh://git@gitlab.com/"]
insteadOf = https://gitlab.com/
[init]
defaultBranch = main
[push]
autoSetupRemote = true
default = current
[github]
user = franklouwers
Would the insteadOf
mangle things?
Yeah, thats totally possible - I'll try to reproduce the issue and add support for ssh uri's
FYI I did some more tests:
1) comment the "insteadOf" section of my gitconfig (see below for full gitconfig)
2) fork this repo to one of my orgs (https://github.com/kiwazo-be/neogit)
3) git clone https://github.com/kiwazo-be/neogit
4) git switch -c feature/test
5) copy and paste minimal.lua from the above (unmodified from the ticket template) as t/minimal.lua
6) start nvim -nu t/minimal.lua
7) start Neogit, add minimal.lua, commit, push (using P u
)
8) b o
, expect safari to open https://github.com/kiwazo-be/neogit/compare/feature/test?expand=1
9) see safari open https://github.com/kiwazo-be/$%7Brepository%7D/compare/feature/test?expand=1
Am puzzled here...
~/.gitconfig:
[user]
email = frank@louwers.be
name = Frank Louwers
signingkey = ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPzAulvKp8l2cHRIVhi1c3Z8uprO7UrwENZShOT5S/gu
[gpg]
format = ssh
[gpg "ssh"]
program = /Applications/1Password.app/Contents/MacOS/op-ssh-sign
[commit]
gpgsign = true
# force ssh for github.com and gitlab.com
; [url "ssh://git@github.com/"]
; insteadOf = https://github.com/
; [url "ssh://git@gitlab.com/"]
; insteadOf = https://gitlab.com/
[init]
defaultBranch = main
[push]
autoSetupRemote = true
default = current
[github]
user = franklouwers
Ah! Ok, it's because repository
is nil from this function: https://github.com/neogitorg/neogit/blob/fd63c19287cb275ea38d2c85f41ce712a816c160/lua/neogit/lib/git/remote.lua#L103
Your url doesn't end in .git
- suppose I should support when it doesn't
5d24c8c
(#978) - lemme know if this resolves things for you :)
YES, this solves this! Thank you for taking the time to look into this.
Very welcome, thanks for letting me know :)
I believe this can be closed, as the Nightly update fixes this.
Description
I am on nvim 0.10 nightly. I want to use the new
b o
feature to open my browser at the "Pull Request" page for a branch.For Github, there is incorrect parsing of the
git_services
setup section resulting in malformed URLs.My NeoGit config is as follows, using Lazy as a loader, but the same thing happens with the
minimal.lua
config below.The url opened is https://github.com/my-org/$%7Brepository%7D/compare/feature/karpenter-max-lifetime?expand=1
As you can see, the
${owner}
is correctly parsed, but the${repository}
isn't.I've tried this with both the Stable and the Nightly branch Neogit.
Neovim version
NVIM v0.10.0-dev-2734+gdde2cc65f-Homebrew Build type: Release LuaJIT 2.1.1710088188
Operating system and version
macOS 14.4.1
Steps to reproduce
nvim -nu minimal.lua
in a directory with contains agit clone
of a github.com repo where you can create PRs and push to branchesP u
in Neogit to push the branchb o
in Neogit to open the PR pageExpected behavior
Open the PR webpage on github.com
Actual behavior
Get a Github 404 because
${repository}
isn't correctly parsedMinimal config