git-codereview: fix a few corner case failures

- make it clearer what the random git command at the end of failures means
- avoid some problems with detached HEAD mode in hooks run during git rebase
- redirect all stdout/stderr into test buffers

Change-Id: I102f22fc870f69c884728eaa46ecc95792d5b795
Reviewed-on: https://go-review.googlesource.com/2011
Reviewed-by: Andrew Gerrand <adg@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
13 files changed
tree: 42bb2f21a2ca0b2b5327d33d3c60263221b9ca9a
  1. .gitattributes
  2. README
  3. git-codereview/