From ab9441327b1d55142bee7bf2c41d94e21ad76298 Mon Sep 17 00:00:00 2001 From: Doug Hellmann Date: Fri, 4 May 2018 14:08:23 -0400 Subject: [PATCH] include unchanged files in series_diff_start.sh It's hard to compute how many files changed, because with renames and deletions it can look like more changed than exist now. It's easier to compute how many files *did not* change, by looking at which SHAs are referenced from the git trees at the start and end point. Change-Id: I9e565d3d31352921b81847528d09c6d733196352 Signed-off-by: Doug Hellmann --- tools/series_diff_start.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tools/series_diff_start.sh b/tools/series_diff_start.sh index 29c5592867..eb4f22b53a 100755 --- a/tools/series_diff_start.sh +++ b/tools/series_diff_start.sh @@ -62,6 +62,18 @@ function count_files() { git ls-files | wc -l } +function shas_at_tag() { + # Produce a list of shas used by objects at the tag point + git ls-tree -lr $1 | cut -f3 -d' ' +} + +function count_unchanged_files() { + local start="$1" + local end="$2" + + comm -12 <( shas_at_tag $start | sort ) <( shas_at_tag $end | sort ) | wc -l +} + for repo in $REPOS; do clone_repo $repo cd $repo @@ -88,5 +100,8 @@ for repo in $REPOS; do git diff --stat ${base}..${latest} | tail -n 1 echo + echo "Unchanged files: $(count_unchanged_files $base $latest)" + echo + cd $MYTMPDIR done