Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions src/utils/downloadGit.mts
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,15 @@ import { unxzFile, unzipFile } from "./downloadHelpers.mjs";
import { unknownErrorToString } from "./errorHelper.mjs";
import {
EXT_USER_AGENT,
WINDOWS_ARM64_GIT_DOWNLOAD_URL,
WINDOWS_X86_GIT_DOWNLOAD_URL,
} from "./sharedConstants.mjs";

/**
* Downloads and installs a portable version of Git.
*
* Supports Windows x64 and macOS x64 + arm64.
* But currently only execution on Windows x64 is enabled.
* Supports Windows x64 + arm64 and macOS x64 + arm64.
* But currently only execution on Windows x64 and Windows arm64 is enabled.
*
* @returns The path to the installed Git executable or undefined if the installation failed
*/
Expand All @@ -26,7 +27,7 @@ export async function downloadGit(
): Promise<string | undefined> {
if (
process.platform !== "win32" ||
(process.platform === "win32" && process.arch !== "x64")
(process.arch !== "x64" && process.arch !== "arm64")
) {
Logger.debug(
LoggerSource.gitDownloader,
Expand All @@ -51,8 +52,12 @@ export async function downloadGit(
// Ensure the target directory exists
await mkdir(targetDirectory, { recursive: true });

// select download url for platform()_arch()
const downloadUrl = redirectURL ?? WINDOWS_X86_GIT_DOWNLOAD_URL;
// select download url
const downloadUrl =
redirectURL ??
(process.arch === "arm64"
? WINDOWS_ARM64_GIT_DOWNLOAD_URL
: WINDOWS_X86_GIT_DOWNLOAD_URL);

const tmpBasePath = join(tmpdir(), "pico-sdk");
await mkdir(tmpBasePath, { recursive: true });
Expand Down
5 changes: 4 additions & 1 deletion src/utils/sharedConstants.mts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ export const OPENOCD_VERSION = "0.12.0+dev";

export const WINDOWS_X86_GIT_DOWNLOAD_URL =
"https://github.com/git-for-windows/git/releases/download" +
"/v2.51.0.windows.2/MinGit-2.51.0.2-64-bit.zip";
"/v2.51.2.windows.1/MinGit-2.51.2-64-bit.zip";
export const WINDOWS_ARM64_GIT_DOWNLOAD_URL =
"https://github.com/git-for-windows/git/releases/download" +
"/v2.51.2.windows.1/MinGit-2.51.2-arm64.zip";

export const EXAMPLES_REPOSITORY_URL =
"https://github.com/raspberrypi/pico-examples.git";
Expand Down
Loading