Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Directory names that contain [brackets] cause GitPrompt to fail #502

Merged
merged 1 commit into from
Nov 11, 2017

Conversation

duncansmart
Copy link
Contributor

@duncansmart duncansmart commented Nov 10, 2017

Using Get-Item -LiteralPath means that "[brackets]" don't get interpreted as wildcards.

Repro:

  • rename the directory in you have a git repo using square brackets e.g. C:\code\foo[bar]
  • Open a posh-git enabled Powershell prompt in the directory
  • The following error appears: C:\code\foo[bar] [Error: Cannot retrieve the dynamic parameters for the cmdlet. The specified wildcard character pattern is not valid: foo[bar]]

Using `Get-Item -LiteralPath` means that "[brackets]" don't get interpreted as wildcards.
@@ -24,7 +24,7 @@ function Get-GitDirectory {
$Env:GIT_DIR -replace '\\|/', [System.IO.Path]::DirectorySeparatorChar
}
else {
$currentDir = Get-Item $pathInfo -Force
$currentDir = Get-Item -LiteralPath $pathInfo -Force
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. Thanks!

Copy link
Collaborator

@rkeithhill rkeithhill left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@dahlbyk dahlbyk merged commit 65658bf into dahlbyk:master Nov 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants