Replace in function set_repo_id tail recursion to loop