lightsystemdarkgreen
@ 261119.65 · fetching
current
{
    "version": "2.56.1",
    "description": "A free and open source distributed version control system.",
    "homepage": "https://gitforwindows.org",
    "license": {
        "identifier": "GPL-2.0-only",
        "url": "https://github.com/git-for-windows/git/blob/HEAD/COPYING"
    },
    "notes": [
        "To register file associations, please execute the following command:",
        "reg import \"$dir\\install-associations.reg\"",
        "",
        "To register the context menu entry, please execute the following command:",
        "reg import \"$dir\\install-context.reg\"",
        "",
        "To set Git Credential Manager Core for portable Git, please execute the following command:",
        "git config --system credential.helper manager"
    ],
    "architecture": {
        "64bit": {
            "url": "https://github.com/git-for-windows/git/releases/download/v2.56.1.windows.1/PortableGit-2.56.1-64-bit.7z.exe#/dl.7z",
            "hash": "9dd04a608ceb5f6ab32a73709e0ecb159d211da71b697c45ff81f6dd0c6b49c7"
        },
        "arm64": {
            "url": "https://github.com/git-for-windows/git/releases/download/v2.56.1.windows.1/PortableGit-2.56.1-arm64.7z.exe#/dl.7z",
            "hash": "0dca0d9f760924a7e6752235d7dd6eb1a9b508ee714b6ed15d89252e5a58c5c9"
        }
    },
    "pre_install": [
        "# Hardlinks cannot work properly here, as this app would create a new file instead of writing the existing config file.",
        "$config_path = Join-Path -Path $dir -ChildPath 'etc\\gitconfig'",
        "$config_path_persisted = Join-Path -Path $persist_dir -ChildPath 'etc\\gitconfig'",
        "if (Test-Path -LiteralPath $config_path_persisted -PathType Leaf) {",
        "    info \"Restoring system-level config from $config_path_persisted...\"",
        "    Copy-Item -Path $config_path_persisted -Destination $config_path -Force",
        "    info \"Adjusting paths in $config_path...\"",
        "    $content = [System.IO.File]::ReadAllText($config_path)",
        "    $git_dir_pattern = [regex]::Escape(((Split-Path -Path $dir -Parent) -replace '\\\\', '/'))",
        "    $content = $content -replace \"(${git_dir_pattern}/)[\\d.]+(?=/)\", \"`${1}$version\"",
        "    $runtime_dir = @('ucrt64', 'clangarm64', 'mingw64') | Where-Object { Test-Path -LiteralPath (Join-Path -Path $dir -ChildPath $_) -PathType Container } | Select-Object -First 1",
        "    if ($runtime_dir) {",
        "        $version_pattern = [regex]::Escape($version)",
        "        $content = $content -replace \"(${git_dir_pattern}/(?:${version_pattern}|current)/)(?:mingw64|ucrt64|clangarm64)(?=/)\", \"`${1}$runtime_dir\"",
        "    }",
        "    [System.IO.File]::WriteAllText($config_path, $content, [System.Text.UTF8Encoding]::new($false))",
        "}"
    ],
    "post_install": [
        "$git_path = $dir -replace '\\\\', '\\\\'",
        "Get-ChildItem -Path \"$bucketsdir\\main\\scripts\\$app\" -Filter '*.reg' -File | ForEach-Object {",
        "    $content = Get-Content -Path $_.FullName -Encoding utf8",
        "    if ($global) { $content = $content -replace 'HKEY_CURRENT_USER', 'HKEY_LOCAL_MACHINE' }",
        "    $content -replace '{{git_dir}}', $git_path | Set-Content -Path \"$dir\\$($_.Name)\" -Encoding unicode",
        "}"
    ],
    "env_set": {
        "GIT_INSTALL_ROOT": "$dir"
    },
    "bin": [
        "bin\\sh.exe",
        "cmd\\git.exe",
        "cmd\\gitk.exe",
        "cmd\\git-gui.exe",
        "cmd\\scalar.exe",
        "git-bash.exe",
        "usr\\bin\\gpg.exe",
        "usr\\bin\\gpg-agent.exe",
        "usr\\bin\\gpgconf.exe",
        "usr\\bin\\gpg-connect-agent.exe",
        "usr\\bin\\pinentry.exe"
    ],
    "shortcuts": [
        [
            "git-bash.exe",
            "Git\\Git Bash",
            "--cd-to-home"
        ],
        [
            "git-cmd.exe",
            "Git\\Git CMD",
            "--cd-to-home"
        ],
        [
            "cmd\\git-gui.exe",
            "Git\\Git GUI"
        ]
    ],
    "pre_uninstall": [
        "# Hardlinks cannot work properly here, as this app would create a new file instead of writing the existing config file.",
        "$config_path = Join-Path -Path $dir -ChildPath 'etc\\gitconfig'",
        "$config_path_persisted = Join-Path -Path $persist_dir -ChildPath 'etc\\gitconfig'",
        "if (Test-Path -LiteralPath $config_path -PathType Leaf) {",
        "    ensure (Split-Path -Path $config_path_persisted -Parent) | Out-Null",
        "    info \"Saving system-level config to $config_path_persisted...\"",
        "    Copy-Item -Path $config_path -Destination $config_path_persisted -Force",
        "}"
    ],
    "uninstaller": {
        "script": [
            "if ($cmd -eq 'uninstall') {",
            "    reg import \"$dir\\uninstall-context.reg\" *> $null",
            "    reg import \"$dir\\uninstall-associations.reg\" *> $null",
            "}"
        ]
    },
    "checkver": {
        "github": "https://api.github.com/repos/git-for-windows/git/releases/latest",
        "jsonpath": "$.assets[?(@.name =~ /Portable/i)].browser_download_url",
        "regex": "(?i)download/(?<tag>v?[\\d.]+windows[\\d.]+)/PortableGit-([\\d.]+)"
    },
    "autoupdate": {
        "architecture": {
            "64bit": {
                "url": "https://github.com/git-for-windows/git/releases/download/$matchTag/PortableGit-$version-64-bit.7z.exe#/dl.7z"
            },
            "arm64": {
                "url": "https://github.com/git-for-windows/git/releases/download/$matchTag/PortableGit-$version-arm64.7z.exe#/dl.7z"
            }
        },
        "hash": {
            "url": "https://github.com/git-for-windows/git/releases/tag/$matchTag",
            "regex": "(?s)$basename.*?$sha256"
        }
    }
}