Skip to content

fix: add git editor fallback in devcontainer setup - #393

Merged
c-vigo merged 5 commits into
devfrom
bugfix/383-git-commit-default-editor
Mar 20, 2026
Merged

c-vigo merged 5 commits into
devfrom
bugfix/383-git-commit-default-editor

Conversation

@c-vigo

@c-vigo c-vigo commented Mar 20, 2026

Copy link
Copy Markdown
Contributor

Description

Fixes the devcontainer bug where git commit without -m can fail if a host-provided core.editor is unavailable inside the container. The setup script now applies a safe fallback editor only when needed, and regression coverage validates the behavior.

Type of Change

  • fix -- Bug fix
  • feat -- New feature
  • docs -- Documentation only
  • chore -- Maintenance task (deps, config, etc.)
  • refactor -- Code restructuring (no behavior change)
  • test -- Adding or updating tests
  • ci -- CI/CD pipeline changes
  • build -- Build system or dependency changes
  • revert -- Reverts a previous commit
  • style -- Code style (formatting, whitespace)

Modifiers

  • Breaking change (!) -- This change breaks backward compatibility

Changes Made

  • assets/workspace/.devcontainer/scripts/setup-git-conf.sh
    • Add editor fallback guard that checks configured/effective Git editor availability
    • Set git config --global core.editor nano only when the editor is missing/invalid in-container
  • tests/test_integration.py
    • Add regression test test_setup_git_conf_falls_back_to_nano_for_invalid_editor
    • Reproduce invalid editor config in .devcontainer/.conf/.gitconfig, rerun setup script, assert fallback to nano
  • CHANGELOG.md
    • Add Unreleased/Fixed entry for issue #383
  • assets/workspace/.devcontainer/CHANGELOG.md
    • Sync mirrored changelog entry for the workspace template

Changelog Entry

Fixed

  • Git commit now falls back to nano when editor config is unusable (#383)
    • setup-git-conf.sh now validates the effective Git editor and sets core.editor=nano only when the configured editor is missing or invalid in-container
    • Add integration regression coverage to ensure invalid editor settings are corrected during setup

Testing

  • Tests pass locally (just test)
  • Manual testing performed (describe below)

Manual Testing Details

N/A

Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have updated the documentation accordingly (edit docs/templates/, then run just docs)
  • I have updated CHANGELOG.md in the [Unreleased] section (and pasted the entry above)
  • My changes generate no new warnings or errors
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published

Additional Notes

  • TDD commit sequence used:
    • test(setup): add regression for invalid git editor fallback
    • fix(setup): add git core.editor fallback for container shells
    • docs(image): record git editor fallback fix in changelog
  • Verification commands executed:
    • just build
    • uv run pytest tests/test_integration.py -k test_setup_git_conf_falls_back_to_nano_for_invalid_editor -v --tb=short

Refs: #383

@c-vigo c-vigo self-assigned this Mar 20, 2026
@c-vigo
c-vigo requested a review from Copilot March 20, 2026 09:11

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes an interactive git commit failure mode inside the devcontainer when a host-provided core.editor points to a binary that doesn’t exist in-container, by enforcing a safe editor fallback during container git setup.

Changes:

  • Add setup-git-conf.sh logic to detect unusable configured/effective git editor and set core.editor=nano only when needed.
  • Add an integration regression test covering invalid core.editor fallback behavior.
  • Record the fix in the upstream and workspace-template changelogs (Unreleased/Fixed).

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
assets/workspace/.devcontainer/scripts/setup-git-conf.sh Adds a guarded editor validation + fallback to nano during devcontainer git setup.
tests/test_integration.py Adds an integration regression test that reproduces an invalid editor config and asserts fallback behavior.
CHANGELOG.md Documents the fix under Unreleased → Fixed.
assets/workspace/.devcontainer/CHANGELOG.md Mirrors the changelog entry in the workspace template copy.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/test_integration.py Resolved
@c-vigo
c-vigo enabled auto-merge March 20, 2026 09:59
@c-vigo
c-vigo merged commit 88c97fa into dev Mar 20, 2026
12 checks passed
@c-vigo
c-vigo deleted the bugfix/383-git-commit-default-editor branch March 20, 2026 10:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants