devblackops / Stucco

An opinionated Plaster template for high-quality PowerShell modules
MIT License
194 stars 28 forks source link

Enhance Git Command Detection Flexibility #39

Open jimbrig opened 1 year ago

jimbrig commented 1 year ago

See the bottom of #38 for details:


Note that during my inspection of these test files I found some other potential areas of improvement also.

For example, on my machine, I have two git executables on my PATH and therefore the statement $git = (Get-Command git -CommandType Application -ErrorAction SilentlyContinue) would return git.exe git.exe instead of just git.exe causing the $thisCommit = & $git log --decorate --oneline HEAD~1..HEAD expression to fail:

image

I simply addressed this issue by changing $git = (Get-Command git -CommandType Application -ErrorAction SilentlyContinue) to $git = (Get-Command git -CommandType Application -ErrorAction SilentlyContinue)[0] to ensure it always is singular.

Now I'm in the clear!

image


Solution to be provided in PR for both issues if you want them (if not that's fine also!).