mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-05-11 04:15:48 +02:00
Fix "move patch into new commit" for partial hunk (#2507)
This commit is contained in:
parent
81ea3107ed
commit
4b4dccfd7d
12 changed files with 534 additions and 44 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue