Skip to content

Commit 5e24602

Browse files
Removes refspec from pull
1 parent 06aa060 commit 5e24602

File tree

4 files changed

+7
-38
lines changed

4 files changed

+7
-38
lines changed

src/env/node/git/git.ts

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1022,10 +1022,7 @@ export class Git {
10221022
}
10231023
}
10241024

1025-
async pull(
1026-
repoPath: string,
1027-
options: { branch?: string; remote?: string; upstream?: string; rebase?: boolean; tags?: boolean },
1028-
): Promise<void> {
1025+
async pull(repoPath: string, options: { rebase?: boolean; tags?: boolean }): Promise<void> {
10291026
const params = ['pull'];
10301027

10311028
if (options.tags) {
@@ -1036,11 +1033,6 @@ export class Git {
10361033
params.push('-r');
10371034
}
10381035

1039-
if (options.remote && options.branch) {
1040-
params.push(options.remote);
1041-
params.push(options.upstream ? `${options.upstream}:${options.branch}` : options.branch);
1042-
}
1043-
10441036
try {
10451037
void (await this.git<string>({ cwd: repoPath }, ...params));
10461038
} catch (ex) {
@@ -1077,7 +1069,7 @@ export class Git {
10771069
reason = PullErrorReason.TagConflict;
10781070
}
10791071

1080-
throw new PullError(reason, ex, options?.branch, options?.remote);
1072+
throw new PullError(reason, ex);
10811073
}
10821074
}
10831075

src/env/node/git/localGitProvider.ts

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1538,26 +1538,11 @@ export class LocalGitProvider implements GitProvider, Disposable {
15381538

15391539
@gate()
15401540
@log()
1541-
async pull(
1542-
repoPath: string,
1543-
options?: { branch?: GitBranchReference; rebase?: boolean; tags?: boolean },
1544-
): Promise<void> {
1541+
async pull(repoPath: string, options?: { rebase?: boolean; tags?: boolean }): Promise<void> {
15451542
const scope = getLogScope();
15461543

1547-
let branch = options?.branch;
1548-
if (!isBranchReference(branch)) {
1549-
branch = await this.getBranch(repoPath);
1550-
if (branch == null) return undefined;
1551-
}
1552-
1553-
const [branchName, remoteName] = getBranchNameAndRemote(branch);
1554-
if (remoteName == null && branch.upstream == null) return undefined;
1555-
15561544
try {
15571545
await this.git.pull(repoPath, {
1558-
branch: branchName,
1559-
remote: remoteName,
1560-
upstream: getBranchTrackingWithoutRemote(branch),
15611546
rebase: options?.rebase,
15621547
tags: options?.tags,
15631548
});

src/git/errors.ts

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -242,17 +242,12 @@ export class PullError extends Error {
242242

243243
constructor(reason?: PullErrorReason, original?: Error, branch?: string, remote?: string);
244244
constructor(message?: string, original?: Error);
245-
constructor(
246-
messageOrReason: string | PullErrorReason | undefined,
247-
original?: Error,
248-
branch?: string,
249-
remote?: string,
250-
) {
245+
constructor(messageOrReason: string | PullErrorReason | undefined, original?: Error) {
251246
let message;
252247
let reason: PullErrorReason | undefined;
253-
const baseMessage = `Unable to pull${branch ? ` branch '${branch}'` : ''}${remote ? ` from ${remote}` : ''}`;
248+
const baseMessage = `Unable to pull`;
254249
if (messageOrReason == null) {
255-
message = 'Unable to pull';
250+
message = baseMessage;
256251
} else if (typeof messageOrReason === 'string') {
257252
message = messageOrReason;
258253
reason = undefined;

src/git/gitProviderService.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1386,10 +1386,7 @@ export class GitProviderService implements Disposable {
13861386

13871387
@gate()
13881388
@log()
1389-
pull(
1390-
repoPath: string | Uri,
1391-
options?: { branch?: GitBranchReference; rebase?: boolean; tags?: boolean },
1392-
): Promise<void> {
1389+
pull(repoPath: string | Uri, options?: { rebase?: boolean; tags?: boolean }): Promise<void> {
13931390
const { provider, path } = this.getProvider(repoPath);
13941391
return provider.pull(path, options);
13951392
}

0 commit comments

Comments
 (0)