1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-03-19 21:28:28 +02:00

better logic for staging a renamed file

This commit is contained in:
Jesse Duffield 2020-07-19 12:19:50 +10:00
parent 845c80721f
commit 7d5fe4b66c

View File

@ -509,7 +509,9 @@ func (c *GitCommand) CatFile(fileName string) (string, error) {
// StageFile stages a file
func (c *GitCommand) StageFile(fileName string) error {
return c.OSCommand.RunCommand("git add %s", c.OSCommand.Quote(fileName))
// renamed files look like "file1 -> file2"
fileNames := strings.Split(fileName, " -> ")
return c.OSCommand.RunCommand("git add %s", c.OSCommand.Quote(fileNames[len(fileNames)-1]))
}
// StageAll stages all files