mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-08-09 09:22:48 +03:00
do not include bare repos in recent repos list
This commit is contained in:
2
main.go
2
main.go
@@ -24,7 +24,7 @@ func main() {
|
|||||||
flaggy.DefaultParser.ShowVersionWithVersionFlag = false
|
flaggy.DefaultParser.ShowVersionWithVersionFlag = false
|
||||||
|
|
||||||
repoPath := ""
|
repoPath := ""
|
||||||
flaggy.String(&repoPath, "p", "path", "Path of git repo. (Deprecated: use --git-dir for git directory and --work-tree for work tree directory)")
|
flaggy.String(&repoPath, "p", "path", "Path of git repo. (equivalent to --work-tree=<path> --git-dir=<path>/.git/)")
|
||||||
|
|
||||||
filterPath := ""
|
filterPath := ""
|
||||||
flaggy.String(&filterPath, "f", "filter", "Path to filter on in `git log -- <path>`. When in filter mode, the commits, reflog, and stash are filtered based on the given path, and some operations are restricted")
|
flaggy.String(&filterPath, "f", "filter", "Path to filter on in `git log -- <path>`. When in filter mode, the commits, reflog, and stash are filtered based on the given path, and some operations are restricted")
|
||||||
|
@@ -1427,3 +1427,9 @@ func (c *GitCommand) WorkingTreeState() string {
|
|||||||
}
|
}
|
||||||
return "normal"
|
return "normal"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *GitCommand) IsBareRepo() bool {
|
||||||
|
// note: could use `git rev-parse --is-bare-repository` if we wanna drop go-git
|
||||||
|
_, err := c.Repo.Worktree()
|
||||||
|
return err == gogit.ErrIsBareRepository
|
||||||
|
}
|
||||||
|
@@ -45,6 +45,14 @@ func (gui *Gui) handleCreateRecentReposMenu() error {
|
|||||||
// updateRecentRepoList registers the fact that we opened lazygit in this repo,
|
// updateRecentRepoList registers the fact that we opened lazygit in this repo,
|
||||||
// so that we can open the same repo via the 'recent repos' menu
|
// so that we can open the same repo via the 'recent repos' menu
|
||||||
func (gui *Gui) updateRecentRepoList() error {
|
func (gui *Gui) updateRecentRepoList() error {
|
||||||
|
if gui.GitCommand.IsBareRepo() {
|
||||||
|
// we could totally do this but it would require storing both the git-dir and the
|
||||||
|
// worktree in our recent repos list, which is a change that would need to be
|
||||||
|
// backwards compatible
|
||||||
|
gui.Log.Info("Not appending bare repo to recent repo list")
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
recentRepos := gui.Config.GetAppState().RecentRepos
|
recentRepos := gui.Config.GetAppState().RecentRepos
|
||||||
currentRepo, err := os.Getwd()
|
currentRepo, err := os.Getwd()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Reference in New Issue
Block a user