Use git-log rather than the shell, git-rev-list, and git-diff-tree.