Title: Set-BuildEnvironment fails when git is not installed · Issue #133 · PowerShellOrg/BuildHelpers · GitHub
Open Graph Title: Set-BuildEnvironment fails when git is not installed · Issue #133 · PowerShellOrg/BuildHelpers
X Title: Set-BuildEnvironment fails when git is not installed · Issue #133 · PowerShellOrg/BuildHelpers
Description: Hello, Set-BuildEnvironment fails when git is not installed. This has been an issue in the past, so there must have been a regression error at some point. BuildHelpers Version 2.0.16 PowerShell Version 7.2.5 (Core) Cause Locations Get-Bu...
Open Graph Description: Hello, Set-BuildEnvironment fails when git is not installed. This has been an issue in the past, so there must have been a regression error at some point. BuildHelpers Version 2.0.16 PowerShell Ver...
X Description: Hello, Set-BuildEnvironment fails when git is not installed. This has been an issue in the past, so there must have been a regression error at some point. BuildHelpers Version 2.0.16 PowerShell Ver...
Opengraph URL: https://github.com/PowerShellOrg/BuildHelpers/issues/133
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Set-BuildEnvironment fails when git is not installed","articleBody":"Hello,\r\n\r\n`Set-BuildEnvironment` fails when git is not installed. \r\n\r\nThis has been an issue in the past, so there must have been a regression error at some point.\r\n\r\n### BuildHelpers Version\r\n`2.0.16`\r\n\r\n### PowerShell Version\r\n`7.2.5 (Core)`\r\n\r\n### Cause Locations\r\n- `Get-BuildVariable.ps1` (line 79)\r\n- `Get-ProjectName.ps1` (line 57)\r\n\r\n### Error Source\r\nThe lines that are failing both fail for the same reason...\r\n\r\n```PowerShell\r\nif(!$PSboundParameters.ContainsKey('GitPath')) {\r\n $GitPath = (Get-Command $GitPath -CommandType Application -ErrorAction SilentlyContinue)[0].Path\r\n}\r\n```\r\n\r\n`(Get-Command $GitPath -CommandType Application -ErrorAction SilentlyContinue)` returns $null because git is not found, then the code goes on to access `$null[0].Path`, which generates an InvalidOperationException: `Cannot index into a null array.`\r\n\r\n### Expected Behavior\r\nNo errors should occur when git is missing\r\n\r\n### Actual Behavior\r\n```shell\r\nInvalidOperation: C:\\Users\\Administrator\\Documents\\PowerShell\\Modules\\BuildHelpers\\2.0.16\\Public\\Get-BuildVariable.ps1:79\r\nLine |\r\n 79 | $GitPath = (Get-Command $GitPath -CommandType Application -Er …\r\n | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n | Cannot index into a null array.\r\n\r\nInvalidOperation: C:\\Users\\Administrator\\Documents\\PowerShell\\Modules\\BuildHelpers\\2.0.16\\Public\\Get-ProjectName.ps1:57\r\nLine |\r\n 57 | $GitPath = (Get-Command $GitPath -ErrorAction SilentlyContinu …\r\n | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n | Cannot index into a null array.\r\n```\r\n\r\n### Steps to Reproduce\r\nOn a system without git installed...\r\n```powershell\r\nInstall-Module -Name BuildHelpers -RequiredVersion 2.0.16 -Scope CurrentUser\r\n\r\nImport-Module BuildHelpers\r\n\r\nSet-BuildEnvironment\r\n```\r\n\r\n### Workarounds\r\nInstall git\r\n\r\n### References (similar issue from the past)\r\n- Issue #57\r\n","author":{"url":"https://github.com/rdavisunr","@type":"Person","name":"rdavisunr"},"datePublished":"2022-07-15T16:37:00Z","url":"https://github.com/PowerShellOrg/BuildHelpers/issues/133"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:a27d9e4f-df9a-ddfe-efc1-8c0b5afd2633 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | DC5A:261495:EFA08:144145:6AFD3FFE |
| html-safe-nonce | a792808e98975f244e6e6d9b29a7afa09d2b92352655111eb64467af748e263c |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEQzVBOjI2MTQ5NTpFRkEwODoxNDQxNDU6NkFGRDNGRkUiLCJ2aXNpdG9yX2lkIjoiNTIyNDY1MzI0NzIxNzQ4Mzc3NCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | ddc0d2083e5f1881d1e26425500f516c4f511905b07736dc319d46d21edfdf7e |
| hovercard-subject-tag | issue:1306241432 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/PowerShellOrg/BuildHelpers/133/issue_layout |
| twitter:image | https://opengraph.githubassets.com/39b3d2d79b6d0c47c60bfce4b70506562bbfb13199ab1cd7fa7f8bab42e09e08/PowerShellOrg/BuildHelpers/issues/133 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/39b3d2d79b6d0c47c60bfce4b70506562bbfb13199ab1cd7fa7f8bab42e09e08/PowerShellOrg/BuildHelpers/issues/133 |
| og:image:alt | Hello, Set-BuildEnvironment fails when git is not installed. This has been an issue in the past, so there must have been a regression error at some point. BuildHelpers Version 2.0.16 PowerShell Ver... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | rdavisunr |
| hostname | github.com |
| expected-hostname | github.com |
| None | bdbacc25b921224ff0befcb9e629560a1255be51aec9991d6e3f95b5e9151474 |
| turbo-cache-control | no-preview |
| go-import | github.com/PowerShellOrg/BuildHelpers git https://github.com/PowerShellOrg/BuildHelpers.git |
| octolytics-dimension-user_id | 4895314 |
| octolytics-dimension-user_login | PowerShellOrg |
| octolytics-dimension-repository_id | 59748913 |
| octolytics-dimension-repository_nwo | PowerShellOrg/BuildHelpers |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 59748913 |
| octolytics-dimension-repository_network_root_nwo | PowerShellOrg/BuildHelpers |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 556dd37bb0aceffb25724e151b5d858b3265b40b |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width