diff options
author | typebrook <typebrook@gmail.com> | 2019-11-09 23:47:28 +0800 |
---|---|---|
committer | typebrook <typebrook@gmail.com> | 2019-11-09 23:47:28 +0800 |
commit | 4f8f16e018f5eefc207d8bc59422fb2145595588 (patch) | |
tree | 5b61b27b84027c94a1ff337cb615232c73e565c4 /scripts/check_upstream.sh | |
parent | d70ecd3278c17f222b513008820a9cf43914ec03 (diff) |
update
Diffstat (limited to 'scripts/check_upstream.sh')
-rwxr-xr-x | scripts/check_upstream.sh | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/scripts/check_upstream.sh b/scripts/check_upstream.sh index c08b3cf..9f20037 100755 --- a/scripts/check_upstream.sh +++ b/scripts/check_upstream.sh | |||
@@ -1,27 +1,27 @@ | |||
1 | #! /bin/bash | ||
2 | |||
1 | # This script is for repo forked from others | 3 | # This script is for repo forked from others |
2 | # check $1(repo) if upstream branch origin/master is | 4 | # check $1(repo) if upstream branch origin/master is |
3 | # ahead of local branch $2(default to dev) | 5 | # ahead of local branch $2(default to dev) |
4 | 6 | ||
5 | check_upstream() { | ||
6 | 7 | ||
7 | if [ ! -d $1 ]; then | 8 | if [ ! -d $1 ]; then |
8 | return 0 | 9 | return 0 |
9 | fi | 10 | fi |
10 | 11 | ||
11 | head='dev' | 12 | head='dev' |
12 | if [ $# -eq 2 ] | 13 | if [ $# -eq 2 ] |
13 | then | 14 | then |
14 | head=$2 | 15 | head=$2 |
15 | fi | 16 | fi |
16 | 17 | ||
17 | cd $1 | 18 | cd $1 |
18 | git fetch origin && \ | 19 | git fetch origin && \ |
19 | git rev-list $head | grep $(git rev-parse origin/master) > /dev/null | 20 | git rev-list $head | grep $(git rev-parse origin/master) > /dev/null |
20 | 21 | ||
21 | if [ $? -ne 0 ] | 22 | if [ $? -ne 0 ] |
22 | then | 23 | then |
23 | echo "New commit at" $1 | 24 | echo "New commit at" $1 |
24 | fi | 25 | fi |
25 | 26 | ||
26 | echo $(date) check $1 >> $SETTING_DIR/log | 27 | echo $(date) check $1 >> $SETTING_DIR/log |
27 | } | ||