21 lines
1.1 KiB
Bash
Executable File
21 lines
1.1 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# fork-init.sh <name> [dir] — clone storytold/<name> (Gitea mirror) as a sibling of this repo's parent,
|
|
# add the craft-skills submodule, create the `debrand` branch. Idempotent.
|
|
# Env: GITEA (default https://git.marcospaulo.dev.br), ORG (default storytold), SKILLS_URL.
|
|
set -euo pipefail
|
|
NAME=${1:?usage: fork-init.sh <name> [parent-dir]}
|
|
PARENT=${2:-$(cd "$(dirname "$0")/../.." && pwd)} # sibling dir of the repos (…/Projects)
|
|
GITEA=${GITEA:-https://git.marcospaulo.dev.br}
|
|
ORG=${ORG:-storytold}
|
|
SKILLS_URL=${SKILLS_URL:-$GITEA/storytold/craft-skills.git}
|
|
DEST=$PARENT/$NAME
|
|
[ -d "$DEST/.git" ] || git clone -q "$GITEA/$ORG/$NAME.git" "$DEST"
|
|
cd "$DEST"
|
|
git remote get-url upstream >/dev/null 2>&1 || git remote rename origin upstream
|
|
git config rerere.enabled true
|
|
git checkout -q main
|
|
git checkout -q debrand 2>/dev/null || git checkout -q -b debrand
|
|
[ -e tools/craft-skills/.git ] || [ -f tools/craft-skills/.git ] || git submodule add -q "$SKILLS_URL" tools/craft-skills
|
|
echo "ok $DEST (branch $(git branch --show-current))"
|
|
echo "survey:"; git grep -ilE 'artcraft|discord' | wc -l
|