Optimization: only run "git-rev-list HEAD" once.