rework fetch_git code to be independent and use callbacks for logic.