aboutsummaryrefslogtreecommitdiffhomepage
path: root/scripts
diff options
context:
space:
mode:
authortypebrook <typebrook@gmail.com>2019-04-18 11:20:05 +0800
committertypebrook <typebrook@gmail.com>2019-04-18 11:20:05 +0800
commitb9767d94390bf96165d65a829d2aab37bda37258 (patch)
tree5a43b9e9273734abae601dafa996dee2bb58e5da /scripts
parent8b2aa66c644e7bf1e2bc129b84da4603f52cae1f (diff)
update
Diffstat (limited to 'scripts')
-rw-r--r--scripts/check_upstream.sh19
-rw-r--r--scripts/sync-vimwiki.cron1
-rwxr-xr-xscripts/sync.sh9
3 files changed, 29 insertions, 0 deletions
diff --git a/scripts/check_upstream.sh b/scripts/check_upstream.sh
new file mode 100644
index 0000000..888061e
--- /dev/null
+++ b/scripts/check_upstream.sh
@@ -0,0 +1,19 @@
1# check git repo $1 if upstream branch
2# origin/master is ahead of local branch $2(default to dev)
3check_upstream() {
4
5 head='dev'
6 if [ $# -eq 2 ]
7 then
8 head=$2
9 fi
10
11 cd ~/$1
12 git fetch origin && \
13 git rev-list $head | grep $(git rev-parse origin/master) > /dev/null
14
15 if [ $? -ne 0 ]
16 then
17 echo "New commit at" $1
18 fi
19}
diff --git a/scripts/sync-vimwiki.cron b/scripts/sync-vimwiki.cron
new file mode 100644
index 0000000..c99487f
--- /dev/null
+++ b/scripts/sync-vimwiki.cron
@@ -0,0 +1 @@
0 * * * * cd ~/vimwiki && git add * && git commit -am "update" && git push
diff --git a/scripts/sync.sh b/scripts/sync.sh
new file mode 100755
index 0000000..26abc22
--- /dev/null
+++ b/scripts/sync.sh
@@ -0,0 +1,9 @@
1#!/bin/bash
2
3DIR="$(cd "$(dirname "$0")" && pwd)"
4source $DIR/check_upstream.sh
5
6cd ~/git/settings && git pull --quiet &
7cd ~/vimwiki && git pull --quiet &
8check_upstream git/tig &
9check_upstream .vim_runtime &