Commit e127ec0
committed
fix(stack): update existing branch pointer when reusing branch name
CRITICAL FIX: When pushing to a stack with --branch specifying an existing
branch name, we were:
1. Skipping branch creation (correct)
2. Adding metadata entry pointing to new commit (correct)
3. BUT leaving the Git branch pointing to old commit (BUG!)
This caused stack corruption on next ca sync/ca validate, which would
'fix' the metadata back to the stale commit, dropping user's work.
Now we call update_branch_to_commit() to fast-forward the existing branch
to the new commit, keeping Git refs and metadata in sync.
Scenario:
- User: ca push --branch feat-auth <commit1>
- User: ca push --branch feat-auth <commit2> # Reusing same name
- Before: feat-auth branch still at commit1, metadata at commit2 → corruption
- After: feat-auth branch updated to commit2, metadata at commit2 → consistent1 parent 6a6b59d commit e127ec0
1 file changed
Lines changed: 13 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
468 | 468 | | |
469 | 469 | | |
470 | 470 | | |
471 | | - | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
472 | 484 | | |
473 | 485 | | |
474 | 486 | | |
| |||
0 commit comments