If I have a certain commit checked out locally, I would like for this plugin to copy/open the link at that commit, if possible.
Two cases:
- The commit checked out locally is a branch which exists in the remote, v1.2.x
- The commit checked out locally does not exist in remote
In case 1), my proposal would be we attempt to generate link using the correct branch name, .../v1.2.x/... for readability when sending links, instead of the full commit. Find a solution which generalizes to handle main/master elegantly.
For case 2), proposal is we take merge-base between the current commit and main/master, and generate the link with this commit .../<commit>/.... Still possible for the link to point to an invalid range, but then it is on the user to ensure the code they are referencing is unchanged between the closest reference point in origin / their HEAD.
Any thoughts/concerns? If not, I can work on a PR for this change.
If I have a certain commit checked out locally, I would like for this plugin to copy/open the link at that commit, if possible.
Two cases:
In case 1), my proposal would be we attempt to generate link using the correct branch name,
.../v1.2.x/...for readability when sending links, instead of the full commit. Find a solution which generalizes to handlemain/masterelegantly.For case 2), proposal is we take merge-base between the current commit and main/master, and generate the link with this commit
.../<commit>/.... Still possible for the link to point to an invalid range, but then it is on the user to ensure the code they are referencing is unchanged between the closest reference point in origin / their HEAD.Any thoughts/concerns? If not, I can work on a PR for this change.