mirror of
https://gitea.com/gitea/tea.git
synced 2026-10-26 11:01:25 +01:00
fix: page hint for comment list, keep SSH settings on re-login, hard-link-free downloads, stable OWNER/REPO#N instance (follow gh)
Signed-off-by: bircni <bircni@icloud.com>
This commit is contained in:
11 files changed
+154
-10
No files matched your search
+15
-1
@@ -176,7 +176,10 @@ func (a *application) resolveRefs(cmd *cobra.Command, raws []string, kind refKin
|
||||
if selected.Repo != "" && !a.sameRepository(selected.Repo, parsed.Repo) {
|
||||
return target{}, nil, clierr.Wrap(clierr.Usage, fmt.Errorf("%s and %s are in different repositories; run one command per repository", source, raw))
|
||||
}
|
||||
selected, source = parsed, raw
|
||||
// A reference without an instance must not replace one that names it, whatever the order.
|
||||
if selected.Repo == "" || a.namesInstance(parsed.Repo) {
|
||||
selected, source = parsed, raw
|
||||
}
|
||||
}
|
||||
t, err := a.resolveRequest(cmd.Context(), targetRequest{requireRepo: true, authenticate: true, repo: selected.Repo, repoSource: source})
|
||||
return t, numbers, err
|
||||
@@ -193,6 +196,17 @@ func (a *application) sameRepository(first, second string) bool {
|
||||
return oneErr == nil && twoErr == nil && strings.EqualFold(one.Slug(), two.Slug()) && (one.Host == "" || two.Host == "" || one.Host == two.Host)
|
||||
}
|
||||
|
||||
// namesInstance reports whether a repository argument names its instance, as a URL or
|
||||
// HOST/OWNER/REPO does.
|
||||
func (a *application) namesInstance(raw string) bool {
|
||||
s, err := a.settings()
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
parsed, err := settings.ParseRepository(raw, s.Hosts.Hosts)
|
||||
return err == nil && parsed.Host != ""
|
||||
}
|
||||
|
||||
// pullSelector resolves the pull request a pr command addresses: N, #N, OWNER/REPO#N, a pull
|
||||
// request URL, a head branch, OWNER:BRANCH, or, without an argument, the pull request of the
|
||||
// checked-out branch.
|
||||
|
||||
Reference in new issue
Block a user