diff options
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/check_upstream.sh | 36 | ||||
-rwxr-xr-x | scripts/sync.sh | 3 |
2 files changed, 18 insertions, 21 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 | } | ||
diff --git a/scripts/sync.sh b/scripts/sync.sh index fa37fee..5591203 100755 --- a/scripts/sync.sh +++ b/scripts/sync.sh | |||
@@ -1,8 +1,5 @@ | |||
1 | #!/bin/bash | 1 | #!/bin/bash |
2 | 2 | ||
3 | DIR="$(cd "$(dirname "$0")" && pwd)" | ||
4 | source $DIR/check_upstream.sh | ||
5 | |||
6 | cd $SETTING_DIR && git pull --quiet & | 3 | cd $SETTING_DIR && git pull --quiet & |
7 | cd ~/vimwiki && git pull --quiet & | 4 | cd ~/vimwiki && git pull --quiet & |
8 | check_upstream ~/git/tig & | 5 | check_upstream ~/git/tig & |