summaryrefslogtreecommitdiffstats
path: root/main.go
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2018-08-09 14:33:51 +1000
committerJesse Duffield <jessedduffield@gmail.com>2018-08-09 14:33:51 +1000
commit4832d365f1a2067c3bc464ec07b19f343ee4c495 (patch)
tree1b504f6120ed1a999f779923e4d587f0e67b65c8 /main.go
parentbebe94b4b32e2532e80e69f83a20d9b67c9af9d2 (diff)
use go-git for commits
Diffstat (limited to 'main.go')
-rw-r--r--main.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/main.go b/main.go
index 94260366c..3b965b8ac 100644
--- a/main.go
+++ b/main.go
@@ -14,6 +14,7 @@ import (
"github.com/fatih/color"
"github.com/jesseduffield/gocui"
+ git "gopkg.in/src-d/go-git.v4"
)
// ErrSubProcess is raised when we are running a subprocess
@@ -28,6 +29,8 @@ var (
date string
debuggingFlag = flag.Bool("debug", false, "a boolean")
versionFlag = flag.Bool("v", false, "Print the current version")
+
+ w *git.Worktree
)
func homeDirectory() string {
@@ -88,6 +91,18 @@ func fallbackVersion() string {
return string(byteVersion)
}
+func setupWorktree() {
+ r, err := git.PlainOpen(".")
+ if err != nil {
+ panic(err)
+ }
+
+ w, err = r.Worktree()
+ if err != nil {
+ panic(err)
+ }
+}
+
func main() {
startTime = time.Now()
devLog("\n\n\n\n\n\n\n\n\n\n")
@@ -101,6 +116,7 @@ func main() {
}
verifyInGitRepo()
navigateToRepoRootDirectory()
+ setupWorktree()
for {
if err := run(); err != nil {
if err == gocui.ErrQuit {