Skip to content

Permalinks for volatile links in comments #1448

Closed

Description

@sonicdoe

Sometimes I stumble upon comments that link to a specific location on a repository’s default branch. For example: https://github.com/sindresorhus/refined-github/blob/master/source/libs/api.js#L3.

Such links are quite volatile, therefore, it would be awesome if Refined GitHub would add a “View link at the time of this comment” button next to such links.

This would be very similar to the existing “View repo at the time of this comment” functionality (#732), however, it would work for links to specific locations and for links to repositories other than the one where the comment was posted.

Activity

  1. fregante commented on Sep 14, 2018

    @fregante
    Member

    I’m wondering if this should just be automatic. It’s easier to reach the latest version than it is to reach the linked version.

  2. sindresorhus commented on Sep 14, 2018

    @sindresorhus
    Member

    @bfred-it You are assuming that the commenter meant to link to the commit at the time of the comment, but they might as well have been talking about just a file in general, which they want to show the latest version of.

  3. fregante commented on Sep 14, 2018

    @fregante
    Member

    That’s why I said it’s easier to reach the latest version than the other way around. I could see why this might not be desirable though.

    However if the link points to a line, I’d assume that the author meant that line at that point in time and nothing else.

    I can’t think of a sensible way to do this (other than adding yet another icon next to each comment)

    Perhaps in the new comment dropdown? Could the previous functionality also be moved in there?

  4. sindresorhus commented on Sep 17, 2018

    @sindresorhus
    Member

    However if the link points to a line, I’d assume that the author meant that line at that point in time and nothing else.

    This I agree with. Here the intention is clear.

  5. sindresorhus commented on Nov 7, 2018

    @sindresorhus
    Member

    PR welcome.


    For anyone that wants this, please also send this feature request to GitHub: [email protected]

  6. fregante commented on Nov 7, 2018

    @fregante
    Member

    Implemented how? We discussed a few options.

    I think the cleanest way would be to give a button to change all the non-perma-links to permalinks. Ideally on the whole thread. Perhaps a keyboard shortcut (as undiscoverable as that may be)

    Better yet, add the "code" icon next to all non-perma-links, like we do in the comment headers. Perhaps a bit noisy but pretty straightforward.

  7. cuschk commented on Dec 12, 2018

    @cuschk

    After running into links where the line numbers didn't match anymore after some time, I believe that links to code lines should always be permalinks pointing to a specific commit.

    I like the way Bitbucket implemented this: When clicking a link to a line of code, the branch name is automatically replaced by the current commit hash in window.location. This way users can always copy a real permalink pointing to the commit. It would be great if that also worked on GitHub.

    For existing links in comments or links from users who don't use this great extension, I agree with the proposed solution.

  8. self-assigned this
    on Mar 18, 2019
  9. removed their assignment
    on Mar 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions