mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-07-30 03:23:08 +03:00
Fix "move patch into new commit" for partial hunk (#2507)
This commit is contained in:
@ -94,6 +94,16 @@ func (self *Shell) CreateFile(path string, content string) *Shell {
|
||||
return self
|
||||
}
|
||||
|
||||
func (self *Shell) DeleteFile(path string) *Shell {
|
||||
fullPath := filepath.Join(self.dir, path)
|
||||
err := os.Remove(fullPath)
|
||||
if err != nil {
|
||||
self.fail(fmt.Sprintf("error deleting file: %s\n%s", fullPath, err))
|
||||
}
|
||||
|
||||
return self
|
||||
}
|
||||
|
||||
func (self *Shell) CreateDir(path string) *Shell {
|
||||
fullPath := filepath.Join(self.dir, path)
|
||||
if err := os.MkdirAll(fullPath, 0o755); err != nil {
|
||||
@ -171,6 +181,13 @@ func (self *Shell) UpdateFileAndAdd(fileName string, fileContents string) *Shell
|
||||
GitAdd(fileName)
|
||||
}
|
||||
|
||||
// convenience method for deleting a file and adding it
|
||||
func (self *Shell) DeleteFileAndAdd(fileName string) *Shell {
|
||||
return self.
|
||||
DeleteFile(fileName).
|
||||
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
|
||||
|
Reference in New Issue
Block a user