summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--bashrc/main.sh16
1 files changed, 15 insertions, 1 deletions
diff --git a/bashrc/main.sh b/bashrc/main.sh
index e8e45ed..47c8d65 100644
--- a/bashrc/main.sh
+++ b/bashrc/main.sh
@@ -13,7 +13,21 @@ cd "${HOME}"
_self_update() {
pushd ${_DOTFILES_DIR} &>/dev/null
- git fetch origin 2>/dev/null
+ # save the origin, the current master is based of
+ if ! git branch | grep old-origin -q; then
+ git branch old-origin origin/master
+ fi
+
+ if hash timeout >/dev/null 2>&1; then
+ timeout 5s git fetch origin 2>/dev/null
+ if [[ "$?" == "124" ]]; then
+ echo -e "\033[31m*\033[0m timeout: git fetch origin"
+ return
+ fi
+ else
+ git fetch origin 2>/dev/null
+ fi
+
if [[ -n "$(git whatchanged HEAD..origin/master)" ]]; then
echo -ne "\033[31m*\033[0m dotfile updates found, merge now? (Y/n) "
read _merge;