ansible-log: detect git dir

This commit is contained in:
Victor LABORIE 2017-07-20 11:28:17 +02:00
parent 18511c6fba
commit 399613c06a

View file

@ -7,12 +7,17 @@ ppppid=$(ps -p "$pppid" -o ppid=)
ps --pid "$ppppid" -o command= ps --pid "$ppppid" -o command=
echo "" echo ""
git config --get remote.origin.url if [ -d .git ]; then
git log --pretty="%h - %s" -3 git config --get remote.origin.url
git log --pretty="%h - %s" -3
fi
ansible_cfg=$(ansible --version|grep "config file"|awk -F'=' '{print $2}'|xargs) ansible_cfg=$(ansible --version|grep "config file"|awk -F'=' '{print $2}'|xargs)
roles_path=$(grep "roles_path" $ansible_cfg|awk -F'=' '{print $2}'|sed "s|~|$HOME|"|xargs) roles_path=$(grep "roles_path" $ansible_cfg|awk -F'=' '{print $2}'|sed "s|~|$HOME|"|xargs)
echo "" find $roles_path -type d -name .git|while read git; do
git -C $roles_path config --get remote.origin.url git=$(basename "$git")
git -C $roles_path log --pretty="%h - %s" -3 echo ""
git -C $roles_path config --get remote.origin.url
git -C $roles_path log --pretty="%h - %s" -3
done