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)) }