3

Earlier today I was searching for the commit that changed a function name from getReportHtml to getReport.

I couldn't find it using the pickaxe, so I found it by manual searching.

Now that I know which commit had the change, I can see the change in my git diff output:

-               function getReportHtml(filters) {
+               function getReport(type, filters) {

I tried the following searches:

git log -SgetReportHtml
git log -SgetReportHtml --diff-filter=M
git log -GgetReportHtml

They found commits, but not the one that changed the name.

This is the relevant section of the git-log man page:

   -S<string>
       Look for differences that change the number of occurrences of the specified string (i.e. addition/deletion) in a file. Intended for the scripter's use.

       It is useful when you're looking for an exact block of code (like a struct), and want to know the history of that block since it first came into being: use the feature iteratively
       to feed the interesting block in the preimage back into -S, and keep going until you get the very first version of the block.

   -G<regex>
       Look for differences whose patch text contains added/removed lines that match <regex>.

The commit that introduced the change did change the number of occurrences of 'getReportHtml'. So why is it not found by the pickaxe?

Michael Stack
  • 365
  • 6
  • 12
  • 1
    Can you try a `git log --all -GgetReportHtml`? Also, what version of git are you using? – VonC Aug 03 '15 at 06:12

0 Answers0