aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeddy Wing2019-06-10 02:27:36 +0200
committerTeddy Wing2019-06-10 02:27:36 +0200
commit34719f1706109f3aa73ffaacbe2340f0af870b0d (patch)
tree91b99cd5ca1a20e80832056826672f72e90ca8b4
parent4bc1b0964246c64c6cc82f851817f3ea58fc67d4 (diff)
downloadcode-review-34719f1706109f3aa73ffaacbe2340f0af870b0d.tar.bz2
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.
-rwxr-xr-xcode-review-changed-files10
1 files changed, 4 insertions, 6 deletions
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 }'