mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-10-29 15:09:22 +03:00
Avoid auto-stashing when only submodules are out of date
Stashing doesn't affect submodules, so if you have a working copy that has
out-of-date submodules but no other changes, and then you revert or paste a
commit (or invoke one of the many other lazygit commands that auto-stash, e.g.
undo), lazygit would previously try to stash changes (which did nothing, but
also didn't return an error), perform the operation, and then pop the stash
again. If no stashes existed before, then this would only cause a confusing
error popup ("error: refs/stash@{0} is not a valid reference"), but if there
were stashes, this would try to pop the newest one of these, which is very
undesirable and confusing.
This commit is contained in:
@@ -257,7 +257,7 @@ func (self *UndoController) hardResetWithAutoStash(commitHash string, options ha
|
||||
}
|
||||
|
||||
// if we have any modified tracked files we need to auto-stash
|
||||
dirtyWorkingTree := self.c.Helpers().WorkingTree.IsWorkingTreeDirty()
|
||||
dirtyWorkingTree := self.c.Helpers().WorkingTree.IsWorkingTreeDirtyExceptSubmodules()
|
||||
if dirtyWorkingTree {
|
||||
return self.c.WithWaitingStatus(options.WaitingStatus, func(gocui.Task) error {
|
||||
if err := self.c.Git().Stash.Push(fmt.Sprintf(self.c.Tr.AutoStashForUndo, utils.ShortHash(commitHash))); err != nil {
|
||||
|
||||
Reference in New Issue
Block a user