fix: refuse a push refspec that begins with '+', so no push can force an update #839
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!839
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "issue-637-push-leading-plus"
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
In a
git pushrefspec, a leading+forces the update, so the remote ref can lose commits. git also accepts+at the start of a branch or tag name, so a valid name is no proof of a safe refspec. Before this change, a branch value such as+mainpassedValidateRefand reachedgit pushas a forcing refspec.The change:
ValidatePushRefininternal/git/validate.gorefuses a leading-(asValidateRefdoes) and a leading+. The refusal says why and names the fix: use a name that does not begin with+.Writer.Push,Writer.PushForce, andWriter.PushTagrun the check before the guard and before any backend runs.GitPushDir, the AGit push, the service push,issue develop, the initial finish push, andtag --push.Tests refuse a
+-prefixed branch or tag on the Writer (before the backend runs),GitPushDir, the AGit push, the service push, the orchestrate push,issue develop, andtag --push. The initial finish push runs the check but has no test of its own. #833 moves that push into the Writer, where the Writer tests cover it../scripts/gate.shpasses on this commit.Closes #637