From 82e05fc3338f50fb4bf5a116c369e60e9bc9bd95 Mon Sep 17 00:00:00 2001 From: Sage Vaillancourt Date: Sun, 21 Jul 2024 12:28:35 -0400 Subject: [PATCH] Share lock with getdot --- fake_home/.zshrc | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/fake_home/.zshrc b/fake_home/.zshrc index 6197d64..b5e030b 100644 --- a/fake_home/.zshrc +++ b/fake_home/.zshrc @@ -203,8 +203,7 @@ function load-extensions { done } -function pushdot { - cd "$DOT_DIR" || return 1 +function dot-lock-wait { if test -f "$SYNC_LOCK_FILE"; then echo "Sync lockfile present at '$SYNC_LOCK_FILE'" echo "Waiting for ongoing sync to finish" @@ -215,7 +214,12 @@ function pushdot { fi done fi - touch "$SYNC_LOCK_FILE" +} + +function pushdot { + cd "$DOT_DIR" || return 1 + dot-lock-wait + echo "$$" > "$SYNC_LOCK_FILE" local res if ! git diff --quiet; then if [ $# -eq 0 ]; then @@ -264,6 +268,7 @@ function getdot { echo "An alias for scpace has not been defined on this device!" return 1 fi + dot-lock-wait cd "$DOT_DIR" || return 1 git pull && ./copy.sh