Modules/businessdev.ALbuild.Apps/Private/Test-BcSourceChanged.ps1

function Test-BcSourceChanged {
    <#
    .SYNOPSIS
        Reports whether an app folder changed in the most recent commit.
    .DESCRIPTION
        Internal helper for Set-BcAppVersion's -OnlyUpdateOnChangedSource. Runs
        'git diff --quiet HEAD~1 HEAD -- <folder>' and maps the exit code to a boolean. A non-zero
        exit means there are differences (or git could not compare, e.g. a shallow/first commit) -
        both treated as "changed" so a version is still produced rather than silently skipped.
    .PARAMETER RepositoryRoot
        The git working tree to query.
    .PARAMETER AppFolder
        The folder whose changes are checked (relative to, or under, the repository root).
    .OUTPUTS
        System.Boolean
    #>

    [CmdletBinding()]
    [OutputType([bool])]
    param(
        [Parameter(Mandatory)] [string] $RepositoryRoot,
        [Parameter(Mandatory)] [string] $AppFolder
    )

    $result = Invoke-ALbuildProcess -FilePath 'git' -Arguments @(
        '-C', $RepositoryRoot, 'diff', '--quiet', 'HEAD~1', 'HEAD', '--', $AppFolder
    ) -PassThru -RetryCount 0

    return ($result.ExitCode -ne 0)
}