@@ -12,6 +12,7 @@ import (
1212 tea "github.com/charmbracelet/bubbletea"
1313 "github.com/github/gh-stack/internal/config"
1414 "github.com/github/gh-stack/internal/git"
15+ ghapi "github.com/github/gh-stack/internal/github"
1516 "github.com/github/gh-stack/internal/stack"
1617 "github.com/github/gh-stack/internal/tui/stackview"
1718 "github.com/spf13/cobra"
@@ -65,8 +66,9 @@ func runView(cfg *config.Config, opts *viewOptions) error {
6566}
6667
6768func viewShort (cfg * config.Config , s * stack.Stack , currentBranch string ) error {
68- var repoOwner , repoName string
69+ var repoHost , repoOwner , repoName string
6970 if repo , err := cfg .Repo (); err == nil {
71+ repoHost = repo .Host
7072 repoOwner = repo .Owner
7173 repoName = repo .Name
7274 }
@@ -81,7 +83,7 @@ func viewShort(cfg *config.Config, s *stack.Stack, currentBranch string) error {
8183 }
8284
8385 indicator := branchStatusIndicator (cfg , s , b )
84- prSuffix := shortPRSuffix (cfg , b , repoOwner , repoName )
86+ prSuffix := shortPRSuffix (cfg , b , repoHost , repoOwner , repoName )
8587 if b .Branch == currentBranch {
8688 cfg .Outf ("» %s%s%s %s\n " , cfg .ColorBold (b .Branch ), indicator , prSuffix , cfg .ColorCyan ("(current)" ))
8789 } else if merged {
@@ -187,13 +189,13 @@ func viewJSON(cfg *config.Config, s *stack.Stack, currentBranch string) error {
187189 return err
188190}
189191
190- func shortPRSuffix (cfg * config.Config , b stack.BranchRef , owner , repo string ) string {
192+ func shortPRSuffix (cfg * config.Config , b stack.BranchRef , host , owner , repo string ) string {
191193 if b .PullRequest == nil || b .PullRequest .Number == 0 {
192194 return ""
193195 }
194196 url := b .PullRequest .URL
195197 if url == "" && owner != "" && repo != "" {
196- url = fmt . Sprintf ( "https://github.com/%s/%s/pull/%d" , owner , repo , b .PullRequest .Number )
198+ url = ghapi . PRURL ( host , owner , repo , b .PullRequest .Number )
197199 }
198200 prNum := cfg .PRLink (b .PullRequest .Number , url )
199201 colorFn := cfg .ColorSuccess // green for open
@@ -251,9 +253,10 @@ func viewFullTUI(cfg *config.Config, s *stack.Stack, currentBranch string) error
251253func viewFullStatic (cfg * config.Config , s * stack.Stack , currentBranch string ) error {
252254 client , clientErr := cfg .GitHubClient ()
253255
254- var repoOwner , repoName string
256+ var repoHost , repoOwner , repoName string
255257 repo , repoErr := cfg .Repo ()
256258 if repoErr == nil {
259+ repoHost = repo .Host
257260 repoOwner = repo .Owner
258261 repoName = repo .Name
259262 }
@@ -285,7 +288,7 @@ func viewFullStatic(cfg *config.Config, s *stack.Stack, currentBranch string) er
285288 } else if clientErr == nil && repoErr == nil {
286289 pr , err := client .FindPRForBranch (b .Branch )
287290 if err == nil && pr != nil {
288- prInfo = fmt . Sprintf ( " https://github.com/%s/%s/pull/%d" , repoOwner , repoName , pr .Number )
291+ prInfo = " " + ghapi . PRURL ( repoHost , repoOwner , repoName , pr .Number )
289292 }
290293 }
291294
0 commit comments