mirror of
https://github.com/hs-web/hsweb-framework.git
synced 2026-05-07 05:36:21 +08:00
18 lines
425 B
Bash
Executable File
18 lines
425 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
# 收集变更模块
|
|
modules=$(git diff --name-only HEAD~1 HEAD | \
|
|
while read file; do
|
|
dir=$(dirname "$file")
|
|
while [ "$dir" != "." ] && [ "$dir" != "/" ]; do
|
|
if [ -f "$dir/pom.xml" ]; then echo "$dir"; break; fi
|
|
dir=$(dirname "$dir")
|
|
done
|
|
done | sort -u | tr '\n' ',' | sed 's/,$//')
|
|
|
|
# 如果为空,则使用默认值 '.'
|
|
if [ -z "$modules" ]; then
|
|
echo "."
|
|
else
|
|
echo "$modules"
|
|
fi |