mirror of
https://github.com/tj-actions/changed-files
synced 2024-12-17 13:47:20 +00:00
Updated get_diff
This commit is contained in:
parent
6164e1cd7f
commit
5e8b123b3d
1 changed files with 3 additions and 4 deletions
|
@ -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"
|
||||
|
|
Loading…
Reference in a new issue