1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-06-15 00:15:32 +02:00

Add rebase from marked base commit test

This also fixes a bug where after the rebase each commit in the commits view had a tick against it because we hadn't
refreshed the view since the base commit was no longer marked
This commit is contained in:
Jesse Duffield
2023-08-12 13:17:01 +10:00
parent 3ea81d4a6f
commit f1753f36c8
7 changed files with 385 additions and 14 deletions

View File

@ -18,6 +18,8 @@ type Shell struct {
// when running the shell outside the gui we can directly panic on failure,
// but inside the gui we need to close the gui before panicking
fail func(string)
randomFileContentIndex int
}
func NewShell(dir string, fail func(string)) *Shell {
@ -221,6 +223,16 @@ func (self *Shell) CreateNCommitsWithRandomMessages(n int) *Shell {
return self
}
// Creates a commit with a random file
// Only to be used in demos
func (self *Shell) RandomChangeCommit(message string) *Shell {
index := self.randomFileContentIndex
self.randomFileContentIndex++
randomFileName := fmt.Sprintf("random-%d.go", index)
self.CreateFileAndAdd(randomFileName, RandomFileContents[index%len(RandomFileContents)])
return self.Commit(message)
}
func (self *Shell) SetConfig(key string, value string) *Shell {
self.RunCommand([]string{"git", "config", "--local", key, value})
return self
@ -361,3 +373,10 @@ func (self *Shell) Chdir(path string) *Shell {
return self
}
func (self *Shell) SetAuthor(authorName string, authorEmail string) *Shell {
self.RunCommand([]string{"git", "config", "--local", "user.name", authorName})
self.RunCommand([]string{"git", "config", "--local", "user.email", authorEmail})
return self
}