I want to add a pre-commit hook to run yapf on changed changed in a commit. I use
git diff --name-only --line-prefix=`git rev-parse --show-toplevel`
to get the list of full file names modified in a commit.
I am not sure on how to run yapf on the list of files produced by the above command as part of git pre-commit hook. I tried executing in bash
git diff --name-only --line-prefix=`git rev-parse --show-toplevel` | yapf -i
but it says yapf: error: cannot use --in-place or --diff flags when reading from stdin
. My question here is there a way to run yapf on a list of changed files?