You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
origin is frequently not the correct repository. When you're working on a repo you have a fork of you would generally want to share a link to the file in the repo you forked not in your origin.
you may not call your remote repo "origin" you might call it "github" or whatever. There is no requirement in git that any remote repo must be named "origin".
there's no way to know for sure, but it seems reasonable to assume that the the correct repo to link to is the one the current branch is tracking (if any).
Problem 2
the current branch/commit may not exist on ANY remote repo in which case the plugin should report an error.
Problem 3
it's not the branch that's important. it's the commit. The same commit may exist on multiple branches. It may exist on NO branches but still be in the repo. If I have checked out a tag or are in a detached head state this probability increases dramatically.
Problem 4
the line of code you've selected may be changed in your working directory from the version in the most recent commit. the plugin should error in this case because it's literally not possible to link to that code in github, because it only exists in your working directory.
the question of branches can be, at least partially, addressed by asking your local git if there are any copies of the current branch on the remote repos (as of the last fetch / pull).
That will tell you what remote repos have it. If there are multiple repos with the same branch the plugin could let you choose which one to link to. if there are none it could encourage you to push it so that you could then open it in github.
note that knowing you have remote repos with the same branch name doesn't mean they're the same branch (could be completely different branch with the same name) OR that they all have the commit you're currently looking at (you could have pulled more recently, or you or they may have rebased). That requires an additional check.
so again, it's really about commits not branches and finding out where the current commit exists.
The text was updated successfully, but these errors were encountered:
When the current branch tracks an upstream branch, generate a link to
that upstream branch (or SHA) rather than using the local one, since it
may not exist upstream.
In the case that the local branch has no upstream, prompt the user for
the branch name to generate a link for.
Partly addresses ruanyl#10.
Co-authored-by: souldzin <[email protected]>
Problem 1
origin
is frequently not the correct repository. When you're working on a repo you have a fork of you would generally want to share a link to the file in the repo you forked not in your origin.you may not call your remote repo "origin" you might call it "github" or whatever. There is no requirement in git that any remote repo must be named "origin".
there's no way to know for sure, but it seems reasonable to assume that the the correct repo to link to is the one the current branch is tracking (if any).
Problem 2
the current branch/commit may not exist on ANY remote repo in which case the plugin should report an error.
Problem 3
it's not the branch that's important. it's the commit. The same commit may exist on multiple branches. It may exist on NO branches but still be in the repo. If I have checked out a tag or are in a detached head state this probability increases dramatically.
Problem 4
the line of code you've selected may be changed in your working directory from the version in the most recent commit. the plugin should error in this case because it's literally not possible to link to that code in github, because it only exists in your working directory.
the question of branches can be, at least partially, addressed by asking your local git if there are any copies of the current branch on the remote repos (as of the last fetch / pull).
That will tell you what remote repos have it. If there are multiple repos with the same branch the plugin could let you choose which one to link to. if there are none it could encourage you to push it so that you could then open it in github.
note that knowing you have remote repos with the same branch name doesn't mean they're the same branch (could be completely different branch with the same name) OR that they all have the commit you're currently looking at (you could have pulled more recently, or you or they may have rebased). That requires an additional check.
so again, it's really about commits not branches and finding out where the current commit exists.
The text was updated successfully, but these errors were encountered: