From 9ecc088e06b64763dbdb0ab4422a287c455a4c51 Mon Sep 17 00:00:00 2001 From: Doug Hellmann Date: Fri, 4 May 2018 14:44:47 -0400 Subject: [PATCH] ignore empty files when looking for unchanged files Change-Id: Iddc83ff475762dba885db03734933276498f7c5b Signed-off-by: Doug Hellmann --- tools/series_diff_start.sh | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/tools/series_diff_start.sh b/tools/series_diff_start.sh index c0da69aa5a..22fb1564f8 100755 --- a/tools/series_diff_start.sh +++ b/tools/series_diff_start.sh @@ -62,18 +62,36 @@ function count_files() { git ls-files | wc -l } -function shas_at_tag() { - # Produce a list of shas used by objects at the tag point +function git_ls_tree() { local tag="$1" local extension="$2" if [ -z "$extension" ]; then - git ls-tree -lr $tag | cut -f3 -d' ' + git ls-tree -lr $tag else - git ls-tree -lr $tag | grep ${extension}'$' | cut -f3 -d' ' + git ls-tree -lr $tag | grep ${extension}'$' fi } +function shas_at_tag() { + # Produce a list of shas used by objects representing files with + # real content at the tag point + local tag="$1" + local extension="$2" + + local mode + local type + local sha + local size + local filename + + git_ls_tree $tag $extension | while read mode type sha size filename; do + if [ "$size" != "0" ]; then + echo $sha + fi + done +} + function count_unchanged_files() { local start="$1" local end="$2"