git-codereview: accept any commit spelling for mail and submit

Currently the mail and submit subcommands only accept commit hashes.
This makes them inconsistent with other git commands (git is hard
enough without having to remember another convention) and makes
working with multi-commit branches cumbersome.

Change mail and submit to accept any standard commit spelling. In
particular, this makes it possible to use HEAD-relative names: "git
mail HEAD" sends the whole current branch. We still require that the
named commit be pending on the current branch to avoid accidentally
naming a completely unrelated commit.

Change-Id: If84d315e0fc32118a5283adfbca7a3b56f3c098c
Reviewed-by: Russ Cox <>
6 files changed