From 9a93612065025cea428a8c557a2de7591e95f23e Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Sun, 19 Jul 2020 14:51:10 +0200 Subject: [PATCH 1/2] make notifications work outside a repo --- cmd/notifications.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/cmd/notifications.go b/cmd/notifications.go index 16ba479..cb4e002 100644 --- a/cmd/notifications.go +++ b/cmd/notifications.go @@ -46,9 +46,6 @@ var CmdNotifications = cli.Command{ } func runNotifications(ctx *cli.Context) error { - login, owner, repo := initCommand() - - client := login.Client() var news []*gitea.NotificationThread var err error @@ -58,11 +55,13 @@ func runNotifications(ctx *cli.Context) error { } if ctx.Bool("all") { - news, err = client.ListNotifications(gitea.ListNotificationOptions{ + login := initCommandLoginOnly() + news, err = login.Client().ListNotifications(gitea.ListNotificationOptions{ ListOptions: listOpts, }) } else { - news, err = client.ListRepoNotifications(owner, repo, gitea.ListNotificationOptions{ + login, owner, repo := initCommand() + news, err = login.Client().ListRepoNotifications(owner, repo, gitea.ListNotificationOptions{ ListOptions: listOpts, }) } -- 2.40.1 From 8464c82d42ca7cf1840d3ea15b33139d5d49e54f Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Sun, 19 Jul 2020 14:56:03 +0200 Subject: [PATCH 2/2] fix nil pointer exeption --- cmd/config.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cmd/config.go b/cmd/config.go index 89255e3..ca5517c 100644 --- a/cmd/config.go +++ b/cmd/config.go @@ -197,6 +197,9 @@ func curGitRepoPath(path string) (*Login, string, error) { } else { repo, err = git.RepoFromPath(path) } + if err != nil { + return nil, "", err + } gitConfig, err := repo.Config() if err != nil { return nil, "", err -- 2.40.1