ps/Modules/Cole.PowerShell.Developer/Public/Test-IsGitFolderRoot.ps1
2023-05-30 22:51:22 -07:00

16 lines
421 B
PowerShell

function Test-IsGitFolderRoot {
<#
.SYNOPSIS
Test if the current folder is a git repository
.PARAMETER Path
The file path to check. Can be presumed as the current folder.
#>
param(
$Path = ((Get-Location).Path)
)
$targetPath = (Join-Path -Path $Path -ChildPath ".git" -Resolve -ErrorAction Ignore)
return (![string]::IsNullOrWhiteSpace($targetPath) -and (Test-Path -Path $targetPath))
}