File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -76,7 +76,7 @@ func (self *RemotesController) GetKeybindings(opts types.KeybindingsOpts) []*typ
7676 {
7777 Key : opts .GetKey (opts .Config .Branches .AddForkRemote ),
7878 Handler : self .addFork ,
79- GetDisabledReason : self .require ( self . singleItemSelected () ),
79+ GetDisabledReason : self .hasOriginRemote ( ),
8080 Description : self .c .Tr .AddForkRemote ,
8181 Tooltip : self .c .Tr .AddForkRemoteTooltip ,
8282 DisplayOnScreen : true ,
@@ -244,6 +244,16 @@ func (self *RemotesController) getOrigin() *models.Remote {
244244 return nil
245245}
246246
247+ func (self * RemotesController ) hasOriginRemote () func () * types.DisabledReason {
248+ return func () * types.DisabledReason {
249+ if self .getOrigin () == nil {
250+ return & types.DisabledReason {Text : self .c .Tr .NoOriginRemote }
251+ }
252+
253+ return nil
254+ }
255+ }
256+
247257func (self * RemotesController ) addFork () error {
248258 baseRemote := self .getOrigin ()
249259
Original file line number Diff line number Diff line change @@ -529,6 +529,7 @@ type TranslationSet struct {
529529 AddForkRemoteUsername string
530530 AddForkRemoteTooltip string
531531 IncompatibleForkAlreadyExistsError string
532+ NoOriginRemote string
532533 ViewBranches string
533534 EditRemoteName string
534535 EditRemoteUrl string
@@ -1630,6 +1631,7 @@ func EnglishTranslationSet() *TranslationSet {
16301631 AddForkRemote : `Add fork remote` ,
16311632 AddForkRemoteTooltip : `Quickly add a fork remote by replacing the owner in the origin URL and optionally check out a branch from new remote.` ,
16321633 IncompatibleForkAlreadyExistsError : `Remote {{.remoteName}} already exists and has different URL` ,
1634+ NoOriginRemote : "Action needs 'origin' remote" ,
16331635 ViewBranches : "View branches" ,
16341636 EditRemoteName : `Enter updated remote name for {{.remoteName}}:` ,
16351637 EditRemoteUrl : `Enter updated remote url for {{.remoteName}}:` ,
You can’t perform that action at this time.
0 commit comments