1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-31 14:24:25 +03:00

dont panic when catting directories

This commit is contained in:
Jesse Duffield
2018-08-28 19:12:35 +10:00
parent 320ccdb22a
commit 7e1e97d050
9 changed files with 102 additions and 8 deletions

View File

@ -341,9 +341,13 @@ func (gui *Gui) catSelectedFile(g *gocui.Gui) (string, error) {
}
return "", gui.renderString(g, "main", gui.Tr.SLocalize("NoFilesDisplay"))
}
if item.Type != "file" {
return "", gui.renderString(g, "main", gui.Tr.SLocalize("NotAFile"))
}
cat, err := gui.GitCommand.CatFile(item.Name)
if err != nil {
panic(err)
gui.Log.Error(err)
return "", gui.renderString(g, "main", err.Error())
}
return cat, nil
}

View File

@ -180,6 +180,9 @@ func (gui *Gui) refreshMergePanel(g *gocui.Gui) error {
if err != nil {
return err
}
if cat == "" {
return nil
}
gui.State.Conflicts, err = gui.findConflicts(cat)
if err != nil {
return err