1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-10-20 19:12:29 +03:00

Add test demonstrating the problem

When dropping changes to the submodule, we expect it to get rolled back to the
previous version; however, it is removed entirely instead.
This commit is contained in:
Stefan Haller
2025-10-05 14:52:28 +02:00
parent 21483b259c
commit 0904bf9969
3 changed files with 72 additions and 0 deletions

View File

@@ -170,6 +170,10 @@ func (self *Shell) Commit(message string) *Shell {
return self.RunCommand([]string{"git", "commit", "-m", message})
}
func (self *Shell) CommitInWorktreeOrSubmodule(worktreePath string, message string) *Shell {
return self.RunCommand([]string{"git", "-C", worktreePath, "commit", "-m", message})
}
func (self *Shell) EmptyCommit(message string) *Shell {
return self.RunCommand([]string{"git", "commit", "--allow-empty", "-m", message})
}
@@ -438,6 +442,16 @@ func (self *Shell) AddFileInWorktreeOrSubmodule(worktreePath string, filePath st
return self
}
func (self *Shell) UpdateFileInWorktreeOrSubmodule(worktreePath string, filePath string, content string) *Shell {
self.UpdateFile(filepath.Join(worktreePath, filePath), content)
self.RunCommand([]string{
"git", "-C", worktreePath, "add", filePath,
})
return self
}
func (self *Shell) MakeExecutable(path string) *Shell {
// 0755 sets the executable permission for owner, and read/execute permissions for group and others
err := os.Chmod(filepath.Join(self.dir, path), 0o755)