mirror of
https://gitea.com/gitea/tea.git
synced 2026-10-26 19:11:25 +01:00
fix: address verified review findings (branches-checkout-status-1)
Signed-off-by: bircni <bircni@icloud.com>
This commit is contained in:
27 files changed
+281
-65
No files matched your search
@@ -52,9 +52,14 @@ func (a *application) pullCleanCommand() *cobra.Command {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
// pr checkout names a fork's branch after its head, or OWNER/BRANCH when the head name is taken.
|
||||
preferred := []string{fmt.Sprintf("pr/%d", n)}
|
||||
if owner, _, _ := strings.Cut(pull.HeadRepo, "/"); owner != "" && !strings.EqualFold(pull.HeadRepo, target.Repo) {
|
||||
preferred = append(preferred, owner+"/"+pull.Head)
|
||||
}
|
||||
localBranch, remote, err := git.FindCleanBranch(cmd.Context(), a.deps.Git, git.FindCleanBranchOptions{
|
||||
Directory: a.options.cwd, HeadSHA: pull.HeadSHA, HeadBranch: pull.Head, IgnoreSHA: ignoreSHA, DefaultBranch: repository.DefaultBranch,
|
||||
PreferredNames: []string{fmt.Sprintf("pr/%d", n)}, MatchingRemotes: matchingRemotes,
|
||||
PreferredNames: preferred, MatchingRemotes: matchingRemotes, PullNumber: n,
|
||||
})
|
||||
if err != nil {
|
||||
return clierr.Wrap(clierr.Usage, err)
|
||||
|
||||
Reference in new issue
Block a user