summaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2006-11-03 05:41:47 (GMT)
committerJunio C Hamano <junkio@cox.net>2006-11-03 05:41:47 (GMT)
commitaac91b7eeae4e8cf6521a5370caf03eb432ce492 (patch)
tree7542e33984d341d8dbbffb3827c37dfaea4e87cc /contrib
parent4508dde16951df00529207f179fee405e8646a64 (diff)
parent861ed12106d7f8e65b90c8a5ed4a026cd71a044d (diff)
downloadgit-aac91b7eeae4e8cf6521a5370caf03eb432ce492.zip
git-aac91b7eeae4e8cf6521a5370caf03eb432ce492.tar.gz
git-aac91b7eeae4e8cf6521a5370caf03eb432ce492.tar.bz2
Merge branch 'sp/keep-pack' into np/index-pack
* sp/keep-pack: (29 commits) Remove unused variable in receive-pack. Teach git-index-pack how to keep a pack file. Only repack active packs by skipping over kept packs. Allow short pack names to git-pack-objects --unpacked=. git-send-email: Read the default SMTP server from the GIT config file git-send-email: Document support for local sendmail instead of SMTP server Swap the porcelain and plumbing commands in the git man page Mention that pull can work locally in the synopsis gitweb: Add "next" link to commitdiff view gitweb: Move git_get_last_activity subroutine earlier Documentation: fix git-format-patch mark-up and link it from git.txt Documentation: Update information about <format> in git-for-each-ref Bash completion support for aliases gitweb: Fix up bogus $stylesheet declarations tests: merge-recursive is usable without Python gitweb: Check git base URLs before generating URL from it Documentation: add git in /etc/services. Documentation: add upload-archive service to git-daemon. git-cherry: document limit and add diagram diff-format.txt: Correct information about pathnames quoting in patch format ...
Diffstat (limited to 'contrib')
-rwxr-xr-xcontrib/completion/git-completion.bash29
1 files changed, 27 insertions, 2 deletions
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index d9cb17d..b074f4f 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -101,6 +101,23 @@ __git_complete_file ()
esac
}
+__git_aliases ()
+{
+ git repo-config --list | grep '^alias\.' \
+ | sed -e 's/^alias\.//' -e 's/=.*$//'
+}
+
+__git_aliased_command ()
+{
+ local cmdline=$(git repo-config alias.$1)
+ for word in $cmdline; do
+ if [ "${word##-*}" ]; then
+ echo $word
+ return
+ fi
+ done
+}
+
_git_branch ()
{
local cur="${COMP_WORDS[COMP_CWORD]}"
@@ -264,10 +281,18 @@ _git ()
{
if [ $COMP_CWORD = 1 ]; then
COMPREPLY=($(compgen \
- -W "--version $(git help -a|egrep '^ ')" \
+ -W "--version $(git help -a|egrep '^ ') \
+ $(__git_aliases)" \
-- "${COMP_WORDS[COMP_CWORD]}"))
else
- case "${COMP_WORDS[1]}" in
+ local command="${COMP_WORDS[1]}"
+ local expansion=$(__git_aliased_command "$command")
+
+ if [ "$expansion" ]; then
+ command="$expansion"
+ fi
+
+ case "$command" in
branch) _git_branch ;;
cat-file) _git_cat_file ;;
checkout) _git_checkout ;;