Option to replace the commit hash in URL with branch name when browsing source tree (BB-8297)

Issue #7150 open
Edi Modrić
created an issue

Please see here for discussion:

https://answers.atlassian.com/questions/160170/bitbucket-urls-when-browsing-repos-always-contain-hash

tl;dr

It would be nice to provide an option to create URLs with branch name instead of commit hash when browsing the repo. For the most part, when I link to file or folder in the repo, I want the link to point to the latest commit in the branch, and not the specific one.

GitHub does it nicely by generating URLs like this: https://github.com/symfony/symfony-standard/tree/master/src

Comments (11)

  1. Brodie Rao

    Hi Edi,

    I agree that this would be nice to have. It's unfortunately not a trivial thing to do, as we have some issues around branch/tag names with slashes in them that we'd need to resolve before we do this.

    In the meantime, I've put an issue in our backlog. Hopefully we can look into it soon. Thanks for the report!

  2. Peter Bittner

    Just to make sure we're all on the same page,

    readable URLs (without commit hash) are working on Bitbucket. They look like this:

    https://bitbucket.org/{team-or-username}/{repo}/src/{branch-commit-or-tag}/{filename-or-path}#cl-{line-number}
    

    The line number bit, #...., naturally, is optional. So, there's not even a tree/ and blob/ part in the URL that bothers me on GitHub. Instead, it's always src/ here, the rest of the URL scheme is identical.

    Here is an Example:

    Any long, default URL, such as ...

    https://bitbucket.org/bittner/django-organice/src/d8819f8d9c52acd8c32e551a0340b7cde1ed498a/organice/settings.py?at=master#cl-4

    ... can be rewritten in this shorter, more beautiful, readable version ...

    https://bitbucket.org/bittner/django-organice/src/master/organice/settings.py#cl-4

    ... and it's working fine! (NOTE: the selected branch moves from the query string to the place where the commit hash is in the default URL scheme.)

    Left to Do

    The only thing that bothers now is that the shorter, beautiful URL scheme is not the default on Bitbucket. :-( Any plans on changing the default?

  3. Már Örlygsson

    It is super annoying to see that this fairly straightforward feature-request lies untouched for 2-3 years! ...like so many others.

    Please make this the default behaviour - unless you're waiting for someone to write a browser-extension to fix this on the client side. :-)

  4. Jim Nasby

    Yeah, this is extremely annoying. Github handles this correctly: by default you get "master" in the URL instead of the hash. This makes a LOT more sense for general usage!

  5. evanxdotter

    Yes GitHub handles this well - has always been the most annoying thing about Bitbucket for me, sharing the URL for a source file - latest of master, and got massive long URL with hash and query params too - and then i update the file when i review it and have to nagivate and share a new URL

  6. Alastair Wilkes staff
    • changed status to open

    Hi y'all,

    We'd love to do this! However, the main issue with this is that (some of the) URL patterns used across the site don't support branch names that contain / characters (since / is used as a delimiter), so we can't set the branch name as the default ☹ We've been fixing this moving forward for new URL patterns, but we have not tackled it yet for already-existing parts of the site like the source browser.

    Alastair

  7. Log in to comment