From b9767d94390bf96165d65a829d2aab37bda37258 Mon Sep 17 00:00:00 2001 From: typebrook Date: Thu, 18 Apr 2019 11:20:05 +0800 Subject: update --- scripts/check_upstream.sh | 19 +++++++++++++++++++ scripts/sync-vimwiki.cron | 1 + scripts/sync.sh | 9 +++++++++ 3 files changed, 29 insertions(+) create mode 100644 scripts/check_upstream.sh create mode 100644 scripts/sync-vimwiki.cron create mode 100755 scripts/sync.sh (limited to 'scripts') 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 @@ +# check git repo $1 if upstream branch +# origin/master is ahead of local branch $2(default to dev) +check_upstream() { + + head='dev' + if [ $# -eq 2 ] + then + head=$2 + fi + + cd ~/$1 + git fetch origin && \ + git rev-list $head | grep $(git rev-parse origin/master) > /dev/null + + if [ $? -ne 0 ] + then + echo "New commit at" $1 + fi +} 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 @@ +#!/bin/bash + +DIR="$(cd "$(dirname "$0")" && pwd)" +source $DIR/check_upstream.sh + +cd ~/git/settings && git pull --quiet & +cd ~/vimwiki && git pull --quiet & +check_upstream git/tig & +check_upstream .vim_runtime & -- cgit v1.2.3-70-g09d2