Sertion / vscode-gitblame

Visual Studio Code Extension - See Git Blame info in status bar.
https://marketplace.visualstudio.com/items/waderyan.gitblame
MIT License
72 stars 31 forks source link

Alternate ssh profile breaks remote URL for nonstandard origins #161

Closed petervandivier closed 7 months ago

petervandivier commented 7 months ago

My .ssh/config is set up as below...

Host github.com
    Hostname github.com
    User git
    IdentityFile ~/.ssh/personal.id_ed25519

Host work
    Hostname github.com
    User git
    IdentityFile ~/.ssh/work.id_ed25519

...when I'm in a work repository and click through to the "Online" blame, the string github.com/ is replaced with work. e.g. https://github.com/microsoft/PowerShellForGitHub/commit/deadbeef becomes https://workmicrosoft/PowerShellForGitHub/commit/deadbeef

git remote -v shows nonstandard origin opening the blame online vscode URL launcher showing malformed URL

I can work around this by copying the URL from the dialogue (as seen in the screencap above) and manually editing it (thanks #47 😄 (I think)), but it would be nice if this could be detected automagically.

(Apologies if this has been addressed by a previous issue. I wasn't able to parse out if that was the case from a quick browse)

Sertion commented 7 months ago

Hey Peter Vandivier. Thanks for the feature request. I have a follow up question:

Would it work if the generated URL was https://work/microsoft/PowerShellForGitHub/commit/deadbeef (a slash between work and microsoft in the former host name)?

Other than that I don't see a way where the extension could be aware of this. If git isn't aware, the extension isn't either.

petervandivier commented 7 months ago

Would it work if the generated URL was ... a slash between [the origin] and [the organization]?

For me this would not work. work as an entity is just defined in my ssh config and not in my hosts file or anywhere that my browser would pick it up.

Tbh I was trying to think of other workarounds for a little bit before submitting the ticket but I couldn't come up with anything quickly (or at least nothing sensible). If I do think of something other than the current workaround I'll be sure to update this thread :slightly_smiling_face:

FWIW I'm aware this is probably an edge case as I've had other issues with my current setup.

Sertion commented 7 months ago

Non-standard setups usually has their ups and down. I will close this as out of scope.

I have very (very) limited experience with them, but there are conditionals available for the git configuration. Perhaps you can tell it to use different SSH-keys based on what parent folder the git-repo resides in?

Good luck and thanks for taking the time to create a ticket even if it did not lead to a fix for your issue!

petervandivier commented 7 months ago

Fair enough 🙂

I figured it was worth documenting the behaviour even if there's nothing to be done.

Perhaps you can tell it to use different SSH-keys based on what parent folder the git-repo resides in?

That's actually exactly what I do with my current setup. The alt ssh profile facilitates that in part.

Thanks in any case for your work on this lovely extension! 😄