Skip to content

Add config value for skipping "Recent repositories" prompt #4667

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion docs/Config.md
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,8 @@ services: {}
# What to do when opening Lazygit outside of a git repo.
# - '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
# - 'recent': open most recent repo
# - 'skip': open most recent repo and skip the modal
# - 'quit': exit Lazygit
notARepository: prompt

Expand Down Expand Up @@ -1081,6 +1082,11 @@ notARepository: 'prompt'
notARepository: 'create'
```

```yaml
# to select from recent repositories
notARepository: 'recent'
```

```yaml
# to skip without creating a new repo
notARepository: 'skip'
Expand Down
2 changes: 2 additions & 0 deletions pkg/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,8 @@ func (app *App) setupRepo(
}
case "create":
shouldInitRepo = true
case "recent":
shouldInitRepo = false
case "skip":
shouldInitRepo = false
case "quit":
Expand Down
5 changes: 3 additions & 2 deletions pkg/config/user_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,10 @@ type UserConfig struct {
// What to do when opening Lazygit outside of a git repo.
// - '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
// - 'recent': open most recent repo
// - 'skip': open most recent repo and skip the modal
// - 'quit': exit Lazygit
NotARepository string `yaml:"notARepository" jsonschema:"enum=prompt,enum=create,enum=skip,enum=quit"`
NotARepository string `yaml:"notARepository" jsonschema:"enum=prompt,enum=create,enum=recent,enum=skip,enum=quit"`
// If true, display a confirmation when subprocess terminates. This allows you to view the output of the subprocess before returning to Lazygit.
PromptToReturnFromSubprocess bool `yaml:"promptToReturnFromSubprocess"`
// Keybindings
Expand Down
2 changes: 1 addition & 1 deletion pkg/gui/layout.go
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ func (gui *Gui) onInitialViewsCreation() error {
gui.c.GetAppState().LastVersion = gui.Config.GetVersion()
gui.c.SaveAppStateAndLogError()

if gui.showRecentRepos {
if gui.showRecentRepos && gui.c.UserConfig().NotARepository != "skip" {
if err := gui.helpers.Repos.CreateRecentReposMenu(); err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/i18n/english.go
Original file line number Diff line number Diff line change
Expand Up @@ -1475,7 +1475,7 @@ func EnglishTranslationSet() *TranslationSet {
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) ",
InitialBranch: "Branch name? (leave empty for git's default): ",
NoRecentRepositories: "Must open lazygit in a git repository. No valid recent repositories. Exiting.",
IncorrectNotARepository: "The value of 'notARepository' is incorrect. It should be one of 'prompt', 'create', 'skip', or 'quit'.",
IncorrectNotARepository: "The value of 'notARepository' is incorrect. It should be one of 'prompt', 'create', 'recent', 'skip', or 'quit'.",
AutoStashTitle: "Autostash?",
AutoStashPrompt: "You must stash and pop your changes to bring them across. Do this automatically? (enter/esc)",
AutoStashForUndo: "Auto-stashing changes for undoing to %s",
Expand Down
2 changes: 1 addition & 1 deletion pkg/i18n/translations/pl.json
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@
"BareRepo": "Próbujesz otworzyć Lazygit w gołym repozytorium, ale Lazygit jeszcze nie obsługuje gołych repozytoriów. Otworzyć najnowsze repozytorium? (t/n) ",
"InitialBranch": "Nazwa gałęzi? (pozostaw puste dla domyślnej gita): ",
"NoRecentRepositories": "Musisz otworzyć lazygit w repozytorium git. Brak ważnych ostatnich repozytoriów. Wyjście.",
"IncorrectNotARepository": "Wartość 'notARepository' jest nieprawidłowa. Powinna być jedną z 'prompt', 'create', 'skip', lub 'quit'.",
"IncorrectNotARepository": "Wartość 'notARepository' jest nieprawidłowa. Powinna być jedną z 'prompt', 'create', 'recent', 'skip', lub 'quit'.",
"AutoStashPrompt": "Musisz schować i wyciągnąć swoje zmiany, aby je przenieść. Zrobić to automatycznie? (enter/esc)",
"Discard": "Odrzuć",
"DiscardChangesTitle": "Odrzuć zmiany",
Expand Down
2 changes: 1 addition & 1 deletion pkg/i18n/translations/pt.json
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@
"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) ",
"InitialBranch": "Nome da branch? (deixe vazio para o padrão do git): ",
"NoRecentRepositories": "É necessário abrir lazygit em um repositório git. Nenhum repositório recente válido. Saindo do sistema.",
"IncorrectNotARepository": "O valor de 'notARepository' está incorreto. Deve ser um dos 'prompt', 'create', 'sk', ou 'quit'.",
"IncorrectNotARepository": "O valor de 'notARepository' está incorreto. Deve ser um dos 'prompt', 'create', 'recent', 'skip', ou 'quit'.",
"AutoStashTitle": "Autoarmazenar?",
"AutoStashPrompt": "Você deve esconder e mostrar suas alterações para que elas passem. Quer fazer isso automaticamente? (enter/esc)",
"Discard": "Descartar",
Expand Down
2 changes: 1 addition & 1 deletion pkg/i18n/translations/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@
"BareRepo": "Вы пытались открыть Lazygit в пустом репозитории, но Lazygit ещё не поддерживает пустые репозитории. Открыть последний репозиторий? (y/n)",
"InitialBranch": "Название ветки? (оставьте пустым для git по умолчанию):",
"NoRecentRepositories": "Необходимо открыть lazygit в git репозитории. Нет валидных последних репозиториев. Выход.",
"IncorrectNotARepository": "Неверное значение 'notARepository'. Это должно быть одним из 'prompt', 'create', 'skip', или 'quit'.",
"IncorrectNotARepository": "Неверное значение 'notARepository'. Это должно быть одним из 'prompt', 'create', 'recent', 'skip', или 'quit'.",
"AutoStashTitle": "Автосохранить изменения?",
"AutoStashPrompt": "Чтобы перенести изменения, их нужно сохранить и вынуть. Сделать это автоматически? (enter/esc)",
"Discard": "Просмотреть параметры «отмены изменении»",
Expand Down
2 changes: 1 addition & 1 deletion pkg/i18n/translations/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@
"BareRepo": "您已经尝试在空仓库中打开Lazygit,但是Lazygit还不支持空仓库。打开最近的仓库吗?(y / n) ",
"InitialBranch": "分支名称? (git的默认值为空): ",
"NoRecentRepositories": "必须在git存储库中打开lazygit。没有有效的最近存储库。即将退出...",
"IncorrectNotARepository": "'notARepository'的值不正确。它应该是“prompt”,“create”,“skip”或“quit”中的一个。",
"IncorrectNotARepository": "'notARepository'的值不正确。它应该是“prompt”,“create”,“recent”,“skip”或“quit”中的一个。",
"AutoStashTitle": "自动存储?",
"AutoStashPrompt": "您必须隐藏并弹出变更以使变更生效。自动执行?(enter/esc)",
"Discard": "查看'放弃变更'选项",
Expand Down
2 changes: 1 addition & 1 deletion pkg/i18n/translations/zh-TW.json
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@
"BareRepo": "你嘗試在裸版本庫中開啟 Lazygit,但 Lazygit 尚未支援裸版本庫。是否開啟最新版本庫? (y/n) ",
"InitialBranch": "分支名稱?(留空使用 git 的預設值):",
"NoRecentRepositories": "必須在 git 版本庫中開啟 lazygit。沒有有效的最近版本庫。退出。",
"IncorrectNotARepository": "無效 `notARepository` 輸入。輸入應為「prompt」、「create」、「skip」、或「quit」。",
"IncorrectNotARepository": "無效 `notARepository` 輸入。輸入應為「prompt」、「create」、「recent」、「skip」、或「quit」。",
"AutoStashTitle": "是否自動收藏?",
"AutoStashPrompt": "必須收藏並拾起變更才得以繼續操作。是否自動執行?(Enter/Esc)",
"Discard": "捨棄",
Expand Down
3 changes: 2 additions & 1 deletion schema/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -1916,10 +1916,11 @@
"enum": [
"prompt",
"create",
"recent",
"skip",
"quit"
],
"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",
"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",
"default": "prompt"
},
"promptToReturnFromSubprocess": {
Expand Down