Open AArnott opened 2 years ago
Belated thanks for the bug report. You're absolutely right.
We mostly use -GitDir
as an "are we in a git dir?" check and don't pass it to any of the git
invocations. Most of our invocations would just need --git-dir
, but git status
will also require --work-tree
.
Tentative plan would be something like:
-WorkTree . -GitDir $null
-GitDir
is $null
, resolve -GitDir
from -WorkTree
Get-GitDirectory
a -Location
parameter
System Details
Issue Description
The
Get-GitStatus
function ignores the-GitDir
parameter for crucial parts of its work. Specifically it invokesgit
without setting the current working directory for that process to the path specified.Note how in the below terminal log,
Get-GitStatus
claims to return data for..\Lib.Template
but still claims that the branch ismaster
. But after actually switching to that directory, the result changes to the (correct)main
branch name.