Skip to content

Bugfix: issue #615, add Copied variant to Status enum and move panic to a copied status, add integration test#616

Open
notactuallytreyanastasio wants to merge 2 commits intostacked-git:masterfrom
notactuallytreyanastasio:fix/refresh-copied-status
Open

Bugfix: issue #615, add Copied variant to Status enum and move panic to a copied status, add integration test#616
notactuallytreyanastasio wants to merge 2 commits intostacked-git:masterfrom
notactuallytreyanastasio:fix/refresh-copied-status

Conversation

@notactuallytreyanastasio
Copy link
Contributor

@notactuallytreyanastasio notactuallytreyanastasio commented Feb 6, 2026

Fixes #615

The crash only occurs in a specific code path. Status::from_char() is called lazily.

This happens only when entry.index_status() or entry.worktree_status() is accessed in determine_refresh_paths() inside the if !force guard that checks whether the index and worktree are independently clean.

Using stg refresh --force skips this check entirely, hiding the bug.

I also added tests.

Notes:

  • The C status only appears in porcelain v2 when status.renames=copies is configured
  • --force skips the determine_refresh_paths dirty check loop, which is the only code path that calls Status::from_char. Thus, the panic only occurs without --force
  • The StatusEntryKind parsing already handles copies correctly (entry kind 2, same as renames)

This is a bit of a drive-by, I might be missing something but I think this is correct? Let me know if its just off or I am missing anything and can do further work

--replace-all added 2 commits February 5, 2026 23:16
…move panic to a copied status, add integration test

- The C status only appears in porcelain v2 when status.renames=copies is configured
- --force skips the determine_refresh_paths dirty check loop, which is the only code path that calls Status::from_char. Thus, the panic only occurs without --force
- The StatusEntryKind parsing already handles copies correctly (entry kind 2, same as renames)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

stg refresh crashes when a file has "copied" status

1 participant