fix!: clone reports the checked-out branch or tag, not a default branch (#684) #851
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!851
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "issue-684-clone-tag-label"
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
After
madt_clone branch=v15.0.6(a tag), the result line printed(branch: master), although the checkout was the tag.The cause: the clone result field
defaultBranchwas misnamed. It was filled fromgit symbolic-ref --short HEAD, so it held the checked-out branch, and its only reader printed it as(branch: X). On a detached HEAD that command fails, and the code fell back to a hard-coded"master". Bare clones skipped the read and always got"master".The change:
defaultBranchbecomesbranch: the branch HEAD is on after the clone, for bare clones too, and empty on a detached HEAD.tagfield holds the tag when the clone checked out a tag (git describe --tags --exact-match HEAD).(branch: X)or(tag: X, detached HEAD).This is a breaking change to the JSON result of
madt_cloneandmadtea clone --json:defaultBranchis gone. The commit carries aBREAKING CHANGEfooter. Reporting the remote repository's default branch is a separate feature, #838.Tests: a real clone of a local
file://repo (default branchtrunk, tagv1, branchfeature) in nine shapes: no-b,-b feature, and-b v1, each as a normal, a--depth 1, and a bare clone. Each shape checksbranchandtag, and the formatter tests check the result line. The fixture builds its source repo with the same git command constructor that production code uses../scripts/gate.shpasses on this commit.Closes #684