From b7fa5ea7a93ee23a178f736c65b2cc0bf6eee659 Mon Sep 17 00:00:00 2001 From: "Babak K. Shandiz" Date: Tue, 1 Jul 2025 11:41:07 +0100 Subject: [PATCH] docs: explain PR URL parsing reason Signed-off-by: Babak K. Shandiz --- pkg/cmd/pr/edit/edit.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pkg/cmd/pr/edit/edit.go b/pkg/cmd/pr/edit/edit.go index e0ef29054..c01364d24 100644 --- a/pkg/cmd/pr/edit/edit.go +++ b/pkg/cmd/pr/edit/edit.go @@ -91,7 +91,12 @@ func NewCmdEdit(f *cmdutil.Factory, runF func(*EditOptions) error) *cobra.Comman } if opts.SelectorArg != "" { - // If a URL is provided, parse it to get the base repository. + // If a URL is provided, we need to parse it to override the + // base repository, especially the hostname part. That's because + // we need a feature detector down in this command, and that + // needs to know the API host. If the command is run outside of + // a git repo, we cannot instantiate the detector unless we have + // already parsed the URL. if baseRepo, _, err := shared.ParseURL(opts.SelectorArg); err == nil { opts.BaseRepo = func() (ghrepo.Interface, error) { return baseRepo, nil