1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-05-23 22:50:41 +02:00

don't show stack trace if lazygit is started outside of a git repo

This commit is contained in:
Jesse Duffield 2019-03-02 20:32:16 +11:00
parent dbb01b028d
commit ab81f27fc7

View File

@ -1,6 +1,7 @@
package app
import (
"fmt"
"io"
"io/ioutil"
"os"
@ -104,6 +105,10 @@ func NewApp(config config.AppConfigurer) (*App, error) {
}
app.GitCommand, err = commands.NewGitCommand(app.Log, app.OSCommand, app.Tr, app.Config)
if err != nil {
if strings.Contains(err.Error(), "Not a git repository") {
fmt.Println("Not in a git repository. Use `git init` to create a new one")
os.Exit(1)
}
return app, err
}
app.Gui, err = gui.NewGui(app.Log, app.GitCommand, app.OSCommand, app.Tr, config, app.Updater)