Skip to content

Commit

Permalink
Update spacing and revert changes to git log commands.
Browse files Browse the repository at this point in the history
  • Loading branch information
jackton1 committed Oct 21, 2022
1 parent b670630 commit 711eaef
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions get-changed-paths.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,12 @@ function get_diff() {
filter="$3"
while IFS='' read -r sub; do
sub_commit_pre="$(git diff "$base$DIFF$sha" -- "$sub" | grep '^[-]Subproject commit' | 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"
exit 1
fi

sub_commit_cur="$(git diff "$base$DIFF$sha" -- "$sub" | grep '^[+]Subproject commit' | awk '{print $3}')" && exit_status=$? || exit_status=$?

if [[ $exit_status -ne 0 ]]; then
echo "::error::Failed to get current commit for submodule ($sub) between: $base$DIFF$sha"
exit 1
Expand All @@ -64,7 +62,7 @@ function get_diff() {
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 diff between: $base$DIFF$sha"
echo "::error::Failed to get changed files between: $base$DIFF$sha"
exit 1
fi
fi
Expand All @@ -75,14 +73,12 @@ function get_renames() {
sha="$2"
while IFS='' read -r sub; do
sub_commit_pre="$(git diff "$base$DIFF$sha" -- "$sub" | grep '^[-]Subproject commit' | 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"
exit 1
fi

sub_commit_cur="$(git diff "$base$DIFF$sha" -- "$sub" | grep '^[+]Subproject commit' | awk '{print $3}')" && exit_status=$? || exit_status=$?

if [[ $exit_status -ne 0 ]]; then
echo "::error::Failed to get current commit for submodule ($sub) between: $base$DIFF$sha"
exit 1
Expand All @@ -99,17 +95,17 @@ function get_renames() {
done < <(git submodule | awk '{print $2}')

if [[ "$INPUT_DIR_NAMES" == "true" ]]; then
git log --name-status --ignore-submodules=all "$base$DIFF$sha" | grep -E "^R" | awk -F '\t' -v d="$INPUT_OLD_NEW_SEPARATOR" '{print $2d$3}' | xargs -I {} dirname {} | uniq && exit_status=$? || exit_status=$?
git log --name-status --ignore-submodules=all "$base" "$sha" | grep -E "^R" | awk -F '\t' -v d="$INPUT_OLD_NEW_SEPARATOR" '{print $2d$3}' | xargs -I {} dirname {} | uniq && exit_status=$? || exit_status=$?

if [[ $exit_status -ne 0 ]]; then
echo "::error::Failed to get renamed directories between: $base$DIFF$sha"
echo "::error::Failed to get renamed directories between: $base$sha"
exit 1
fi
else
git log --name-status --ignore-submodules=all "$base$DIFF$sha" | grep -E "^R" | awk -F '\t' -v d="$INPUT_OLD_NEW_SEPARATOR" '{print $2d$3}' && exit_status=$? || exit_status=$?
git log --name-status --ignore-submodules=all "$base" "$sha" | grep -E "^R" | awk -F '\t' -v d="$INPUT_OLD_NEW_SEPARATOR" '{print $2d$3}' && exit_status=$? || exit_status=$?

if [[ $exit_status -ne 0 ]]; then
echo "::error::Failed to get renames between: $base$DIFF$sha"
echo "::error::Failed to get renamed files between: $base$sha"
exit 1
fi
fi
Expand Down

0 comments on commit 711eaef

Please sign in to comment.