ctrl/sync.sh
This commit is contained in:
12
ctrl/sync.sh
12
ctrl/sync.sh
@@ -7,10 +7,16 @@ REMOTE="${1:-mariano@mcrndeb}"
|
||||
REMOTE_PATH="${2:-~/wdir/cht/}"
|
||||
PROJECT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
|
||||
# Ask git directly what it ignores — more reliable than rsync's .gitignore parsing,
|
||||
# and correctly reflects the current branch after a checkout.
|
||||
EXCLUDE_FILE=$(mktemp)
|
||||
trap "rm -f '$EXCLUDE_FILE'" EXIT
|
||||
|
||||
git -C "$PROJECT_DIR" ls-files --others --ignored --exclude-standard --directory \
|
||||
> "$EXCLUDE_FILE" 2>/dev/null || true
|
||||
|
||||
rsync -avz --delete \
|
||||
--exclude='.git/' \
|
||||
--exclude='media/target/' \
|
||||
--exclude='media/logs/' \
|
||||
--filter=':- .gitignore' \
|
||||
--exclude-from="$EXCLUDE_FILE" \
|
||||
"$PROJECT_DIR/" \
|
||||
"${REMOTE}:${REMOTE_PATH}"
|
||||
|
||||
Reference in New Issue
Block a user