mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-06-08 23:56:15 +02:00
Apply suggestions from code review
This commit is contained in:
parent
9987e65c35
commit
2866827ca8
@ -229,7 +229,22 @@ func (app *App) setupRepo() (bool, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if isBare {
|
if isBare {
|
||||||
log.Fatalln("bare repositories are not supported by lazygit, please make this a working repository.")
|
log.Println(app.Tr.BareRepo)
|
||||||
|
response, _ := bufio.NewReader(os.Stdin).ReadString('\n')
|
||||||
|
shouldOpenRecent := strings.Trim(response, " \r\n") == "y"
|
||||||
|
|
||||||
|
if shouldOpenRecent {
|
||||||
|
for _, repoDir := range app.Config.GetAppState().RecentRepos {
|
||||||
|
if isRepo, _ := isDirectoryAGitRepository(repoDir); isRepo {
|
||||||
|
if err := os.Chdir(repoDir); err == nil {
|
||||||
|
return true, nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fmt.Println(app.Tr.NoRecentRepositories)
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -259,6 +259,7 @@ type TranslationSet struct {
|
|||||||
DiscardFileChangesPrompt string
|
DiscardFileChangesPrompt string
|
||||||
DisabledForGPG string
|
DisabledForGPG string
|
||||||
CreateRepo string
|
CreateRepo string
|
||||||
|
BareRepo string
|
||||||
InitialBranch string
|
InitialBranch string
|
||||||
NoRecentRepositories string
|
NoRecentRepositories string
|
||||||
AutoStashTitle string
|
AutoStashTitle string
|
||||||
@ -896,6 +897,7 @@ func EnglishTranslationSet() TranslationSet {
|
|||||||
DiscardFileChangesPrompt: "Are you sure you want to discard this commit's changes to this file? If this file was created in this commit, it will be deleted",
|
DiscardFileChangesPrompt: "Are you sure you want to discard this commit's changes to this file? If this file was created in this commit, it will be deleted",
|
||||||
DisabledForGPG: "Feature not available for users using GPG",
|
DisabledForGPG: "Feature not available for users using GPG",
|
||||||
CreateRepo: "Not in a git repository. Create a new git repository? (y/n): ",
|
CreateRepo: "Not in a git repository. Create a new git repository? (y/n): ",
|
||||||
|
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): ",
|
InitialBranch: "Branch name? (leave empty for git's default): ",
|
||||||
NoRecentRepositories: "Must open lazygit in a git repository. No valid recent repositories. Exiting.",
|
NoRecentRepositories: "Must open lazygit in a git repository. No valid recent repositories. Exiting.",
|
||||||
AutoStashTitle: "Autostash?",
|
AutoStashTitle: "Autostash?",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user