|
30 | 30 | import { StackService } from '$lib/stacks/stackService.svelte';
|
31 | 31 | import { UserService } from '$lib/user/userService';
|
32 | 32 | import { getBranchNameFromRef } from '$lib/utils/branch';
|
| 33 | + import { parseRemoteUrl } from '$lib/url/gitUrl'; |
33 | 34 | import { sleep } from '$lib/utils/sleep';
|
34 | 35 | import { getContext } from '@gitbutler/shared/context';
|
35 | 36 | import { persisted } from '@gitbutler/shared/persisted';
|
|
41 | 42 | import { error } from '@gitbutler/ui/toasts';
|
42 | 43 | import { isDefined } from '@gitbutler/ui/utils/typeguards';
|
43 | 44 | import { tick } from 'svelte';
|
| 45 | + import { RemotesService } from '$lib/remotes/remotesService'; |
44 | 46 |
|
45 | 47 | type Props = {
|
46 | 48 | projectId: string;
|
|
63 | 65 | const userService = getContext(UserService);
|
64 | 66 | const templateService = getContext(TemplateService);
|
65 | 67 | const aiService = getContext(AIService);
|
| 68 | + const remotesService = getContext(RemotesService); |
66 | 69 |
|
67 | 70 | const user = userService.user;
|
68 | 71 | const project = projectsService.getProjectStore(projectId);
|
|
276 | 279 | base = branchParent.name;
|
277 | 280 | }
|
278 | 281 |
|
| 282 | + const pushRemoteName = baseBranch.actualPushRemoteName(); |
| 283 | + const allRemotes = await remotesService.remotes(projectId); |
| 284 | + const pushRemote = allRemotes.find((r) => r.name === pushRemoteName); |
| 285 | + const pushRemoteUrl = pushRemote?.url; |
| 286 | +
|
| 287 | + const repoInfo = parseRemoteUrl(pushRemoteUrl); |
| 288 | + const headOwner = repoInfo?.owner; |
| 289 | +
|
279 | 290 | const pr = await prService.createPr({
|
280 | 291 | title: params.title,
|
281 | 292 | body: params.body,
|
282 | 293 | draft: params.draft,
|
283 | 294 | baseBranchName: base,
|
284 |
| - upstreamName: params.upstreamBranchName |
| 295 | + upstreamName: params.upstreamBranchName, |
| 296 | + headOwner |
285 | 297 | });
|
286 | 298 |
|
287 | 299 | // Store the new pull request number with the branch data.
|
|
0 commit comments