Last active
November 18, 2021 17:59
-
-
Save martint/c5786df73b718b746f5eeb94e35af5e5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
find_in_ancestor() { | |
dir="$2" | |
while [ -n "$dir" ] && [ ! -f "$dir/$1" ]; do | |
dir=${dir%/*} | |
done | |
if [ -f "$dir/$1" ]; then | |
printf '%s\n' "$dir" | |
fi | |
} | |
BRANCH=${1:-master} | |
MODULES=$(git diff --merge-base "$BRANCH" --name-only | \ | |
while read -r file | |
do | |
find_in_ancestor pom.xml "$file" | |
done | \ | |
sort -u | \ | |
tr '\n' ',') | |
echo -am -pl "$MODULES" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment