Skip to content

Commit 0781e7f

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 0781e7f

File tree

11 files changed

+14
-10
lines changed

11 files changed

+14
-10
lines changed

docs/Config.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,8 @@ services: {}
470470
# What to do when opening Lazygit outside of a git repo.
471471
# - 'prompt': (default) ask whether to initialize a new repo or open in the most recent repo
472472
# - 'create': initialize a new repo
473-
# - 'skip': open most recent repo
473+
# - 'recent': open most recent repo
474+
# - 'skip': open most recent repo and skip the modal
474475
# - 'quit': exit Lazygit
475476
notARepository: prompt
476477

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
}

pkg/i18n/english.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1535,7 +1535,7 @@ func EnglishTranslationSet() *TranslationSet {
15351535
BareRepo: "You've attempted to open Lazygit in a bare repo but Lazygit does not yet support bare repos. Open most recent repo? (y/n) ",
15361536
InitialBranch: "Branch name? (leave empty for git's default): ",
15371537
NoRecentRepositories: "Must open lazygit in a git repository. No valid recent repositories. Exiting.",
1538-
IncorrectNotARepository: "The value of 'notARepository' is incorrect. It should be one of 'prompt', 'create', 'skip', or 'quit'.",
1538+
IncorrectNotARepository: "The value of 'notARepository' is incorrect. It should be one of 'prompt', 'create', 'recent', 'skip', or 'quit'.",
15391539
AutoStashTitle: "Autostash?",
15401540
AutoStashPrompt: "You must stash and pop your changes to bring them across. Do this automatically? (enter/esc)",
15411541
StashPrefix: "Auto-stashing changes for ",

pkg/i18n/translations/pl.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@
326326
"BareRepo": "Próbujesz otworzyć Lazygit w gołym repozytorium, ale Lazygit jeszcze nie obsługuje gołych repozytoriów. Otworzyć najnowsze repozytorium? (t/n) ",
327327
"InitialBranch": "Nazwa gałęzi? (pozostaw puste dla domyślnej gita): ",
328328
"NoRecentRepositories": "Musisz otworzyć lazygit w repozytorium git. Brak ważnych ostatnich repozytoriów. Wyjście.",
329-
"IncorrectNotARepository": "Wartość 'notARepository' jest nieprawidłowa. Powinna być jedną z 'prompt', 'create', 'skip', lub 'quit'.",
329+
"IncorrectNotARepository": "Wartość 'notARepository' jest nieprawidłowa. Powinna być jedną z 'prompt', 'create', 'recent', 'skip', lub 'quit'.",
330330
"AutoStashPrompt": "Musisz schować i wyciągnąć swoje zmiany, aby je przenieść. Zrobić to automatycznie? (enter/esc)",
331331
"StashPrefix": "Automatyczne chowanie zmian dla ",
332332
"Discard": "Odrzuć",

pkg/i18n/translations/pt.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@
388388
"BareRepo": "Você tentou abrir Lazygit em um repositório puro, mas Lazygit ainda não suporta repositórios vazios. Abrir os repositórios mais recentes? (y/n) ",
389389
"InitialBranch": "Nome da branch? (deixe vazio para o padrão do git): ",
390390
"NoRecentRepositories": "É necessário abrir lazygit em um repositório git. Nenhum repositório recente válido. Saindo do sistema.",
391-
"IncorrectNotARepository": "O valor de 'notARepository' está incorreto. Deve ser um dos 'prompt', 'create', 'sk', ou 'quit'.",
391+
"IncorrectNotARepository": "O valor de 'notARepository' está incorreto. Deve ser um dos 'prompt', 'create', 'recent', 'skip', ou 'quit'.",
392392
"AutoStashTitle": "Autoarmazenar?",
393393
"AutoStashPrompt": "Você deve esconder e mostrar suas alterações para que elas passem. Quer fazer isso automaticamente? (enter/esc)",
394394
"StashPrefix": "Alterações de carimbo automático para ",

pkg/i18n/translations/ru.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@
247247
"BareRepo": "Вы пытались открыть Lazygit в пустом репозитории, но Lazygit ещё не поддерживает пустые репозитории. Открыть последний репозиторий? (y/n)",
248248
"InitialBranch": "Название ветки? (оставьте пустым для git по умолчанию):",
249249
"NoRecentRepositories": "Необходимо открыть lazygit в git репозитории. Нет валидных последних репозиториев. Выход.",
250-
"IncorrectNotARepository": "Неверное значение 'notARepository'. Это должно быть одним из 'prompt', 'create', 'skip', или 'quit'.",
250+
"IncorrectNotARepository": "Неверное значение 'notARepository'. Это должно быть одним из 'prompt', 'create', 'recent', 'skip', или 'quit'.",
251251
"AutoStashTitle": "Автосохранить изменения?",
252252
"AutoStashPrompt": "Чтобы перенести изменения, их нужно сохранить и вынуть. Сделать это автоматически? (enter/esc)",
253253
"StashPrefix": "Автосохранение изменений для",

pkg/i18n/translations/zh-CN.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@
375375
"BareRepo": "您已经尝试在空仓库中打开Lazygit,但是Lazygit还不支持空仓库。打开最近的仓库吗?(y / n) ",
376376
"InitialBranch": "分支名称? (git的默认值为空): ",
377377
"NoRecentRepositories": "必须在git存储库中打开lazygit。没有有效的最近存储库。即将退出...",
378-
"IncorrectNotARepository": "'notARepository'的值不正确。它应该是“prompt”,“create”,“skip”或“quit”中的一个。",
378+
"IncorrectNotARepository": "'notARepository'的值不正确。它应该是“prompt”,“create”,“recent”,“skip”或“quit”中的一个。",
379379
"AutoStashTitle": "自动存储?",
380380
"AutoStashPrompt": "您必须隐藏并弹出变更以使变更生效。自动执行?(enter/esc)",
381381
"StashPrefix": "自动隐藏变更 ",

pkg/i18n/translations/zh-TW.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@
284284
"BareRepo": "你嘗試在裸版本庫中開啟 Lazygit,但 Lazygit 尚未支援裸版本庫。是否開啟最新版本庫? (y/n) ",
285285
"InitialBranch": "分支名稱?(留空使用 git 的預設值):",
286286
"NoRecentRepositories": "必須在 git 版本庫中開啟 lazygit。沒有有效的最近版本庫。退出。",
287-
"IncorrectNotARepository": "無效 `notARepository` 輸入。輸入應為「prompt」、「create」、「skip」、或「quit」。",
287+
"IncorrectNotARepository": "無效 `notARepository` 輸入。輸入應為「prompt」、「create」、「recent」、「skip」、或「quit」。",
288288
"AutoStashTitle": "是否自動收藏?",
289289
"AutoStashPrompt": "必須收藏並拾起變更才得以繼續操作。是否自動執行?(Enter/Esc)",
290290
"StashPrefix": "自動收藏 ",

schema/config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1930,7 +1930,7 @@
19301930
"skip",
19311931
"quit"
19321932
],
1933-
"description": "What to do when opening Lazygit outside of a git repo.\n- 'prompt': (default) ask whether to initialize a new repo or open in the most recent repo\n- 'create': initialize a new repo\n- 'skip': open most recent repo\n- 'quit': exit Lazygit",
1933+
"description": "What to do when opening Lazygit outside of a git repo.\n- 'prompt': (default) ask whether to initialize a new repo or open in the most recent repo\n- 'create': initialize a new repo\n- 'recent': open most recent repo\n- 'skip': open most recent repo and skip the modal\n- 'quit': exit Lazygit",
19341934
"default": "prompt"
19351935
},
19361936
"promptToReturnFromSubprocess": {

0 commit comments

Comments
 (0)