Created
December 21, 2011 06:38
-
-
Save tomykaira/1504938 to your computer and use it in GitHub Desktop.
patch for https://gist.github.com/1504934
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git-completion.bash | 36 +++++++++++++++++++++++++++++++++++- | |
1 files changed, 35 insertions(+), 1 deletions(-) | |
diff --git a/git-completion.bash b/git-completion.bash | |
index b7c1edf..ca41f34 100755 | |
--- a/git-completion.bash | |
+++ b/git-completion.bash | |
@@ -1057,6 +1057,32 @@ _git_apply () | |
COMPREPLY=() | |
} | |
+__git_changed_files () | |
+{ | |
+ local IFSBAK=$IFS | |
+ local IFS=" | |
+" | |
+ for f in $(git status --short 2>/dev/null); do | |
+ case `echo $f | cut -c -2` in | |
+ ' D' | ' M' ) echo "$f" | cut -c 4- ;; | |
+ esac | |
+ done | |
+ IFS=$IFSBAK | |
+} | |
+ | |
+__git_unstaged_files () | |
+{ | |
+ local IFSBAK=$IFS | |
+ local IFS=" | |
+" | |
+ for f in $(git status --short 2>/dev/null); do | |
+ case `echo $f | cut -c -2` in | |
+ ' M' | '??' ) echo "$f" | cut -c 4- ;; | |
+ esac | |
+ done | |
+ IFS=$IFSBAK | |
+} | |
+ | |
_git_add () | |
{ | |
__git_has_doubledash && return | |
@@ -1068,6 +1094,11 @@ _git_add () | |
--ignore-errors --intent-to-add | |
" | |
return | |
+ ;; | |
+ *) | |
+ __gitcomp "$(__git_unstaged_files)" | |
+ return | |
+ ;; | |
esac | |
COMPREPLY=() | |
} | |
@@ -1172,7 +1203,10 @@ _git_bundle () | |
_git_checkout () | |
{ | |
- __git_has_doubledash && return | |
+ if __git_has_doubledash ; then | |
+ __gitcomp "$(__git_changed_files)" | |
+ return | |
+ fi | |
case "$cur" in | |
--conflict=*) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment