git-codereview: fix hook installation in git 2.13.0

git 2.13.0 changed the behavior of git rev-parse --git-path from
printing a path relative to the repo root to printing a path relative
to the working directory. This breaks git-codereview's hook
installation when a git-codereview command is invoked from a directory
other than the repo root, since it will try to resolve this path as
relative to the repo root.

Fix this by running git rev-parse from the repo root, so it behaves
the same either way.

Fixes golang/go#19477.

Change-Id: Ia5e1b81da5041365d817daf9f5979df0772ede4b
Reviewed-by: Russ Cox <>
2 files changed