Skip to content

Test hub-fetch-run.py's Unborn-HEAD Rewrite and Its Probe-Failure Path #2321

Closed

Description

@ptr727

Problem

catalog/snippets/hub-fetch-run.py has no tests for its first-commit path. On an unborn HEAD, resolve_unborn_head rewrites --diff HEAD so the prose gate still runs, and head_is_unborn tells a confirmed unborn HEAD apart from a failed probe. Nothing in tests/ covers either function, so a regression could widen the rewrite to other arguments, or treat a probe failure as an unborn repository and skip the gate without any notice.

Copilot raised this on ptr727/KiCadLibrary#70, which carries the snippet byte-for-byte. The fix belongs here, at the canonical source.

Fix

Add focused tests for:

  • only --diff HEAD is rewritten on an unborn HEAD, and every other argument is preserved
  • nothing is rewritten when HEAD has a commit
  • a failed git rev-parse probe, such as a non-zero exit with stderr output or a missing repository, is not read as unborn.

🤖 Generated with Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions