status --json .host uses the cwd origin while .owner/.repo follow the --repo override #460
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#460
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Surfaced while fixing #429 (status --json .host now reports the repo's own origin host). A residual inconsistency, pre-existing and out of #429's scope, but more visible now that origin outranks the configured host.
The mismatch
When the
--repo/MADTEA_REPOoverride is active,.ownerand.repocome from the override target, but.hostcomes from the cwd repo's origin (or the configured host when there is no origin). If the override points at a repo on one forge and the cwd origin is on a different forge, the JSON mixes two identities..hostnever came from the override, so this is not a regression from #429; it only became easier to see.Options
.hostfollows the--repooverride target too, so all three identity fields describe the same repo..hostas the cwd origin host, and document that--repooverrides only owner/repo.Where I lean
A, because one coherent identity in the JSON is what a caller reading
.hostexpects. It needs a host resolver for the override target and a decision on where that host is read from. Recording this so it is not lost; I am not building it until the semantics are settled.Related: #429.
Reframed and decided. The A/B in this issue patched a symptom; the real defects are two.
repoIdentity(internal/service/git/status.go:505-508) resolves thedir=path (owner/repo/host all from that checkout's origin) differently from the cwd path (owner/repo from the--repo/MADTEA_REPOoverride, host from the cwd origin). One question, "what repo is this?", answered by two code paths that can disagree. That divergence is the bug, not the host field alone.StatusResultand serialize to JSON, but the text output renders none of them. A human cannot discover that madtea holds this info without knowing to pass--jsonand parse it.Decision (full KISS):
dir=is the canonical "which repo" selector: it moves the tree and the identity together.--repo/MADTEA_REPOresolve identity through that same resolver, not a separate origin read. Note these only relabel identity on a local-tree command; they cannot move the tree data (branch, ahead/behind), and the resolver work should keep that honest.--json, so the capability is discoverable.This supersedes the issue's A/B. Related: #429 (made host origin-first), and the legacy byte-identical cwd override (stub 1871) that forked the two paths.