From f907fff8be06d21f9528723a59a12fd9ca0f2b47 Mon Sep 17 00:00:00 2001 From: Anders Kaseorg Date: Tue, 9 Mar 2021 10:38:43 -0800 Subject: [PATCH] Use git reset instead of git pull to avoid attempting a merge commit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Also, use git remote set-head in case the repository’s default branch has been renamed. Fixes #5303. Signed-off-by: Anders Kaseorg --- src/util/git.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/util/git.js b/src/util/git.js index e68d7afc24..de7ad2f84d 100644 --- a/src/util/git.js +++ b/src/util/git.js @@ -320,7 +320,8 @@ export default class Git implements GitRefResolvingInterface { return fs.lockQueue.push(gitUrl.repository, async () => { if (await fs.exists(cwd)) { await spawnGit(['fetch', '--tags'], {cwd}); - await spawnGit(['pull'], {cwd}); + await spawnGit(['remote', 'set-head', 'origin', '--auto'], {cwd}); + await spawnGit(['reset', '--hard', 'origin/HEAD'], {cwd}); } else { await spawnGit(['clone', gitUrl.repository, cwd]); }