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

Quote remotes with special characters #446

Merged
merged 4 commits into from
Feb 28, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@
([PR #425](https://github.com/dahlbyk/posh-git/pull/425))
- Fix Chocolatey deprecation warning with dependency on 0.9.10
([PR #426](https://github.com/dahlbyk/posh-git/pull/426))
- Don't rerun Pageant if there are no keys to add
([PR #441](https://github.com/dahlbyk/posh-git/pull/441))
- Improve (and hide for Chocolatey) profile.example.ps1 deprecation messaging
([#442](https://github.com/dahlbyk/posh-git/issues/442))
([PR #444](https://github.com/dahlbyk/posh-git/pull/444))
- Quote tab completion for remote names containing special characters
([PR #446](https://github.com/dahlbyk/posh-git/pull/446))

## 0.7.0 - February 14, 2017
This release has focused on improving the "getting started" experience by adding an `Add-PoshGitToProfile` command that
Expand Down Expand Up @@ -105,6 +112,12 @@ Work was begun to eliminate some obvious crashes on PowerShell on .NET Core but
- Add support for tab-completion of Git parameters, long and short
([PR #395](https://github.com/dahlbyk/posh-git/pull/395))
- Switch `$GitPromptSettings` type from `PSObject` to `PSCustomObject`. On PowerShell v5 and higher, this preserves the definition order of properties in `$GitPromptSettings` making it easier to find properties.
- Fix prompt status in worktree
([#407](https://github.com/dahlbyk/posh-git/issues/407))
([PR #408](https://github.com/dahlbyk/posh-git/pull/408))
- Quote tab completion for items containing special characters
([#293](https://github.com/dahlbyk/posh-git/issues/293))
([PR #413](https://github.com/dahlbyk/posh-git/pull/413))

## Thank You:
Thank you to the following folks who contributed their time and scripting skills to make posh-git better:
Expand Down
4 changes: 3 additions & 1 deletion src/GitTabExpansion.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,9 @@ function script:gitCommands($filter, $includeAliases) {
}

function script:gitRemotes($filter) {
git remote | Where-Object { $_ -like "$filter*" }
git remote |
Where-Object { $_ -like "$filter*" } |
quoteStringWithSpecialChars
}

function script:gitBranches($filter, $includeHEAD = $false, $prefix = '') {
Expand Down
10 changes: 9 additions & 1 deletion test/TabExpansion.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ Describe 'TabExpansion Tests' {
git branch -q master origin/master 2>$null
}
It 'Tab completes all remotes' {
(git remote) -contains 'origin' | Should Be $true

$result = & $module GitTabExpansionInternal 'git push '
$result | Should BeExactly (git remote)
$result -contains 'origin' | Should Be $true
}
It 'Tab completes all branches' {
$result = & $module GitTabExpansionInternal 'git push origin '
Expand Down Expand Up @@ -207,6 +209,12 @@ Describe 'TabExpansion Tests' {
AfterEach {
ResetGitTempRepoWorkingDir $repoPath
}
It 'Tab completes remote name with special char as quoted' {
git.exe remote add '#test' https://github.com/dahlbyk/posh-git.git 2> $null

$result = & $module GitTabExpansionInternal 'git push #'
$result | Should BeExactly "'#test'"
}
It 'Tab completes branch name with special char as quoted' {
git.exe branch '#develop' 2>$null

Expand Down