Update get-changed-paths.sh
This commit is contained in:
parent
4e8b111da1
commit
262238adca
@ -8,6 +8,11 @@ INPUT_SEPARATOR="${INPUT_SEPARATOR//$'\n'/'%0A'}"
|
|||||||
INPUT_SEPARATOR="${INPUT_SEPARATOR//$'\r'/'%0D'}"
|
INPUT_SEPARATOR="${INPUT_SEPARATOR//$'\r'/'%0D'}"
|
||||||
|
|
||||||
GITHUB_OUTPUT=${GITHUB_OUTPUT:-""}
|
GITHUB_OUTPUT=${GITHUB_OUTPUT:-""}
|
||||||
|
DIFF="..."
|
||||||
|
|
||||||
|
if [[ -z $GITHUB_BASE_REF ]]; then
|
||||||
|
DIFF=".."
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ $INPUT_QUOTEPATH == "false" ]]; then
|
if [[ $INPUT_QUOTEPATH == "false" ]]; then
|
||||||
git config --global core.quotepath off
|
git config --global core.quotepath off
|
||||||
@ -24,8 +29,8 @@ function get_diff() {
|
|||||||
sha="$2"
|
sha="$2"
|
||||||
filter="$3"
|
filter="$3"
|
||||||
while IFS='' read -r sub; do
|
while IFS='' read -r sub; do
|
||||||
sub_commit_pre="$(git diff "$base"..."$sha" -- "$sub" | grep '^[-]Subproject commit' | awk '{print $3}')"
|
sub_commit_pre="$(git diff "$base$DIFF$sha" -- "$sub" | grep '^[-]Subproject commit' | awk '{print $3}')"
|
||||||
sub_commit_cur="$(git diff "$base"..."$sha" -- "$sub" | grep '^[+]Subproject commit' | awk '{print $3}')"
|
sub_commit_cur="$(git diff "$base$DIFF$sha" -- "$sub" | grep '^[+]Subproject commit' | awk '{print $3}')"
|
||||||
if [ -n "$sub_commit_cur" ]; then
|
if [ -n "$sub_commit_cur" ]; then
|
||||||
(
|
(
|
||||||
cd "$sub" && (
|
cd "$sub" && (
|
||||||
@ -37,9 +42,9 @@ function get_diff() {
|
|||||||
done < <(git submodule | awk '{print $2}')
|
done < <(git submodule | awk '{print $2}')
|
||||||
|
|
||||||
if [[ "$INPUT_DIR_NAMES" == "true" ]]; then
|
if [[ "$INPUT_DIR_NAMES" == "true" ]]; then
|
||||||
git diff --diff-filter="$filter" --name-only --ignore-submodules=all "$base"..."$sha" | xargs -I {} dirname {} | uniq
|
git diff --diff-filter="$filter" --name-only --ignore-submodules=all "$base$DIFF$sha" | xargs -I {} dirname {} | uniq
|
||||||
else
|
else
|
||||||
git diff --diff-filter="$filter" --name-only --ignore-submodules=all "$base"..."$sha"
|
git diff --diff-filter="$filter" --name-only --ignore-submodules=all "$base$DIFF$sha"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -47,8 +52,8 @@ function get_renames() {
|
|||||||
base="$1"
|
base="$1"
|
||||||
sha="$2"
|
sha="$2"
|
||||||
while IFS='' read -r sub; do
|
while IFS='' read -r sub; do
|
||||||
sub_commit_pre="$(git diff "$base"..."$sha" -- "$sub" | grep '^[-]Subproject commit' | awk '{print $3}')"
|
sub_commit_pre="$(git diff "$base$DIFF$sha" -- "$sub" | grep '^[-]Subproject commit' | awk '{print $3}')"
|
||||||
sub_commit_cur="$(git diff "$base"..."$sha" -- "$sub" | grep '^[+]Subproject commit' | awk '{print $3}')"
|
sub_commit_cur="$(git diff "$base$DIFF$sha" -- "$sub" | grep '^[+]Subproject commit' | awk '{print $3}')"
|
||||||
if [ -n "$sub_commit_cur" ]; then
|
if [ -n "$sub_commit_cur" ]; then
|
||||||
(
|
(
|
||||||
cd "$sub" && (
|
cd "$sub" && (
|
||||||
@ -60,9 +65,9 @@ function get_renames() {
|
|||||||
done < <(git submodule | awk '{print $2}')
|
done < <(git submodule | awk '{print $2}')
|
||||||
|
|
||||||
if [[ "$INPUT_DIR_NAMES" == "true" ]]; then
|
if [[ "$INPUT_DIR_NAMES" == "true" ]]; then
|
||||||
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
|
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
|
||||||
else
|
else
|
||||||
git log --name-status --ignore-submodules=all "$base"..."$sha" | grep -E "^R" | awk -F '\t' -v d="$INPUT_OLD_NEW_SEPARATOR" '{print $2d$3}'
|
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}'
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user