git-review: add gofmt command

- move gofmt invocation code from hook.go into gofmt.go
- use true branch point instead of HEAD^
- handle gofmt errors (syntax errors in Go files)
- apply gofmt command to both index and working tree, independently
- fix gofmt pre-commit hook to use index, not working tree

Change-Id: I7ed11c52531bb63b8af9ca5dd881bbfcdf5d5413
Reviewed-on: https://go-review.googlesource.com/1682
Reviewed-by: Andrew Gerrand <adg@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
9 files changed
tree: 905b12021663cf71990cec8282f6b93ee7c6480c
  1. README
  2. git-review/