diff options
| author | typebrook <typebrook@gmail.com> | 2020-03-02 20:34:54 +0800 |
|---|---|---|
| committer | typebrook <typebrook@gmail.com> | 2020-03-02 20:34:54 +0800 |
| commit | a2497077066d4e26268bdd071851482252e45020 (patch) | |
| tree | f8f9c868abda19dd85744db84367966abe3f944b /tools/check_upstream | |
| parent | af7ce43c718cb6bc0d7aac4633a8113f9a540ec5 (diff) | |
| parent | 00b136155183ae522ca458e540a8cf29bf525e74 (diff) | |
Merge branch 'dev' of github.com:typebrook/settings into dev
Diffstat (limited to 'tools/check_upstream')
| -rwxr-xr-x | tools/check_upstream | 25 |
1 files changed, 25 insertions, 0 deletions
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 @@ | |||
| 1 | #! /bin/bash | ||
| 2 | |||
| 3 | # This script is for repo forked from others | ||
| 4 | # check $1(repo) if upstream branch origin/master is | ||
| 5 | # ahead of local branch $2(default to dev) | ||
| 6 | |||
| 7 | if [ ! -d "$1" ]; then | ||
| 8 | return 0 | ||
| 9 | fi | ||
| 10 | |||
| 11 | head='dev' | ||
| 12 | if [ $# -eq 2 ] | ||
| 13 | then | ||
| 14 | head=$2 | ||
| 15 | fi | ||
| 16 | |||
| 17 | cd "$1" && \ | ||
| 18 | git fetch origin && \ | ||
| 19 | if ! git rev-list "$head" | grep "$(git rev-parse origin/master)" > /dev/null | ||
| 20 | then | ||
| 21 | [[ $(git pull my) == 'Alrady up to date.' ]] || \ | ||
| 22 | echo "New commit at" "$1" | ||
| 23 | fi | ||
| 24 | |||
| 25 | echo "$(date)" check "$1" >> "$SETTING_DIR/log" | ||