General developer forum

Finding exact specific (date-based) Moodle version in git

 
Picture of Olli Savolainen
Finding exact specific (date-based) Moodle version in git
Core developers

Hi,

I am debugging a site that has lots of customizations and no good documentation on what exactly has been changed about Moodle. So I need to get the exact date-based version of unchanged Moodle to be able to compare and see what changes they've made to the code.

Now, it's easy to get a specific branch. But how would I find the exact commit in git for a specific Moodle date version, say, if it is something like

$version  = 2018051700.00;
(Of course in practice it would be a lot older.)

I found (and lost) an old webpage that had instructions for a git command for this, but that didn't seem to work so I assume it was for an older git version or something.

Thanks!

 
Average of ratings: -
Tim at Lone Pine Koala Sanctuary
Re: Finding exact specific (date-based) Moodle version in git
Core developersDocumentation writersParticularly helpful MoodlersPlugin developers
git log -S '2018051700.00' upstream/master # OR upstream/MOODLE_35_STABLE

Will find any commit that adds or removes the given string. That gets you to a relatively narrow range of commits.

I think the $release  = '3.6dev (Build: 20180524)'; line in config.php might give you even more information.

Another thing you can then use is something like

git log --pretty=%h 46574904afd39578fa..6b2e04676a6ccfe | xargs -i git diff --shortstat {}

That will show how many lines differ between each of those commits and your current code. Looking for a minimum of that might be the commit you want.



 
Average of ratings: Useful (3)
Picture of Olli Savolainen
Re: Finding exact specific (date-based) Moodle version in git
Core developers

Thanks Tim!

git log -S '2018051700.00' upstream/MOODLE_35_STABLE
is what I needed. Adding the correct stable branch makes the search much quicker.

Not sure I understand what you meant by the latter part and what that actually does, but no matter.

 
Average of ratings: -