From 00b136155183ae522ca458e540a8cf29bf525e74 Mon Sep 17 00:00:00 2001 From: typebrook Date: Thu, 27 Feb 2020 16:32:37 +0800 Subject: update --- tools/check_upstream | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100755 tools/check_upstream (limited to 'tools/check_upstream') diff --git a/tools/check_upstream b/tools/check_upstream new file mode 100755 index 0000000..3313e5b --- /dev/null +++ b/tools/check_upstream @@ -0,0 +1,25 @@ +#! /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 && \ +if ! git rev-list "$head" | grep "$(git rev-parse origin/master)" > /dev/null +then + [[ $(git pull my) == 'Alrady up to date.' ]] || \ + echo "New commit at" "$1" +fi + +echo "$(date)" check "$1" >> "$SETTING_DIR/log" -- cgit v1.2.3-70-g09d2