From ab81f27fc792bccd630189f0f08721d1d1231f54 Mon Sep 17 00:00:00 2001
From: Jesse Duffield <jessedduffield@gmail.com>
Date: Sat, 2 Mar 2019 20:32:16 +1100
Subject: [PATCH] don't show stack trace if lazygit is started outside of a git
 repo

---
 pkg/app/app.go | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/pkg/app/app.go b/pkg/app/app.go
index 23bd661cf..a8d0a1045 100644
--- a/pkg/app/app.go
+++ b/pkg/app/app.go
@@ -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)