Add recursion to git_updated function

This way it's possible to use the function to check subdirectories
This commit is contained in:
drymer 2018-06-10 21:30:58 +02:00
parent b788b4171c
commit 25ce97a7f8
1 changed files with 20 additions and 12 deletions

View File

@ -81,22 +81,30 @@ function kenter(){
kubectl exec -ti $1 $2 $3 $command
}
# Comprueba que los repositorios git de un repositorio tienen commits a hacer
# Check that the directories of the main directory are updated git repos
function git_updated() {
for git in `ls --color=none`
local ROOT=`pwd`
local gitstatus
for dir in `ls --color=none | grep -v Archive`
do
if [[ -d $git ]]
then
cd $git
gitstatus="`git status -s | awk '{print $2}'`"
if [[ -n $gitstatus ]]
if [[ -d $dir ]]
then
echo "- \033[0;31m$git\033[0m:\n$gitstatus"
cd $dir
if [[ -d .git ]]
then
gitstatus="`git status -s | awk '{print $2}'`"
cd $ROOT
if [[ -n $gitstatus ]]
then
echo "- \033[0;31m$dir\033[0m:\n$gitstatus"
fi
else
# Recursion at it's finest
git_updated
cd $ROOT
fi
fi
cd ..
fi
done
}