Fixes #778 ## Changes Add git identity warning to preflight_check() (warns if user.name/user.email missing) and auto-configure repo-local identity in setup_ops_repo() before the seed commit. This prevents init from failing late when git identity is not configured globally. Co-authored-by: openhands <openhands@all-hands.dev> Reviewed-on: https://codeberg.org/johba/disinto/pulls/780 Reviewed-by: Disinto_bot <disinto_bot@noreply.codeberg.org>
This commit is contained in:
parent
f918e26cce
commit
4251f9fb0e
2 changed files with 24 additions and 8 deletions
19
bin/disinto
19
bin/disinto
|
|
@ -808,6 +808,14 @@ OPSEOF
|
|||
|
||||
# Commit and push seed content
|
||||
if [ "$seeded" = true ] && [ -d "${ops_root}/.git" ]; then
|
||||
# Auto-configure repo-local git identity if missing (#778)
|
||||
if [ -z "$(git -C "$ops_root" config user.name 2>/dev/null)" ]; then
|
||||
git -C "$ops_root" config user.name "disinto-admin"
|
||||
fi
|
||||
if [ -z "$(git -C "$ops_root" config user.email 2>/dev/null)" ]; then
|
||||
git -C "$ops_root" config user.email "disinto-admin@localhost"
|
||||
fi
|
||||
|
||||
git -C "$ops_root" add -A
|
||||
if ! git -C "$ops_root" diff --cached --quiet 2>/dev/null; then
|
||||
git -C "$ops_root" commit -m "chore: seed ops repo structure" -q
|
||||
|
|
@ -947,6 +955,17 @@ preflight_check() {
|
|||
fi
|
||||
fi
|
||||
|
||||
# ── Git identity check ──
|
||||
if command -v git &>/dev/null; then
|
||||
local git_name git_email
|
||||
git_name=$(git config user.name 2>/dev/null) || git_name=""
|
||||
git_email=$(git config user.email 2>/dev/null) || git_email=""
|
||||
if [ -z "$git_name" ] || [ -z "$git_email" ]; then
|
||||
echo "Warning: git user.name/user.email not configured" >&2
|
||||
echo " Init will set a repo-local identity for ops commits" >&2
|
||||
fi
|
||||
fi
|
||||
|
||||
# ── Optional tools (warn only) ──
|
||||
if ! command -v docker &>/dev/null; then
|
||||
echo "Warning: docker not found (needed for Forgejo provisioning)" >&2
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue