From 10a88fa7b0c06d6a1c7ed430939a9f372e258495 Mon Sep 17 00:00:00 2001 From: Ivan Trubach Date: Wed, 18 Dec 2019 22:02:13 +0300 Subject: [PATCH] Fix gitFetch not updating FETCH_HEAD --- src/executil.ts | 4 +++- src/installer.ts | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/executil.ts b/src/executil.ts index a6e325e..c78c135 100644 --- a/src/executil.ts +++ b/src/executil.ts @@ -43,11 +43,13 @@ export async function gitClone(gitDir: string, gitRepo: string, workTree: string await git(args); } -export async function gitFetch(gitDir: string) { +export async function gitFetch(gitDir: string, ref: string) { let args: string[] = [ `--git-dir=${gitDir}`, 'fetch', '--depth=1', + 'origin', + ref, ]; await git(args); } diff --git a/src/installer.ts b/src/installer.ts index e6dcc0f..bb18d7a 100644 --- a/src/installer.ts +++ b/src/installer.ts @@ -85,7 +85,7 @@ async function acquireGo(version: string, gotipRef: string, bootstrapGo: string) workTree = ''; // Cache hit for git dir, fetch new commits from upstream. - await executil.gitFetch(gitDir); + await executil.gitFetch(gitDir, gotipRef); // Extract latest commit hash. commitHash = await executil.gitRevParse(gitDir, 'FETCH_HEAD');