Functions/Set-LocalDevBranch.ps1

Function Set-LocalDevBranch {
    [cmdletbinding()]
    param(
        [string] $branch,
        [PSCustomObject] $config
    )

    if ([string]::IsNullOrEmpty($branch)) {
        Write-Host "No branch provided, am getting from git..."
        $branch = &git rev-parse --abbrev-ref HEAD
    }
    [string]$dataBricksPath = $config.dataBricksPath 
    $dataBricksPath = $dataBricksPath.Replace('__branch__', $branch)
    $config.dataBricksPath = $dataBricksPath

    if ($config.dbfsFiles){
        $config.dbfsFiles = @($config.dbfsFiles | foreach-object { $_.targetLocation = $_.targetLocation.Replace('__branch__', $branch);$_}  )
    }

    return $config
}