logerrit: do not submit if parent is older than a week

Change-Id: Ieb20b3086082bd0a88e457b0ae922234ce737b8a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112009
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
This commit is contained in:
Xisco Fauli 2021-03-05 12:33:53 +01:00 committed by Miklos Vajna
parent 818a84c4b2
commit e7a471a8fb

View file

@ -22,6 +22,15 @@ submit() {
fi
echo "no branch specified, guessing current branch $BRANCH"
fi
if [ "$BRANCH" = "master" ]; then
WEEKOLDDATE=$(date --date="7 days ago" +%s)
PARENTDATE=$(git show -s --format=%ct HEAD~1)
if [[ $PARENTDATE -lt $WEEKOLDDATE ]]; then
echo "Your branch is older than a week, do './g pull -r' and retry"
exit 1
fi
fi
git push "$GERRITURL" "HEAD:refs/for/$BRANCH$TYPE"
}