Skip to content

Commit 5c52dd3

Browse files
committed
Add config value for skipping recent repositories prompt
The configuration key `notARepository` configures the action to be taken when opening Lazygit outside of a git repo. Possible values - 'prompt': (default) ask whether to initialize a new repo or open in the most recent repo - 'create': initialize a new repo - 'skip': open most recent repo - 'quit': exit Lazygit With `notARepository: skip`, the most recent repository is selected, but a "Recent repositories" prompt is still opened. Proposed change: - `notARepository: recent` opens the "Recent repositories" prompt - `notARepository: skip` skips the modal
1 parent ef6f96b commit 5c52dd3

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

pkg/app/app.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,8 @@ func (app *App) setupRepo(
209209
}
210210
case "create":
211211
shouldInitRepo = true
212+
case "recent":
213+
shouldInitRepo = false
212214
case "skip":
213215
shouldInitRepo = false
214216
case "quit":

pkg/config/user_config.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ type UserConfig struct {
3131
// What to do when opening Lazygit outside of a git repo.
3232
// - 'prompt': (default) ask whether to initialize a new repo or open in the most recent repo
3333
// - 'create': initialize a new repo
34-
// - 'skip': open most recent repo
34+
// - 'recent': open most recent repo
35+
// - 'skip': open most recent repo and skip the modal
3536
// - 'quit': exit Lazygit
3637
NotARepository string `yaml:"notARepository" jsonschema:"enum=prompt,enum=create,enum=skip,enum=quit"`
3738
// If true, display a confirmation when subprocess terminates. This allows you to view the output of the subprocess before returning to Lazygit.

pkg/gui/layout.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ func (gui *Gui) onInitialViewsCreation() error {
260260
gui.c.GetAppState().LastVersion = gui.Config.GetVersion()
261261
gui.c.SaveAppStateAndLogError()
262262

263-
if gui.showRecentRepos {
263+
if gui.showRecentRepos && gui.c.UserConfig().NotARepository != "skip" {
264264
if err := gui.helpers.Repos.CreateRecentReposMenu(); err != nil {
265265
return err
266266
}

0 commit comments

Comments
 (0)