1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-02-09 13:47:11 +02:00

show error on git add --patching untracked file

This commit is contained in:
Jesse Duffield 2018-08-09 09:33:18 +10:00
parent 5d9df3ca07
commit 0c84055abd
2 changed files with 4 additions and 1 deletions

View File

@ -74,6 +74,9 @@ func handleAddPatch(g *gocui.Gui, v *gocui.View) error {
if !file.HasUnstagedChanges {
return createErrorPanel(g, "File has no unstaged changes to add")
}
if !file.Tracked {
return createErrorPanel(g, "Cannot git add --patch untracked files")
}
gitAddPatch(g, file.Name)
return err
}

View File

@ -306,7 +306,7 @@ func getOpenCommand() (string, string, error) {
}
func gitAddPatch(g *gocui.Gui, filename string) {
runSubProcess(g, "git", "add", "-p", filename)
runSubProcess(g, "git", "add", "--patch", filename)
}
func editFile(g *gocui.Gui, filename string) (string, error) {