`spawn --from-checkpoint` leaves the new instance's workspace on the author's branch
I maintainer di solito rispondono entro 1 giorno
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 35/100
Direzione di ricerca
Start in crates/newgit/tests/support/fake_remote.rs to reproduce the spawn --from-checkpoint steps, then read BranchManager::spawn_from_checkpoint in manager.rs (around line 2317), which rewrites the imported record's branch but not checked_out. Follow point_workspace_head (manager.rs:9106) into GitSource::workspace_point_head in source.rs:623 to see why the workspace lands on feature-a. Done when review's workspace is on review after the spawn, with no warning, and the author's off-branch and detached cases are decided and covered.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Since #284, a checkpoint records the branch its workspace had checked out (checked_out, or detached), and undo puts the workspace back on it. spawn --from-checkpoint ends in an undo to the imported record, and spawn_from_checkpoint rewrites that record's branch for the new instance but leaves checked_out as the author's. So the new instance's workspace ends up on the author's branch, not its own.
Reproduction
In the crates/newgit/tests/support/fake_remote.rs fixture, on main (24e6a30), with nothing beyond what setup creates. That is a Git repository with a README, newgit init with [workspace] root set, both committed, a saved login, and newgit remote add --url <the fake remote>. Then:
newgit spawn feature-a
cd "$(newgit status feature-a --path)" && newgit checkpoint # the workspace is on feature-a
cd <store>
newgit spawn review --from-checkpoint feature-a/ckpt_001
The spawn exits 0 and warns:
warning: the workspace was on `review`; undo put it back on `feature-a`, as the checkpoint had it
git symbolic-ref --short HEAD in review's workspace prints feature-a, and newgit status review and newgit checkpoints review say so too:
NAME SOURCE STATUS TRACKERS RESOURCES WORKSPACE
review review@304c1d86 (workspace on `feature-a`) ready - - …/workspaces/review
ID CREATED REASON SOURCE MESSAGE
ckpt_001 2026-11-03 09:25 explicit 304c1d86 [on `feature-a`] spawned from feature-a/ckpt_001 (by jack)
ckpt_002 2026-11-03 09:25 before-undo 304c1d86 state before undo to ckpt_001
Work done there doesn't reach review. After a commit in that workspace, newgit checkpoint there warns:
warning: the workspace is on `feature-a`, not `review`: checkpoint ckpt_003 holds `feature-a` as it stands, and undo returns to it, but `review` stays at 304c1d86. `git checkout review` to work on the instance's branch again
The store's review stays at 304c1d86.
On 0.7.0 (13ecce2), the same steps leave review's workspace on review, with no warning, and that checkpoint moves the store's review to the new commit.
Cause
The author's checkpoint records branch = "feature-a" and checked_out = "feature-a". BranchManager::spawn_from_checkpoint (manager.rs:2317) rewrites the imported record's branch, id and source revs for the new instance, among other fields, but not checked_out or detached. So review/ckpt_001 has branch = "review" and checked_out = "feature-a".
The undo that finishes the spawn calls point_workspace_head (manager.rs:9106, defined at :10265) with that record. It takes the record's head_branch, feature-a, and GitSource::workspace_point_head (source.rs:623) sets refs/heads/feature-a in the workspace to the checkpoint's commit and points HEAD at it.
Expected
review's workspace on review, as on 0.7.0.
An author whose checkpoint was off their branch is a question of its own. With feature-a's workspace on try-x at the checkpoint, the spawn leaves review's workspace on try-x. With it detached, the spawn leaves review's workspace detached at that commit. Both print the same warnings. On 0.7.0 both came up on review, and spawn makes review at the checkpoint's commit either way. Whether a spawn should carry the author's branch or detached HEAD over, or always start on its own branch, is your call.
Reproduced on 0.8.0 (7cc6f46) and on main (24e6a30), on macOS.
- Lingua principale
- Rust
- Stelle
- 0
- Fork
- 0
- Merge medio
- 7h 16m
- PR unite (30g)
- 110
Preparare l'ambiente
Non abbiamo ancora controllato i file di configurazione di questo progetto. Parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di Spheroman/newgit
-
Port allocation order within a resource is unspecifiedForse già presa Una pull request collegata a questa issue è aperta o già unita. Apertadocumentation good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
Spheroman/newgit#59 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 20/100
Spheroman/newgit#344 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
I maintainer di solito rispondono entro 1 giorno
-
enhancement
Difficoltà 5/5 Più di una settimana Idoneità per principianti 20/100
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di Spheroman/newgit
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
I maintainer di solito rispondono entro 1 giorno
-
bug i18n priority: medium ui
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
storytold/craft-anything#983 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
needs triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
pbakaus/impeccable#1328 ·
I maintainer di solito rispondono entro 1 giorno
-
`swf` upgrade to 0.4.0Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
Dinnerbone/Rascal#91 · 2 reazioni ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
higress-group/HiRoute#405 ·
I maintainer di solito rispondono entro 1 giorno