Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add tab completion for push target refs

  • Loading branch information...
commit 36c35bcc2e5c60b5417bdfbb97aacec1812ea980 1 parent b33730b
@dahlbyk authored
Showing with 12 additions and 1 deletion.
  1. +12 −1 GitTabExpansion.ps1
View
13 GitTabExpansion.ps1
@@ -58,6 +58,12 @@ function script:gitBranches($filter, $includeHEAD = $false) {
foreach { $prefix + $_ }
}
+function script:gitRemoteBranches($remote, $ref, $filter) {
+ git branch -r |
+ where { $_ -like " $remote/$filter*" } |
+ foreach { $ref + ($_ -replace " $remote/","") }
+}
+
function script:gitStashes($filter) {
(git stash list) -replace ':.*','' |
where { $_ -like "$filter*" } |
@@ -155,9 +161,14 @@ function GitTabExpansion($lastBlock) {
gitCommands $matches['cmd'] $FALSE
}
+ # Handles git push remote <ref>:<branch>
+ "^push.* (?<remote>\S+) (?<ref>[^\s\:]*\:)(?<branch>\S*)$" {
+ gitRemoteBranches $matches['remote'] $matches['ref'] $matches['branch']
+ }
+
# Handles git push remote <branch>
# Handles git pull remote <branch>
- "^(?:push|pull).* (?:\S+) (?<branch>\S*)$" {
+ "^(?:push|pull).* (?:\S+) (?<branch>[^\s\:]*)$" {
gitBranches $matches['branch']
}
Please sign in to comment.
Something went wrong with that request. Please try again.