From ee2ad4e3431eef2acb2c9e0a91c1a5eb24f00d88 Mon Sep 17 00:00:00 2001 From: Luke Carrier Date: Thu, 29 Oct 2020 17:18:17 +0000 Subject: [PATCH] Fix handling of deeply nested charts_dir (#47) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Reinhard Nägele --- cr.sh | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/cr.sh b/cr.sh index 767dc0a..1d5ecc8 100755 --- a/cr.sh +++ b/cr.sh @@ -199,12 +199,8 @@ lookup_changed_charts() { local changed_files changed_files=$(git diff --find-renames --name-only "$commit" -- "$charts_dir") - local fields - if [[ "$charts_dir" == '.' ]]; then - fields='1' - else - fields='1,2' - fi + local depth=$(( $(tr "/" "\n" <<< "$charts_dir" | wc -l) + 1 )) + local fields="1-${depth}" cut -d '/' -f "$fields" <<< "$changed_files" | uniq | filter_charts }