fix(pull): allow the first fast-forward into an unborn branch #394
No reviewers
Labels
No labels
breaking
bug
documentation
enhancement
epic
good first issue
help wanted
refactoring
resolution/duplicate
resolution/invalid
resolution/wontfix
security
severity/critical
severity/high
severity/low
severity/medium
status/abandoned
status/blocked
status/needs-decision
status/needs-info
status/needs-verification
testing
upstream
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
sixfold-space/madtea!394
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "issue-373-fixpull-unborn-branch-misread-as-dirty-diff-index"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
An unborn local branch that already tracks a populated origin was misread as dirty, so
madtea pullrefused the first fast-forward into a fresh checkout (#373).Root cause: the uncommitted-changes guard ran
git diff-index --quiet HEAD, which errors (exit 128) on an unborn HEAD rather than signalling a diff, and the guard treated any error as dirty.Fix: HasUncommittedChangesDir and UncommittedFilesDir now detect an unborn HEAD structurally (ADR 0031 clause 4) and judge cleanliness against the index (
git diff --cached). An empty unborn index reads clean; a staged unborn index reads dirty and its files are named. Born-HEAD behavior is byte-for-byte unchanged.Also removed a now-redundant unborn-HEAD bypass in the foreign-dirty-target guard that would have cleared a stranger's staged unborn work; it now routes through the fixed helper and stays protective.
Adds hermetic tests for the unborn cases and the first-fast-forward repro. Full gate green: build, vet, gofmt, staticcheck, govulncheck, gosec, test-race, mcp-conformance.
Closes #373