54245f188a
Four git hooks, tracked in .githooks and wired with core.hooksPath so a fresh clone gets them with one config line. pre-commit refuses master and refuses more than 300 changed lines in non-markdown files. Markdown is exempt because docs land as one batch. commit-msg requires (V-<id>), not (#<id>), because Gitea autolinks # to its own issues and that is the wrong tracker. post-checkout records the parent branch, since git does not track where a branch was cut from and the PR needs the base. pre-push opens the PR with tea and never blocks. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
30 lines
725 B
Bash
Executable File
30 lines
725 B
Bash
Executable File
#!/bin/sh
|
|
# Cut a task branch and record the branch it came from, so pre-push can open
|
|
# the PR against the right base.
|
|
#
|
|
# scripts/task-branch.sh 359 narrow-single-token
|
|
# -> task/359-narrow-single-token, parent recorded as the current branch
|
|
|
|
set -eu
|
|
|
|
if [ $# -lt 2 ]; then
|
|
echo "usage: $0 <vikunja-id> <slug>" >&2
|
|
exit 2
|
|
fi
|
|
|
|
id=$1
|
|
shift
|
|
slug=$(printf '%s' "$*" | tr '[:upper:] ' '[:lower:]-' | tr -cd 'a-z0-9-')
|
|
|
|
parent=$(git symbolic-ref --short HEAD)
|
|
branch="task/$id-$slug"
|
|
|
|
git checkout -b "$branch"
|
|
|
|
dir="$(git rev-parse --git-dir)/maven-parent"
|
|
mkdir -p "$dir"
|
|
printf '%s\n' "$parent" > "$dir/$(printf '%s' "$branch" | tr '/' '_')"
|
|
|
|
echo "$branch, cut from $parent"
|
|
echo "Commits on it must end with (V-$id)."
|