ansible-log: detect git dir

This commit is contained in:
Victor LABORIE 2017-07-20 11:28:17 +02:00
parent 18511c6fba
commit 399613c06a
1 changed files with 10 additions and 5 deletions

View File

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