diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2019-02-19 23:36:29 +1100 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2019-02-19 23:36:36 +1100 |
commit | 0228e250847d042730038281f435b0b21d992c42 (patch) | |
tree | 9f15ef6444c6215852a301a3286dcddf8a2b0cb3 /pkg/app | |
parent | 935f77483443a12ab159e19a958dfdf61a947b36 (diff) |
work towards more interactive rebase options
Diffstat (limited to 'pkg/app')
-rw-r--r-- | pkg/app/app.go | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/pkg/app/app.go b/pkg/app/app.go index 3b6c0fec2..d85d007e5 100644 --- a/pkg/app/app.go +++ b/pkg/app/app.go @@ -5,6 +5,7 @@ import ( "io/ioutil" "os" "path/filepath" + "strings" "github.com/heroku/rollrus" "github.com/jesseduffield/lazygit/pkg/commands" @@ -120,10 +121,20 @@ func (app *App) Run() error { return app.Gui.RunWithSubprocesses() } +// Rebase contains logic for when we've been run in demon mode, meaning we've +// given lazygit as a command for git to call e.g. to edit a file func (app *App) Rebase() error { - app.Log.Error("Lazygit invokved as interactive rebase demon") - - ioutil.WriteFile(".git/rebase-merge/git-rebase-todo", []byte(os.Getenv("LAZYGIT_REBASE_TODO")), 0644) + app.Log.Info("Lazygit invoked as interactive rebase demon") + app.Log.Info("args: ", os.Args) + + if strings.HasSuffix(os.Args[1], "git-rebase-todo") { + ioutil.WriteFile(os.Args[1], []byte(os.Getenv("LAZYGIT_REBASE_TODO")), 0644) + } else if strings.HasSuffix(os.Args[1], ".git/COMMIT_EDITMSG") { + // if we are rebasing and squashing, we'll see a COMMIT_EDITMSG + // but in this case we don't need to edit it, so we'll just return + } else { + app.Log.Info("Lazygit demon did not match on any use cases") + } return nil } |