logerrit |    9 +++++++++
 1 file changed, 9 insertions(+)

New commits:
commit e7a471a8fbac22877973af7e7be8c6a0701b4046
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Fri Mar 5 12:33:53 2021 +0100
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Mon Mar 8 09:27:19 2021 +0100

    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 <vmik...@collabora.com>

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"
 }
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to