2020-07-17 11:44:59 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
2021-01-20 13:50:58 +00:00
|
|
|
repos() {
|
2021-01-25 14:33:48 +00:00
|
|
|
(for name in $@; do find -L $name -name '*.git' -type d | sed 's/\/.git$//'; done)
|
2021-01-20 13:50:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
for line in $(repos "$@")
|
2020-07-17 11:44:59 +00:00
|
|
|
do
|
|
|
|
dir=$(pwd)
|
|
|
|
cd "$line"
|
|
|
|
if git log -0 2>/dev/null
|
|
|
|
then
|
|
|
|
stat=$(git branch -vv | grep -P '^\*' | grep -Po '\[.*\]')
|
|
|
|
if echo $stat | grep -P 'behind' > /dev/null
|
|
|
|
then echo behind $line
|
|
|
|
fi
|
|
|
|
if echo $stat | grep -P 'ahead' > /dev/null
|
|
|
|
then echo ahead $line
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
cd $dir
|
|
|
|
done
|