From 311141c2c369df20bad62f2edc33860edb092302 Mon Sep 17 00:00:00 2001 From: typebrook Date: Sat, 9 Nov 2019 23:47:47 +0800 Subject: update --- scripts/check_upstream | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100755 scripts/check_upstream (limited to 'scripts/check_upstream') diff --git a/scripts/check_upstream b/scripts/check_upstream new file mode 100755 index 0000000..9f20037 --- /dev/null +++ b/scripts/check_upstream @@ -0,0 +1,27 @@ +#! /bin/bash + +# This script is for repo forked from others +# check $1(repo) if upstream branch origin/master is +# ahead of local branch $2(default to dev) + + +if [ ! -d $1 ]; then + return 0 +fi + +head='dev' +if [ $# -eq 2 ] +then + head=$2 +fi + +cd $1 +git fetch origin && \ +git rev-list $head | grep $(git rev-parse origin/master) > /dev/null + +if [ $? -ne 0 ] +then + echo "New commit at" $1 +fi + +echo $(date) check $1 >> $SETTING_DIR/log -- cgit v1.2.3-70-g09d2