add branch rebase integration test

This commit is contained in:
Jesse Duffield 2022-08-22 20:43:19 +10:00
parent 843488bff4
commit 7b757d1cfe
126 changed files with 309 additions and 241 deletions

View file

@ -40,6 +40,15 @@ func (s *Shell) CreateFile(path string, content string) *Shell {
return s
}
func (s *Shell) UpdateFile(path string, content string) *Shell {
err := ioutil.WriteFile(path, []byte(content), 0o644)
if err != nil {
panic(fmt.Sprintf("error updating file: %s\n%s", path, err))
}
return s
}
func (s *Shell) NewBranch(name string) *Shell {
return s.RunCommand("git checkout -b " + name)
}
@ -71,6 +80,13 @@ func (s *Shell) CreateFileAndAdd(fileName string, fileContents string) *Shell {
GitAdd(fileName)
}
// convenience method for updating a file and adding it
func (s *Shell) UpdateFileAndAdd(fileName string, fileContents string) *Shell {
return s.
UpdateFile(fileName, fileContents).
GitAdd(fileName)
}
// creates commits 01, 02, 03, ..., n with a new file in each
// The reason for padding with zeroes is so that it's easier to do string
// matches on the commit messages when there are many of them