From 4cbc432bc07dc0d5340c83604ee7db3b5b90b2cf Mon Sep 17 00:00:00 2001 From: Ramin Tadayon Date: Thu, 16 May 2024 10:23:19 -0700 Subject: [PATCH] Fixes #3277 Unable to pull branch when local branch name differs --- src/env/node/git/git.ts | 4 ++-- src/env/node/git/localGitProvider.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/env/node/git/git.ts b/src/env/node/git/git.ts index dd34bf13142af..cdffa4842423b 100644 --- a/src/env/node/git/git.ts +++ b/src/env/node/git/git.ts @@ -1024,7 +1024,7 @@ export class Git { async pull( repoPath: string, - options: { branch?: string; remote?: string; rebase?: boolean; tags?: boolean }, + options: { branch?: string; remote?: string; upstream?: string; rebase?: boolean; tags?: boolean }, ): Promise { const params = ['pull']; @@ -1038,7 +1038,7 @@ export class Git { if (options.remote && options.branch) { params.push(options.remote); - params.push(options.branch); + params.push(options.upstream ? `${options.upstream}:${options.branch}` : options.branch); } try { diff --git a/src/env/node/git/localGitProvider.ts b/src/env/node/git/localGitProvider.ts index f0a26c83dbe87..b600bf9981a99 100644 --- a/src/env/node/git/localGitProvider.ts +++ b/src/env/node/git/localGitProvider.ts @@ -1461,11 +1461,10 @@ export class LocalGitProvider implements GitProvider, Disposable { if (options.publish != null) { branchName = options.reference.name; remoteName = options.publish.remote; - upstreamName = getBranchTrackingWithoutRemote(options.reference); } else { [branchName, remoteName] = getBranchNameAndRemote(options.reference); - upstreamName = undefined; } + upstreamName = getBranchTrackingWithoutRemote(options.reference); } else { const branch = await this.getBranch(repoPath); if (branch == null) return; @@ -1558,6 +1557,7 @@ export class LocalGitProvider implements GitProvider, Disposable { await this.git.pull(repoPath, { branch: branchName, remote: remoteName, + upstream: getBranchTrackingWithoutRemote(branch), rebase: options?.rebase, tags: options?.tags, });