[Linux] Start using git-sync to auto-synchronize directories

This commit is contained in:
2018-06-14 16:00:30 -07:00
parent 2d25a8fe19
commit 7371f0aeaa
3 changed files with 47 additions and 7 deletions

View File

@@ -1,11 +1,22 @@
#!/usr/bin/env bash
cd "$1"
#!/usr/bin/env zsh
echo "Syncing $1"
git-sync
enable_git_sync.sh
cd "$1"
while changedFile=$(inotifywait ./ -r -e modify,move,create,delete --format "%w%f" --exclude '\.git' 2>/dev/null); do
git check-ignore "$changedFile" >> /dev/null || git-sync
counter=0
while true; do
changedFile=$(inotifywait ./ -r -e modify,move,create,delete --format "%w%f" --exclude '\.git' -t 20 2>/dev/null)
if [ -z "$changedFile" ]
then
counter=$((counter+1))
if [ $counter -gt 4 ]; then
git-sync
counter=0
else
git-sync > /dev/null
fi
else
echo "Syncing for: $changedFile"
{ git check-ignore "$changedFile" > /dev/null; } || git-sync
fi
done