git-codereview: refactor getOutput/getLines into cmdOutput, trim, lines, nonBlankLines

This CL separates the "run the command and gather output" from
the "process output" operations. Doing so makes the desired
processing clearer, makes the processing available for use on
other text sources.

Also, add cmdOutputDir, for running a command in a different
directory. This is needed by the gofmt command to work around
a bug in Git, and it's made much easier by the above separation.

Change-Id: I2addd8b79dab2d4aa8a24c94a8d7b3a16a8e3484
Reviewed-by: Alex Brainman <>
Reviewed-by: Andrew Gerrand <>
7 files changed
tree: 077a06c9d16c021a5620a4fe3e398592bd96e5e7
  1. .gitattributes
  3. git-codereview/