Share lock with getdot

This commit is contained in:
Sage Vaillancourt 2024-07-21 12:28:35 -04:00
parent cb2185ab3e
commit 82e05fc333
1 changed files with 8 additions and 3 deletions

View File

@ -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