I have a function, and within that function, I am calling a git function:
function Confirm-GitStatus
{
# a bunch of stuff
& git --git-dir $gitDir --work-tree $basePath checkout $targetBranch 2>&1
# more stuff
return $true
}
The result of this is actually an array containing the result of the the git call and $true. In order to get the result I wanted, I had to do this:
$disposableMessage = & git --git-dir $gitDir --work-tree $basePath checkout $targetBranch 2>&1
This feels gross. What is the best practice for making calls and tossing the result?