Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: prefer "origin" or "upstream" remote if exists #46

Merged
merged 1 commit into from
Jul 18, 2024
Merged

feat: prefer "origin" or "upstream" remote if exists #46

merged 1 commit into from
Jul 18, 2024

Conversation

rvagg
Copy link
Contributor

@rvagg rvagg commented Jul 12, 2024

No description provided.

Copy link
Owner

@hogashi hogashi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for a p-r.

This extension should copy feature branch URL when the current branch is a feature branch. Origin branch URL will be weird (404 or the line number differs) if it is a new file or a changed file.

So I'd like to ask you what your problem is in detail. I'm glad if you tell me "what was happened" and "what is expected."

@rvagg
Copy link
Contributor Author

rvagg commented Jul 17, 2024

I have multiple remotes for many repos; sometimes these are local forks, sometimes they are other people's forks. This extension, as it exists today, just picks the first remote from the list in the order presented to the extension and from my experience so far, this ends up being the wrong fork. However, it's not hard to discover the most likely correct remote from convention: it is typical to name the primary remote that you work with "origin", and sometimes this convention is switched to "upstream" (the gh commandline tool uses this convention for example when it forks a remote for you). So this change will sift through the remotes that you have for a repo and if it finds one called "origin", will use that, otherwise "upstream", and then if not that will fall back to just picking the first.

Copy link
Owner

@hogashi hogashi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I have mistaken "remote" with "branch" somehow... I'm sincery sorry for that and thank you again for your explanation.

This extension, as it exists today, just picks the first remote from the list in the order presented to the extension and from my experience so far, this ends up being the wrong fork. However, it's not hard to discover the most likely correct remote from convention: it is typical to name the primary remote that you work with "origin", and sometimes this convention is switched to "upstream"

That is indeed. LGTM!

@hogashi hogashi merged commit e5d8800 into hogashi:master Jul 18, 2024
@rvagg rvagg deleted the patch-1 branch July 18, 2024 01:34
@hogashi
Copy link
Owner

hogashi commented Jul 18, 2024

@rvagg I released v0.3.0 including this change. https://github.com/hogashi/vscode-copy-github-permalink/releases/tag/v0.3.0

And it's published already 🚀 https://marketplace.visualstudio.com/items?itemName=hogashi.vscode-copy-github-permalink

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants