From 34719f1706109f3aa73ffaacbe2340f0af870b0d Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Mon, 10 Jun 2019 02:27:36 +0200 Subject: code-review-changed-files: Use `get_merge_base`; Print absolute paths * Use the common merge base from `code-review-database`. * Print an absolute path to the file using `$GIT_ROOT` from `code-review-database`. This allows the paths to be useful even when PWD is a subdirectory in the Git repo. --- code-review-changed-files | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'code-review-changed-files') diff --git a/code-review-changed-files b/code-review-changed-files index 615111f..9b5aa4d 100755 --- a/code-review-changed-files +++ b/code-review-changed-files @@ -1,10 +1,8 @@ #!/bin/sh -git diff --name-only "$@" +SCRIPT="$(dirname "$0")" +source "$SCRIPT/code-review-database" -# Use absolute path in case the PWD is not the Git root -sed "s,/^,$(git rev-parse --show-toplevel)," -$(git rev-parse --show-toplevel) -awk '{ print "[CMD]" $0 }' -git changed-files master.. | grep '_test\.go$' | awk -v git_root=$(git rev-parse --show-toplevel) '{ print git_root "/" $0 }' +git diff --name-only "$(get_merge_base)" | + awk -v git_root="$GIT_ROOT" '{ print git_root "/" $0 }' -- cgit v1.2.3