break commits_for_path() function into two