#origin/${target_branch}...origin/dev_cooperatic : we look for difference between develop branch and prod branch
#origin/${coop}_prod...origin/dev_cooperatic : we look for difference between develop branch and prod branch
#--pretty=format:'%s' : get rid of commit id
#--pretty=format:'%s' : get rid of commit id
#the big grep+sed group : discard lines not maching pattern "merge [0-9]\+-... into dev_cooperatic" and only keep the [0-9]\+-.... part with a link to redmine
#the big grep+sed group : discard lines not maching pattern "merge [0-9]\+-... into dev_cooperatic" and only keep the [0-9]\+-.... part with a link to redmine
new_commits="$( git log origin/${target_branch}...origin/dev_cooperatic --merges--oneline--pretty=format:'%s' | grep"into 'dev_cooperatic'" | sed "s/Merge branch '//g" | sed "s/' into 'dev_cooperatic'//g" | grep"^[0-9]\+" | sed -E's/(^[0-9]+)/\<a href=\"https\:\/\/redmine.coopdev.fr\/issues\/\1\"\>\1\<\/a\>/g')"
new_commits="$( git log origin/${coop}_prod...origin/dev_cooperatic --merges--oneline--pretty=format:'%s' | grep"into 'dev_cooperatic'" | sed "s/Merge branch '//g" | sed "s/' into 'dev_cooperatic'//g" | grep"^[0-9]\+" | sed -E's/(^[0-9]+)/\<a href=\"https\:\/\/redmine.coopdev.fr\/issues\/\1\"\>\1\<\/a\>/g')"
if[-z"${new_commits}"];then
if[-z"${new_commits}"];then
echo"${coop}${instance}${repo} : no new commits"
echo"${coop}${instance}${repo} : no new commits"
#As there are no new commits in prod, we don't want to send email for this repo.
#As there are no new commits in prod, we don't want to send email for this repo.