41 lines
911 B
Bash
Executable File
41 lines
911 B
Bash
Executable File
#!/usr/bin/env sh
|
|
set -eu
|
|
|
|
REPO_URL="${REPO_URL:-http://100.64.0.1:30087/virgil-admin/rta-mock-docs.git}"
|
|
TARGET_DIR="${TARGET_DIR:-$HOME/Developer/Section0/rta-mock-docs}"
|
|
|
|
if ! command -v git >/dev/null 2>&1; then
|
|
echo "git is required but was not found on PATH" >&2
|
|
exit 1
|
|
fi
|
|
|
|
if [ -d "$TARGET_DIR/.git" ]; then
|
|
echo "Repo already exists: $TARGET_DIR"
|
|
git -C "$TARGET_DIR" remote set-url origin "$REPO_URL"
|
|
git -C "$TARGET_DIR" fetch origin
|
|
git -C "$TARGET_DIR" checkout main
|
|
git -C "$TARGET_DIR" pull --ff-only
|
|
else
|
|
mkdir -p "$(dirname "$TARGET_DIR")"
|
|
git clone "$REPO_URL" "$TARGET_DIR"
|
|
fi
|
|
|
|
git -C "$TARGET_DIR" config pull.ff only
|
|
|
|
cat <<EOF
|
|
Ready.
|
|
|
|
Repo: $TARGET_DIR
|
|
Remote: $REPO_URL
|
|
|
|
Daily flow:
|
|
cd "$TARGET_DIR"
|
|
git pull --ff-only
|
|
# edit Markdown
|
|
git add .
|
|
git commit -m "Update docs"
|
|
git push
|
|
|
|
AFFiNE updates after the projection operator pulls and runs projection.
|
|
EOF
|