Optimistically render unstaging a dirty submodule

This map only feeds the optimistic rendering that makes staging feel
instant; it doesn't affect the eventual status, which git reports after
the refresh. The "MM" entry can never be reached for a regular file: a
file at "MM" has stageable unstaged changes, so pressing space stages it
rather than unstaging, and the unstage path is where this map is used. The
only thing that reaches the unstage path at "MM" is a submodule whose
commit is staged on top of dirty content, so this entry exists purely to
update that submodule instantly instead of waiting for the next git
status.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Stefan Haller 2026-06-02 07:19:51 +02:00
parent c46c874442
commit 8b5cfb0425

View file

@ -387,6 +387,9 @@ var unstageStatusMap = map[string]string{
"A ": "??",
"M ": " M",
"D ": " D",
// A submodule with both a staged commit and unstageable dirty content; the
// staged commit gets unstaged, the dirty content stays.
"MM": " M",
}
func (self *FilesController) optimisticStage(file *models.File) bool {