Permalink
Browse files

Add expansion for remote branches

  • Loading branch information...
dahlbyk committed Jan 26, 2012
1 parent 17d1a8d commit 00d7c9177f2a6c9b1ec04948c380c18a487c7948
Showing with 7 additions and 1 deletion.
  1. +7 −1 GitTabExpansion.ps1
View
@@ -42,10 +42,16 @@ function script:gitRemotes($filter) {
}
function script:gitBranches($filter, $includeHEAD = $false) {
+ if ($filter -match "^(?<from>\S*\.{2,3})(?<to>.*)") {
+ $prefix = $matches['from']
+ $filter = $matches['to']
+ }
$branches = @(git branch | foreach { if($_ -match "^\*?\s*(?<ref>.*)") { $matches['ref'] } }) +
+ @(git branch -r | foreach { if($_ -match "^ (?<ref>\S+)(?: -> .+)?") { $matches['ref'] } }) +
@(if ($includeHEAD) { 'HEAD','FETCH_HEAD','ORIG_HEAD','MERGE_HEAD' })
$branches |
- where { $_ -ne '(no branch)' -and $_ -like "$filter*" }
+ where { $_ -ne '(no branch)' -and $_ -like "$filter*" } |
+ foreach { $prefix + $_ }
}
function script:gitStashes($filter) {

0 comments on commit 00d7c91

Please sign in to comment.