Searching for a commit that introduced a given code snippet

Issue #15598 wontfix
created an issue

Let's say I'm on a file page in source browser and I found the following line in it:

if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {

I'd like to know which commit introduced it. Currently my only option seems to be scrolling up to the top and going through all commits that affected this file.

I think being able to search for that piece of code within all commits of this given file would help.

Tried to make my explanation short yet meaningful, please let me know if I haven't succeeded :) Thanks for the amazing product by the way!

Comments (2)

  1. Alastair Wilkes staff

    Hi Alex,

    Thanks for the feedback. I agree, this would be super useful - I was actually faced with this just yesterday!

    However this is not possible today because we only index the HEAD of master branch for search for scale reasons - indexing the contents of every commit would blow up the size of our indexes. I don't think that's going to change any time soon, so unfortunately I'm going to have to close this one as "won't fix." Sorry!

    Bitbucket PM

  2. Log in to comment