#!/bin/bash
set -eu

export GIT_SINCE=${1:-"origin/stable"}
export GIT_UNTIL=${2:-"HEAD"}

git fetch --quiet

git submodule foreach --quiet '\
  cd "$toplevel" \
  && git diff ${GIT_SINCE}...${GIT_UNTIL} --submodule=log --no-ext-diff -- "$path" \
     | sed -e "s/  > /- /" \
     | sed -e "s/Submodule \([a-zA-Z_-]*\).*/### \1\\
\
     /" \
     | grep -s "." \
     && echo "" \
  ; cd "$OLDPWD"\
'
