diff --git a/get-changed-paths.sh b/get-changed-paths.sh index 9d76745b..f6666158 100755 --- a/get-changed-paths.sh +++ b/get-changed-paths.sh @@ -69,12 +69,11 @@ function get_diff() { local base="$1" local sha="$2" local filter="$3" - local diff="${4:-$DIFF}" while IFS='' read -r sub; do sub_commit_pre="$(git diff "$base" "$sha" -- "$sub" | { grep '^[-]Subproject commit' || true; } | awk '{print $3}')" && exit_status=$? || exit_status=$? if [[ $exit_status -ne 0 ]]; then - echo "::error::Failed to get previous commit for submodule ($sub) between: $base$DIFF$sha" + echo "::error::Failed to get previous commit for submodule ($sub) between: $base $sha" return 1 fi @@ -88,13 +87,13 @@ function get_diff() { ( cd "$sub" && ( # the strange magic number is a hardcoded "empty tree" commit sha - get_diff "${sub_commit_pre:-4b825dc642cb6eb9a060e54bf8d69288fbee4904}" "${sub_commit_cur}" "$filter" ".." | awk -v r="$sub" '{ print "" r "/" $0}' + git diff --diff-filter="$filter" --name-only --ignore-submodules=all "${sub_commit_pre:-4b825dc642cb6eb9a060e54bf8d69288fbee4904}" "${sub_commit_cur}" | awk -v r="$sub" '{ print "" r "/" $0}' ) ) fi done < <(git submodule | awk '{print $2}') - git diff --diff-filter="$filter" --name-only --ignore-submodules=all "$base$diff$sha" && exit_status=$? || exit_status=$? + git diff --diff-filter="$filter" --name-only --ignore-submodules=all "$base$DIFF$sha" && exit_status=$? || exit_status=$? if [[ $exit_status -ne 0 ]]; then echo "::error::Failed to get changed files between: $base$DIFF$sha"