summaryrefslogtreecommitdiffstats
path: root/logerrit
diff options
context:
space:
mode:
Diffstat (limited to 'logerrit')
-rwxr-xr-xlogerrit9
1 files changed, 9 insertions, 0 deletions
diff --git a/logerrit b/logerrit
index 1d75904578e1..bae806a5939e 100755
--- a/logerrit
+++ b/logerrit
@@ -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"
}