bash completion: add options for 'git fsck'
[git/dscho.git] / contrib / completion / git-completion.bash
blob10e36a7b0dc574eae9a6a5465a5b19506909251d
1 #!bash
3 # bash completion support for core Git.
5 # Copyright (C) 2006,2007 Shawn O. Pearce <spearce@spearce.org>
6 # Conceptually based on gitcompletion (http://gitweb.hawaga.org.uk/).
7 # Distributed under the GNU General Public License, version 2.0.
9 # The contained completion routines provide support for completing:
11 # *) local and remote branch names
12 # *) local and remote tag names
13 # *) .git/remotes file names
14 # *) git 'subcommands'
15 # *) tree paths within 'ref:path/to/file' expressions
16 # *) common --long-options
18 # To use these routines:
20 # 1) Copy this file to somewhere (e.g. ~/.git-completion.sh).
21 # 2) Added the following line to your .bashrc:
22 # source ~/.git-completion.sh
24 # 3) You may want to make sure the git executable is available
25 # in your PATH before this script is sourced, as some caching
26 # is performed while the script loads. If git isn't found
27 # at source time then all lookups will be done on demand,
28 # which may be slightly slower.
30 # 4) Consider changing your PS1 to also show the current branch:
31 # PS1='[\u@\h \W$(__git_ps1 " (%s)")]\$ '
33 # The argument to __git_ps1 will be displayed only if you
34 # are currently in a git repository. The %s token will be
35 # the name of the current branch.
37 # In addition, if you set GIT_PS1_SHOWDIRTYSTATE to a nonempty
38 # value, unstaged (*) and staged (+) changes will be shown next
39 # to the branch name. You can configure this per-repository
40 # with the bash.showDirtyState variable, which defaults to true
41 # once GIT_PS1_SHOWDIRTYSTATE is enabled.
43 # To submit patches:
45 # *) Read Documentation/SubmittingPatches
46 # *) Send all patches to the current maintainer:
48 # "Shawn O. Pearce" <spearce@spearce.org>
50 # *) Always CC the Git mailing list:
52 # git@vger.kernel.org
55 case "$COMP_WORDBREAKS" in
56 *:*) : great ;;
57 *) COMP_WORDBREAKS="$COMP_WORDBREAKS:"
58 esac
60 # __gitdir accepts 0 or 1 arguments (i.e., location)
61 # returns location of .git repo
62 __gitdir ()
64 if [ -z "${1-}" ]; then
65 if [ -n "${__git_dir-}" ]; then
66 echo "$__git_dir"
67 elif [ -d .git ]; then
68 echo .git
69 else
70 git rev-parse --git-dir 2>/dev/null
72 elif [ -d "$1/.git" ]; then
73 echo "$1/.git"
74 else
75 echo "$1"
79 # __git_ps1 accepts 0 or 1 arguments (i.e., format string)
80 # returns text to add to bash PS1 prompt (includes branch name)
81 __git_ps1 ()
83 local g="$(__gitdir)"
84 if [ -n "$g" ]; then
85 local r
86 local b
87 if [ -d "$g/rebase-apply" ]; then
88 if [ -f "$g/rebase-apply/rebasing" ]; then
89 r="|REBASE"
90 elif [ -f "$g/rebase-apply/applying" ]; then
91 r="|AM"
92 else
93 r="|AM/REBASE"
95 b="$(git symbolic-ref HEAD 2>/dev/null)"
96 elif [ -f "$g/rebase-merge/interactive" ]; then
97 r="|REBASE-i"
98 b="$(cat "$g/rebase-merge/head-name")"
99 elif [ -d "$g/rebase-merge" ]; then
100 r="|REBASE-m"
101 b="$(cat "$g/rebase-merge/head-name")"
102 elif [ -f "$g/MERGE_HEAD" ]; then
103 r="|MERGING"
104 b="$(git symbolic-ref HEAD 2>/dev/null)"
105 else
106 if [ -f "$g/BISECT_LOG" ]; then
107 r="|BISECTING"
109 if ! b="$(git symbolic-ref HEAD 2>/dev/null)"; then
110 if ! b="$(git describe --exact-match HEAD 2>/dev/null)"; then
111 if [ -r "$g/HEAD" ]; then
112 b="$(cut -c1-7 "$g/HEAD")..."
118 local w
119 local i
120 local c
122 if [ "true" = "$(git rev-parse --is-inside-git-dir 2>/dev/null)" ]; then
123 if [ "true" = "$(git config --bool core.bare 2>/dev/null)" ]; then
124 c="BARE:"
125 else
126 b="GIT_DIR!"
128 elif [ "true" = "$(git rev-parse --is-inside-work-tree 2>/dev/null)" ]; then
129 if [ -n "${GIT_PS1_SHOWDIRTYSTATE-}" ]; then
130 if [ "$(git config --bool bash.showDirtyState)" != "false" ]; then
131 git diff --no-ext-diff --ignore-submodules \
132 --quiet --exit-code || w="*"
133 if git rev-parse --quiet --verify HEAD >/dev/null; then
134 git diff-index --cached --quiet \
135 --ignore-submodules HEAD -- || i="+"
136 else
137 i="#"
143 if [ -n "$b" ]; then
144 if [ -n "${1-}" ]; then
145 printf "$1" "$c${b##refs/heads/}$w$i$r"
146 else
147 printf " (%s)" "$c${b##refs/heads/}$w$i$r"
153 # __gitcomp_1 requires 2 arguments
154 __gitcomp_1 ()
156 local c IFS=' '$'\t'$'\n'
157 for c in $1; do
158 case "$c$2" in
159 --*=*) printf %s$'\n' "$c$2" ;;
160 *.) printf %s$'\n' "$c$2" ;;
161 *) printf %s$'\n' "$c$2 " ;;
162 esac
163 done
166 # __gitcomp accepts 1, 2, 3, or 4 arguments
167 # generates completion reply with compgen
168 __gitcomp ()
170 local cur="${COMP_WORDS[COMP_CWORD]}"
171 if [ $# -gt 2 ]; then
172 cur="$3"
174 case "$cur" in
175 --*=)
176 COMPREPLY=()
179 local IFS=$'\n'
180 COMPREPLY=($(compgen -P "${2-}" \
181 -W "$(__gitcomp_1 "${1-}" "${4-}")" \
182 -- "$cur"))
184 esac
187 # __git_heads accepts 0 or 1 arguments (to pass to __gitdir)
188 __git_heads ()
190 local cmd i is_hash=y dir="$(__gitdir "${1-}")"
191 if [ -d "$dir" ]; then
192 git --git-dir="$dir" for-each-ref --format='%(refname:short)' \
193 refs/heads
194 return
196 for i in $(git ls-remote "${1-}" 2>/dev/null); do
197 case "$is_hash,$i" in
198 y,*) is_hash=n ;;
199 n,*^{}) is_hash=y ;;
200 n,refs/heads/*) is_hash=y; echo "${i#refs/heads/}" ;;
201 n,*) is_hash=y; echo "$i" ;;
202 esac
203 done
206 # __git_tags accepts 0 or 1 arguments (to pass to __gitdir)
207 __git_tags ()
209 local cmd i is_hash=y dir="$(__gitdir "${1-}")"
210 if [ -d "$dir" ]; then
211 git --git-dir="$dir" for-each-ref --format='%(refname:short)' \
212 refs/tags
213 return
215 for i in $(git ls-remote "${1-}" 2>/dev/null); do
216 case "$is_hash,$i" in
217 y,*) is_hash=n ;;
218 n,*^{}) is_hash=y ;;
219 n,refs/tags/*) is_hash=y; echo "${i#refs/tags/}" ;;
220 n,*) is_hash=y; echo "$i" ;;
221 esac
222 done
225 # __git_refs accepts 0 or 1 arguments (to pass to __gitdir)
226 __git_refs ()
228 local i is_hash=y dir="$(__gitdir "${1-}")"
229 local cur="${COMP_WORDS[COMP_CWORD]}" format refs
230 if [ -d "$dir" ]; then
231 case "$cur" in
232 refs|refs/*)
233 format="refname"
234 refs="${cur%/*}"
237 if [ -e "$dir/HEAD" ]; then echo HEAD; fi
238 format="refname:short"
239 refs="refs/tags refs/heads refs/remotes"
241 esac
242 git --git-dir="$dir" for-each-ref --format="%($format)" \
243 $refs
244 return
246 for i in $(git ls-remote "$dir" 2>/dev/null); do
247 case "$is_hash,$i" in
248 y,*) is_hash=n ;;
249 n,*^{}) is_hash=y ;;
250 n,refs/tags/*) is_hash=y; echo "${i#refs/tags/}" ;;
251 n,refs/heads/*) is_hash=y; echo "${i#refs/heads/}" ;;
252 n,refs/remotes/*) is_hash=y; echo "${i#refs/remotes/}" ;;
253 n,*) is_hash=y; echo "$i" ;;
254 esac
255 done
258 # __git_refs2 requires 1 argument (to pass to __git_refs)
259 __git_refs2 ()
261 local i
262 for i in $(__git_refs "$1"); do
263 echo "$i:$i"
264 done
267 # __git_refs_remotes requires 1 argument (to pass to ls-remote)
268 __git_refs_remotes ()
270 local cmd i is_hash=y
271 for i in $(git ls-remote "$1" 2>/dev/null); do
272 case "$is_hash,$i" in
273 n,refs/heads/*)
274 is_hash=y
275 echo "$i:refs/remotes/$1/${i#refs/heads/}"
277 y,*) is_hash=n ;;
278 n,*^{}) is_hash=y ;;
279 n,refs/tags/*) is_hash=y;;
280 n,*) is_hash=y; ;;
281 esac
282 done
285 __git_remotes ()
287 local i ngoff IFS=$'\n' d="$(__gitdir)"
288 shopt -q nullglob || ngoff=1
289 shopt -s nullglob
290 for i in "$d/remotes"/*; do
291 echo ${i#$d/remotes/}
292 done
293 [ "$ngoff" ] && shopt -u nullglob
294 for i in $(git --git-dir="$d" config --list); do
295 case "$i" in
296 remote.*.url=*)
297 i="${i#remote.}"
298 echo "${i/.url=*/}"
300 esac
301 done
304 __git_merge_strategies ()
306 if [ -n "${__git_merge_strategylist-}" ]; then
307 echo "$__git_merge_strategylist"
308 return
310 git merge -s help 2>&1 |
311 sed -n -e '/[Aa]vailable strategies are: /,/^$/{
312 s/\.$//
313 s/.*://
314 s/^[ ]*//
315 s/[ ]*$//
319 __git_merge_strategylist=
320 __git_merge_strategylist=$(__git_merge_strategies 2>/dev/null)
322 __git_complete_file ()
324 local pfx ls ref cur="${COMP_WORDS[COMP_CWORD]}"
325 case "$cur" in
326 ?*:*)
327 ref="${cur%%:*}"
328 cur="${cur#*:}"
329 case "$cur" in
330 ?*/*)
331 pfx="${cur%/*}"
332 cur="${cur##*/}"
333 ls="$ref:$pfx"
334 pfx="$pfx/"
337 ls="$ref"
339 esac
341 case "$COMP_WORDBREAKS" in
342 *:*) : great ;;
343 *) pfx="$ref:$pfx" ;;
344 esac
346 local IFS=$'\n'
347 COMPREPLY=($(compgen -P "$pfx" \
348 -W "$(git --git-dir="$(__gitdir)" ls-tree "$ls" \
349 | sed '/^100... blob /{
350 s,^.* ,,
351 s,$, ,
353 /^120000 blob /{
354 s,^.* ,,
355 s,$, ,
357 /^040000 tree /{
358 s,^.* ,,
359 s,$,/,
361 s/^.* //')" \
362 -- "$cur"))
365 __gitcomp "$(__git_refs)"
367 esac
370 __git_complete_revlist ()
372 local pfx cur="${COMP_WORDS[COMP_CWORD]}"
373 case "$cur" in
374 *...*)
375 pfx="${cur%...*}..."
376 cur="${cur#*...}"
377 __gitcomp "$(__git_refs)" "$pfx" "$cur"
379 *..*)
380 pfx="${cur%..*}.."
381 cur="${cur#*..}"
382 __gitcomp "$(__git_refs)" "$pfx" "$cur"
385 __gitcomp "$(__git_refs)"
387 esac
390 __git_complete_remote_or_refspec ()
392 local cmd="${COMP_WORDS[1]}"
393 local cur="${COMP_WORDS[COMP_CWORD]}"
394 local i c=2 remote="" pfx="" lhs=1 no_complete_refspec=0
395 while [ $c -lt $COMP_CWORD ]; do
396 i="${COMP_WORDS[c]}"
397 case "$i" in
398 --all|--mirror) [ "$cmd" = "push" ] && no_complete_refspec=1 ;;
399 -*) ;;
400 *) remote="$i"; break ;;
401 esac
402 c=$((++c))
403 done
404 if [ -z "$remote" ]; then
405 __gitcomp "$(__git_remotes)"
406 return
408 if [ $no_complete_refspec = 1 ]; then
409 COMPREPLY=()
410 return
412 [ "$remote" = "." ] && remote=
413 case "$cur" in
414 *:*)
415 case "$COMP_WORDBREAKS" in
416 *:*) : great ;;
417 *) pfx="${cur%%:*}:" ;;
418 esac
419 cur="${cur#*:}"
420 lhs=0
423 pfx="+"
424 cur="${cur#+}"
426 esac
427 case "$cmd" in
428 fetch)
429 if [ $lhs = 1 ]; then
430 __gitcomp "$(__git_refs2 "$remote")" "$pfx" "$cur"
431 else
432 __gitcomp "$(__git_refs)" "$pfx" "$cur"
435 pull)
436 if [ $lhs = 1 ]; then
437 __gitcomp "$(__git_refs "$remote")" "$pfx" "$cur"
438 else
439 __gitcomp "$(__git_refs)" "$pfx" "$cur"
442 push)
443 if [ $lhs = 1 ]; then
444 __gitcomp "$(__git_refs)" "$pfx" "$cur"
445 else
446 __gitcomp "$(__git_refs "$remote")" "$pfx" "$cur"
449 esac
452 __git_complete_strategy ()
454 case "${COMP_WORDS[COMP_CWORD-1]}" in
455 -s|--strategy)
456 __gitcomp "$(__git_merge_strategies)"
457 return 0
458 esac
459 local cur="${COMP_WORDS[COMP_CWORD]}"
460 case "$cur" in
461 --strategy=*)
462 __gitcomp "$(__git_merge_strategies)" "" "${cur##--strategy=}"
463 return 0
465 esac
466 return 1
469 __git_all_commands ()
471 if [ -n "${__git_all_commandlist-}" ]; then
472 echo "$__git_all_commandlist"
473 return
475 local i IFS=" "$'\n'
476 for i in $(git help -a|egrep '^ ')
478 case $i in
479 *--*) : helper pattern;;
480 *) echo $i;;
481 esac
482 done
484 __git_all_commandlist=
485 __git_all_commandlist="$(__git_all_commands 2>/dev/null)"
487 __git_porcelain_commands ()
489 if [ -n "${__git_porcelain_commandlist-}" ]; then
490 echo "$__git_porcelain_commandlist"
491 return
493 local i IFS=" "$'\n'
494 for i in "help" $(__git_all_commands)
496 case $i in
497 *--*) : helper pattern;;
498 applymbox) : ask gittus;;
499 applypatch) : ask gittus;;
500 archimport) : import;;
501 cat-file) : plumbing;;
502 check-attr) : plumbing;;
503 check-ref-format) : plumbing;;
504 checkout-index) : plumbing;;
505 commit-tree) : plumbing;;
506 count-objects) : infrequent;;
507 cvsexportcommit) : export;;
508 cvsimport) : import;;
509 cvsserver) : daemon;;
510 daemon) : daemon;;
511 diff-files) : plumbing;;
512 diff-index) : plumbing;;
513 diff-tree) : plumbing;;
514 fast-import) : import;;
515 fast-export) : export;;
516 fsck-objects) : plumbing;;
517 fetch-pack) : plumbing;;
518 fmt-merge-msg) : plumbing;;
519 for-each-ref) : plumbing;;
520 hash-object) : plumbing;;
521 http-*) : transport;;
522 index-pack) : plumbing;;
523 init-db) : deprecated;;
524 local-fetch) : plumbing;;
525 lost-found) : infrequent;;
526 ls-files) : plumbing;;
527 ls-remote) : plumbing;;
528 ls-tree) : plumbing;;
529 mailinfo) : plumbing;;
530 mailsplit) : plumbing;;
531 merge-*) : plumbing;;
532 mktree) : plumbing;;
533 mktag) : plumbing;;
534 pack-objects) : plumbing;;
535 pack-redundant) : plumbing;;
536 pack-refs) : plumbing;;
537 parse-remote) : plumbing;;
538 patch-id) : plumbing;;
539 peek-remote) : plumbing;;
540 prune) : plumbing;;
541 prune-packed) : plumbing;;
542 quiltimport) : import;;
543 read-tree) : plumbing;;
544 receive-pack) : plumbing;;
545 reflog) : plumbing;;
546 repo-config) : deprecated;;
547 rerere) : plumbing;;
548 rev-list) : plumbing;;
549 rev-parse) : plumbing;;
550 runstatus) : plumbing;;
551 sh-setup) : internal;;
552 shell) : daemon;;
553 show-ref) : plumbing;;
554 send-pack) : plumbing;;
555 show-index) : plumbing;;
556 ssh-*) : transport;;
557 stripspace) : plumbing;;
558 symbolic-ref) : plumbing;;
559 tar-tree) : deprecated;;
560 unpack-file) : plumbing;;
561 unpack-objects) : plumbing;;
562 update-index) : plumbing;;
563 update-ref) : plumbing;;
564 update-server-info) : daemon;;
565 upload-archive) : plumbing;;
566 upload-pack) : plumbing;;
567 write-tree) : plumbing;;
568 var) : infrequent;;
569 verify-pack) : infrequent;;
570 verify-tag) : plumbing;;
571 *) echo $i;;
572 esac
573 done
575 __git_porcelain_commandlist=
576 __git_porcelain_commandlist="$(__git_porcelain_commands 2>/dev/null)"
578 __git_aliases ()
580 local i IFS=$'\n'
581 for i in $(git --git-dir="$(__gitdir)" config --list); do
582 case "$i" in
583 alias.*)
584 i="${i#alias.}"
585 echo "${i/=*/}"
587 esac
588 done
591 # __git_aliased_command requires 1 argument
592 __git_aliased_command ()
594 local word cmdline=$(git --git-dir="$(__gitdir)" \
595 config --get "alias.$1")
596 for word in $cmdline; do
597 if [ "${word##-*}" ]; then
598 echo $word
599 return
601 done
604 # __git_find_subcommand requires 1 argument
605 __git_find_subcommand ()
607 local word subcommand c=1
609 while [ $c -lt $COMP_CWORD ]; do
610 word="${COMP_WORDS[c]}"
611 for subcommand in $1; do
612 if [ "$subcommand" = "$word" ]; then
613 echo "$subcommand"
614 return
616 done
617 c=$((++c))
618 done
621 __git_has_doubledash ()
623 local c=1
624 while [ $c -lt $COMP_CWORD ]; do
625 if [ "--" = "${COMP_WORDS[c]}" ]; then
626 return 0
628 c=$((++c))
629 done
630 return 1
633 __git_whitespacelist="nowarn warn error error-all fix"
635 _git_am ()
637 local cur="${COMP_WORDS[COMP_CWORD]}" dir="$(__gitdir)"
638 if [ -d "$dir"/rebase-apply ]; then
639 __gitcomp "--skip --resolved --abort"
640 return
642 case "$cur" in
643 --whitespace=*)
644 __gitcomp "$__git_whitespacelist" "" "${cur##--whitespace=}"
645 return
647 --*)
648 __gitcomp "
649 --signoff --utf8 --binary --3way --interactive
650 --whitespace=
652 return
653 esac
654 COMPREPLY=()
657 _git_apply ()
659 local cur="${COMP_WORDS[COMP_CWORD]}"
660 case "$cur" in
661 --whitespace=*)
662 __gitcomp "$__git_whitespacelist" "" "${cur##--whitespace=}"
663 return
665 --*)
666 __gitcomp "
667 --stat --numstat --summary --check --index
668 --cached --index-info --reverse --reject --unidiff-zero
669 --apply --no-add --exclude=
670 --whitespace= --inaccurate-eof --verbose
672 return
673 esac
674 COMPREPLY=()
677 _git_add ()
679 __git_has_doubledash && return
681 local cur="${COMP_WORDS[COMP_CWORD]}"
682 case "$cur" in
683 --*)
684 __gitcomp "
685 --interactive --refresh --patch --update --dry-run
686 --ignore-errors --intent-to-add
688 return
689 esac
690 COMPREPLY=()
693 _git_archive ()
695 local cur="${COMP_WORDS[COMP_CWORD]}"
696 case "$cur" in
697 --format=*)
698 __gitcomp "$(git archive --list)" "" "${cur##--format=}"
699 return
701 --remote=*)
702 __gitcomp "$(__git_remotes)" "" "${cur##--remote=}"
703 return
705 --*)
706 __gitcomp "
707 --format= --list --verbose
708 --prefix= --remote= --exec=
710 return
712 esac
713 __git_complete_file
716 _git_bisect ()
718 __git_has_doubledash && return
720 local subcommands="start bad good skip reset visualize replay log run"
721 local subcommand="$(__git_find_subcommand "$subcommands")"
722 if [ -z "$subcommand" ]; then
723 __gitcomp "$subcommands"
724 return
727 case "$subcommand" in
728 bad|good|reset|skip)
729 __gitcomp "$(__git_refs)"
732 COMPREPLY=()
734 esac
737 _git_branch ()
739 local i c=1 only_local_ref="n" has_r="n"
741 while [ $c -lt $COMP_CWORD ]; do
742 i="${COMP_WORDS[c]}"
743 case "$i" in
744 -d|-m) only_local_ref="y" ;;
745 -r) has_r="y" ;;
746 esac
747 c=$((++c))
748 done
750 case "${COMP_WORDS[COMP_CWORD]}" in
751 --*)
752 __gitcomp "
753 --color --no-color --verbose --abbrev= --no-abbrev
754 --track --no-track --contains --merged --no-merged
758 if [ $only_local_ref = "y" -a $has_r = "n" ]; then
759 __gitcomp "$(__git_heads)"
760 else
761 __gitcomp "$(__git_refs)"
764 esac
767 _git_bundle ()
769 local cmd="${COMP_WORDS[2]}"
770 case "$COMP_CWORD" in
772 __gitcomp "create list-heads verify unbundle"
775 # looking for a file
778 case "$cmd" in
779 create)
780 __git_complete_revlist
782 esac
784 esac
787 _git_checkout ()
789 __git_has_doubledash && return
791 __gitcomp "$(__git_refs)"
794 _git_cherry ()
796 __gitcomp "$(__git_refs)"
799 _git_cherry_pick ()
801 local cur="${COMP_WORDS[COMP_CWORD]}"
802 case "$cur" in
803 --*)
804 __gitcomp "--edit --no-commit"
807 __gitcomp "$(__git_refs)"
809 esac
812 _git_clean ()
814 __git_has_doubledash && return
816 local cur="${COMP_WORDS[COMP_CWORD]}"
817 case "$cur" in
818 --*)
819 __gitcomp "--dry-run --quiet"
820 return
822 esac
823 COMPREPLY=()
826 _git_clone ()
828 local cur="${COMP_WORDS[COMP_CWORD]}"
829 case "$cur" in
830 --*)
831 __gitcomp "
832 --local
833 --no-hardlinks
834 --shared
835 --reference
836 --quiet
837 --no-checkout
838 --bare
839 --mirror
840 --origin
841 --upload-pack
842 --template=
843 --depth
845 return
847 esac
848 COMPREPLY=()
851 _git_commit ()
853 __git_has_doubledash && return
855 local cur="${COMP_WORDS[COMP_CWORD]}"
856 case "$cur" in
857 --*)
858 __gitcomp "
859 --all --author= --signoff --verify --no-verify
860 --edit --amend --include --only --interactive
862 return
863 esac
864 COMPREPLY=()
867 _git_describe ()
869 local cur="${COMP_WORDS[COMP_CWORD]}"
870 case "$cur" in
871 --*)
872 __gitcomp "
873 --all --tags --contains --abbrev= --candidates=
874 --exact-match --debug --long --match --always
876 return
877 esac
878 __gitcomp "$(__git_refs)"
881 __git_diff_common_options="--stat --numstat --shortstat --summary
882 --patch-with-stat --name-only --name-status --color
883 --no-color --color-words --no-renames --check
884 --full-index --binary --abbrev --diff-filter=
885 --find-copies-harder
886 --text --ignore-space-at-eol --ignore-space-change
887 --ignore-all-space --exit-code --quiet --ext-diff
888 --no-ext-diff
889 --no-prefix --src-prefix= --dst-prefix=
890 --inter-hunk-context=
891 --patience
892 --raw
895 _git_diff ()
897 __git_has_doubledash && return
899 local cur="${COMP_WORDS[COMP_CWORD]}"
900 case "$cur" in
901 --*)
902 __gitcomp "--cached --staged --pickaxe-all --pickaxe-regex
903 --base --ours --theirs
904 $__git_diff_common_options
906 return
908 esac
909 __git_complete_file
912 __git_fetch_options="
913 --quiet --verbose --append --upload-pack --force --keep --depth=
914 --tags --no-tags
917 _git_fetch ()
919 local cur="${COMP_WORDS[COMP_CWORD]}"
920 case "$cur" in
921 --*)
922 __gitcomp "$__git_fetch_options"
923 return
925 esac
926 __git_complete_remote_or_refspec
929 _git_format_patch ()
931 local cur="${COMP_WORDS[COMP_CWORD]}"
932 case "$cur" in
933 --*)
934 __gitcomp "
935 --stdout --attach --thread
936 --output-directory
937 --numbered --start-number
938 --numbered-files
939 --keep-subject
940 --signoff
941 --in-reply-to=
942 --full-index --binary
943 --not --all
944 --cover-letter
945 --no-prefix --src-prefix= --dst-prefix=
946 --inline --suffix= --ignore-if-in-upstream
947 --subject-prefix=
949 return
951 esac
952 __git_complete_revlist
955 _git_fsck ()
957 local cur="${COMP_WORDS[COMP_CWORD]}"
958 case "$cur" in
959 --*)
960 __gitcomp "
961 --tags --root --unreachable --cache --no-reflogs --full
962 --strict --verbose --lost-found
964 return
966 esac
967 COMPREPLY=()
970 _git_gc ()
972 local cur="${COMP_WORDS[COMP_CWORD]}"
973 case "$cur" in
974 --*)
975 __gitcomp "--prune --aggressive"
976 return
978 esac
979 COMPREPLY=()
982 _git_grep ()
984 __git_has_doubledash && return
986 local cur="${COMP_WORDS[COMP_CWORD]}"
987 case "$cur" in
988 --*)
989 __gitcomp "
990 --cached
991 --text --ignore-case --word-regexp --invert-match
992 --full-name
993 --extended-regexp --basic-regexp --fixed-strings
994 --files-with-matches --name-only
995 --files-without-match
996 --count
997 --and --or --not --all-match
999 return
1001 esac
1002 COMPREPLY=()
1005 _git_help ()
1007 local cur="${COMP_WORDS[COMP_CWORD]}"
1008 case "$cur" in
1009 --*)
1010 __gitcomp "--all --info --man --web"
1011 return
1013 esac
1014 __gitcomp "$(__git_all_commands)
1015 attributes cli core-tutorial cvs-migration
1016 diffcore gitk glossary hooks ignore modules
1017 repository-layout tutorial tutorial-2
1018 workflows
1022 _git_init ()
1024 local cur="${COMP_WORDS[COMP_CWORD]}"
1025 case "$cur" in
1026 --shared=*)
1027 __gitcomp "
1028 false true umask group all world everybody
1029 " "" "${cur##--shared=}"
1030 return
1032 --*)
1033 __gitcomp "--quiet --bare --template= --shared --shared="
1034 return
1036 esac
1037 COMPREPLY=()
1040 _git_ls_files ()
1042 __git_has_doubledash && return
1044 local cur="${COMP_WORDS[COMP_CWORD]}"
1045 case "$cur" in
1046 --*)
1047 __gitcomp "--cached --deleted --modified --others --ignored
1048 --stage --directory --no-empty-directory --unmerged
1049 --killed --exclude= --exclude-from=
1050 --exclude-per-directory= --exclude-standard
1051 --error-unmatch --with-tree= --full-name
1052 --abbrev --ignored --exclude-per-directory
1054 return
1056 esac
1057 COMPREPLY=()
1060 _git_ls_remote ()
1062 __gitcomp "$(__git_remotes)"
1065 _git_ls_tree ()
1067 __git_complete_file
1070 # Options that go well for log, shortlog and gitk
1071 __git_log_common_options="
1072 --not --all
1073 --branches --tags --remotes
1074 --first-parent --no-merges
1075 --max-count=
1076 --max-age= --since= --after=
1077 --min-age= --until= --before=
1079 # Options that go well for log and gitk (not shortlog)
1080 __git_log_gitk_options="
1081 --dense --sparse --full-history
1082 --simplify-merges --simplify-by-decoration
1083 --left-right
1085 # Options that go well for log and shortlog (not gitk)
1086 __git_log_shortlog_options="
1087 --author= --committer= --grep=
1088 --all-match
1091 __git_log_pretty_formats="oneline short medium full fuller email raw format:"
1093 _git_log ()
1095 __git_has_doubledash && return
1097 local cur="${COMP_WORDS[COMP_CWORD]}"
1098 local g="$(git rev-parse --git-dir 2>/dev/null)"
1099 local merge=""
1100 if [ -f $g/MERGE_HEAD ]; then
1101 merge="--merge"
1103 case "$cur" in
1104 --pretty=*)
1105 __gitcomp "$__git_log_pretty_formats
1106 " "" "${cur##--pretty=}"
1107 return
1109 --format=*)
1110 __gitcomp "$__git_log_pretty_formats
1111 " "" "${cur##--format=}"
1112 return
1114 --date=*)
1115 __gitcomp "
1116 relative iso8601 rfc2822 short local default
1117 " "" "${cur##--date=}"
1118 return
1120 --*)
1121 __gitcomp "
1122 $__git_log_common_options
1123 $__git_log_shortlog_options
1124 $__git_log_gitk_options
1125 --root --topo-order --date-order --reverse
1126 --follow
1127 --abbrev-commit --abbrev=
1128 --relative-date --date=
1129 --pretty= --format= --oneline
1130 --cherry-pick
1131 --graph
1132 --decorate
1133 --walk-reflogs
1134 --parents --children
1135 $merge
1136 $__git_diff_common_options
1137 --pickaxe-all --pickaxe-regex
1139 return
1141 esac
1142 __git_complete_revlist
1145 __git_merge_options="
1146 --no-commit --no-stat --log --no-log --squash --strategy
1147 --commit --stat --no-squash --ff --no-ff
1150 _git_merge ()
1152 __git_complete_strategy && return
1154 local cur="${COMP_WORDS[COMP_CWORD]}"
1155 case "$cur" in
1156 --*)
1157 __gitcomp "$__git_merge_options"
1158 return
1159 esac
1160 __gitcomp "$(__git_refs)"
1163 _git_mergetool ()
1165 local cur="${COMP_WORDS[COMP_CWORD]}"
1166 case "$cur" in
1167 --tool=*)
1168 __gitcomp "
1169 kdiff3 tkdiff meld xxdiff emerge
1170 vimdiff gvimdiff ecmerge opendiff
1171 " "" "${cur##--tool=}"
1172 return
1174 --*)
1175 __gitcomp "--tool="
1176 return
1178 esac
1179 COMPREPLY=()
1182 _git_merge_base ()
1184 __gitcomp "$(__git_refs)"
1187 _git_mv ()
1189 local cur="${COMP_WORDS[COMP_CWORD]}"
1190 case "$cur" in
1191 --*)
1192 __gitcomp "--dry-run"
1193 return
1195 esac
1196 COMPREPLY=()
1199 _git_name_rev ()
1201 __gitcomp "--tags --all --stdin"
1204 _git_pull ()
1206 __git_complete_strategy && return
1208 local cur="${COMP_WORDS[COMP_CWORD]}"
1209 case "$cur" in
1210 --*)
1211 __gitcomp "
1212 --rebase --no-rebase
1213 $__git_merge_options
1214 $__git_fetch_options
1216 return
1218 esac
1219 __git_complete_remote_or_refspec
1222 _git_push ()
1224 local cur="${COMP_WORDS[COMP_CWORD]}"
1225 case "${COMP_WORDS[COMP_CWORD-1]}" in
1226 --repo)
1227 __gitcomp "$(__git_remotes)"
1228 return
1229 esac
1230 case "$cur" in
1231 --repo=*)
1232 __gitcomp "$(__git_remotes)" "" "${cur##--repo=}"
1233 return
1235 --*)
1236 __gitcomp "
1237 --all --mirror --tags --dry-run --force --verbose
1238 --receive-pack= --repo=
1240 return
1242 esac
1243 __git_complete_remote_or_refspec
1246 _git_rebase ()
1248 local cur="${COMP_WORDS[COMP_CWORD]}" dir="$(__gitdir)"
1249 if [ -d "$dir"/rebase-apply ] || [ -d "$dir"/rebase-merge ]; then
1250 __gitcomp "--continue --skip --abort"
1251 return
1253 __git_complete_strategy && return
1254 case "$cur" in
1255 --*)
1256 __gitcomp "--onto --merge --strategy --interactive"
1257 return
1258 esac
1259 __gitcomp "$(__git_refs)"
1262 _git_send_email ()
1264 local cur="${COMP_WORDS[COMP_CWORD]}"
1265 case "$cur" in
1266 --*)
1267 __gitcomp "--bcc --cc --cc-cmd --chain-reply-to --compose
1268 --dry-run --envelope-sender --from --identity
1269 --in-reply-to --no-chain-reply-to --no-signed-off-by-cc
1270 --no-suppress-from --no-thread --quiet
1271 --signed-off-by-cc --smtp-pass --smtp-server
1272 --smtp-server-port --smtp-ssl --smtp-user --subject
1273 --suppress-cc --suppress-from --thread --to
1274 --validate --no-validate"
1275 return
1277 esac
1278 COMPREPLY=()
1281 _git_config ()
1283 local cur="${COMP_WORDS[COMP_CWORD]}"
1284 local prv="${COMP_WORDS[COMP_CWORD-1]}"
1285 case "$prv" in
1286 branch.*.remote)
1287 __gitcomp "$(__git_remotes)"
1288 return
1290 branch.*.merge)
1291 __gitcomp "$(__git_refs)"
1292 return
1294 remote.*.fetch)
1295 local remote="${prv#remote.}"
1296 remote="${remote%.fetch}"
1297 __gitcomp "$(__git_refs_remotes "$remote")"
1298 return
1300 remote.*.push)
1301 local remote="${prv#remote.}"
1302 remote="${remote%.push}"
1303 __gitcomp "$(git --git-dir="$(__gitdir)" \
1304 for-each-ref --format='%(refname):%(refname)' \
1305 refs/heads)"
1306 return
1308 pull.twohead|pull.octopus)
1309 __gitcomp "$(__git_merge_strategies)"
1310 return
1312 color.branch|color.diff|color.interactive|color.status|color.ui)
1313 __gitcomp "always never auto"
1314 return
1316 color.pager)
1317 __gitcomp "false true"
1318 return
1320 color.*.*)
1321 __gitcomp "
1322 normal black red green yellow blue magenta cyan white
1323 bold dim ul blink reverse
1325 return
1327 *.*)
1328 COMPREPLY=()
1329 return
1331 esac
1332 case "$cur" in
1333 --*)
1334 __gitcomp "
1335 --global --system --file=
1336 --list --replace-all
1337 --get --get-all --get-regexp
1338 --add --unset --unset-all
1339 --remove-section --rename-section
1341 return
1343 branch.*.*)
1344 local pfx="${cur%.*}."
1345 cur="${cur##*.}"
1346 __gitcomp "remote merge mergeoptions" "$pfx" "$cur"
1347 return
1349 branch.*)
1350 local pfx="${cur%.*}."
1351 cur="${cur#*.}"
1352 __gitcomp "$(__git_heads)" "$pfx" "$cur" "."
1353 return
1355 remote.*.*)
1356 local pfx="${cur%.*}."
1357 cur="${cur##*.}"
1358 __gitcomp "
1359 url proxy fetch push mirror skipDefaultUpdate
1360 receivepack uploadpack tagopt
1361 " "$pfx" "$cur"
1362 return
1364 remote.*)
1365 local pfx="${cur%.*}."
1366 cur="${cur#*.}"
1367 __gitcomp "$(__git_remotes)" "$pfx" "$cur" "."
1368 return
1370 esac
1371 __gitcomp "
1372 apply.whitespace
1373 branch.autosetupmerge
1374 branch.autosetuprebase
1375 clean.requireForce
1376 color.branch
1377 color.branch.current
1378 color.branch.local
1379 color.branch.plain
1380 color.branch.remote
1381 color.diff
1382 color.diff.commit
1383 color.diff.frag
1384 color.diff.meta
1385 color.diff.new
1386 color.diff.old
1387 color.diff.plain
1388 color.diff.whitespace
1389 color.interactive
1390 color.interactive.header
1391 color.interactive.help
1392 color.interactive.prompt
1393 color.pager
1394 color.status
1395 color.status.added
1396 color.status.changed
1397 color.status.header
1398 color.status.nobranch
1399 color.status.untracked
1400 color.status.updated
1401 color.ui
1402 commit.template
1403 core.autocrlf
1404 core.bare
1405 core.compression
1406 core.deltaBaseCacheLimit
1407 core.editor
1408 core.excludesfile
1409 core.fileMode
1410 core.fsyncobjectfiles
1411 core.gitProxy
1412 core.ignoreCygwinFSTricks
1413 core.ignoreStat
1414 core.logAllRefUpdates
1415 core.loosecompression
1416 core.packedGitLimit
1417 core.packedGitWindowSize
1418 core.pager
1419 core.preferSymlinkRefs
1420 core.preloadindex
1421 core.quotepath
1422 core.repositoryFormatVersion
1423 core.safecrlf
1424 core.sharedRepository
1425 core.symlinks
1426 core.trustctime
1427 core.warnAmbiguousRefs
1428 core.whitespace
1429 core.worktree
1430 diff.autorefreshindex
1431 diff.external
1432 diff.mnemonicprefix
1433 diff.renameLimit
1434 diff.renameLimit.
1435 diff.renames
1436 fetch.unpackLimit
1437 format.headers
1438 format.numbered
1439 format.pretty
1440 format.suffix
1441 gc.aggressiveWindow
1442 gc.auto
1443 gc.autopacklimit
1444 gc.packrefs
1445 gc.pruneexpire
1446 gc.reflogexpire
1447 gc.reflogexpireunreachable
1448 gc.rerereresolved
1449 gc.rerereunresolved
1450 gitcvs.allbinary
1451 gitcvs.dbTableNamePrefix
1452 gitcvs.dbdriver
1453 gitcvs.dbname
1454 gitcvs.dbpass
1455 gitcvs.dbuser
1456 gitcvs.enabled
1457 gitcvs.logfile
1458 gitcvs.usecrlfattr
1459 gui.blamehistoryctx
1460 gui.commitmsgwidth
1461 gui.copyblamethreshold
1462 gui.diffcontext
1463 gui.encoding
1464 gui.fastcopyblame
1465 gui.matchtrackingbranch
1466 gui.newbranchtemplate
1467 gui.pruneduringfetch
1468 gui.spellingdictionary
1469 gui.trustmtime
1470 help.autocorrect
1471 help.browser
1472 help.format
1473 http.lowSpeedLimit
1474 http.lowSpeedTime
1475 http.maxRequests
1476 http.noEPSV
1477 http.proxy
1478 http.sslCAInfo
1479 http.sslCAPath
1480 http.sslCert
1481 http.sslKey
1482 http.sslVerify
1483 i18n.commitEncoding
1484 i18n.logOutputEncoding
1485 instaweb.browser
1486 instaweb.httpd
1487 instaweb.local
1488 instaweb.modulepath
1489 instaweb.port
1490 log.date
1491 log.showroot
1492 man.viewer
1493 merge.conflictstyle
1494 merge.log
1495 merge.renameLimit
1496 merge.stat
1497 merge.tool
1498 merge.verbosity
1499 mergetool.keepBackup
1500 pack.compression
1501 pack.deltaCacheLimit
1502 pack.deltaCacheSize
1503 pack.depth
1504 pack.indexVersion
1505 pack.packSizeLimit
1506 pack.threads
1507 pack.window
1508 pack.windowMemory
1509 pull.octopus
1510 pull.twohead
1511 receive.denyCurrentBranch
1512 receive.denyDeletes
1513 receive.denyNonFastForwards
1514 receive.fsckObjects
1515 receive.unpackLimit
1516 repack.usedeltabaseoffset
1517 rerere.autoupdate
1518 rerere.enabled
1519 showbranch.default
1520 status.relativePaths
1521 status.showUntrackedFiles
1522 tar.umask
1523 transfer.unpackLimit
1524 user.email
1525 user.name
1526 user.signingkey
1527 web.browser
1528 branch. remote.
1532 _git_remote ()
1534 local subcommands="add rename rm show prune update set-head"
1535 local subcommand="$(__git_find_subcommand "$subcommands")"
1536 if [ -z "$subcommand" ]; then
1537 __gitcomp "$subcommands"
1538 return
1541 case "$subcommand" in
1542 rename|rm|show|prune)
1543 __gitcomp "$(__git_remotes)"
1545 update)
1546 local i c='' IFS=$'\n'
1547 for i in $(git --git-dir="$(__gitdir)" config --list); do
1548 case "$i" in
1549 remotes.*)
1550 i="${i#remotes.}"
1551 c="$c ${i/=*/}"
1553 esac
1554 done
1555 __gitcomp "$c"
1558 COMPREPLY=()
1560 esac
1563 _git_reset ()
1565 __git_has_doubledash && return
1567 local cur="${COMP_WORDS[COMP_CWORD]}"
1568 case "$cur" in
1569 --*)
1570 __gitcomp "--merge --mixed --hard --soft"
1571 return
1573 esac
1574 __gitcomp "$(__git_refs)"
1577 _git_revert ()
1579 local cur="${COMP_WORDS[COMP_CWORD]}"
1580 case "$cur" in
1581 --*)
1582 __gitcomp "--edit --mainline --no-edit --no-commit --signoff"
1583 return
1585 esac
1586 __gitcomp "$(__git_refs)"
1589 _git_rm ()
1591 __git_has_doubledash && return
1593 local cur="${COMP_WORDS[COMP_CWORD]}"
1594 case "$cur" in
1595 --*)
1596 __gitcomp "--cached --dry-run --ignore-unmatch --quiet"
1597 return
1599 esac
1600 COMPREPLY=()
1603 _git_shortlog ()
1605 __git_has_doubledash && return
1607 local cur="${COMP_WORDS[COMP_CWORD]}"
1608 case "$cur" in
1609 --*)
1610 __gitcomp "
1611 $__git_log_common_options
1612 $__git_log_shortlog_options
1613 --numbered --summary
1615 return
1617 esac
1618 __git_complete_revlist
1621 _git_show ()
1623 __git_has_doubledash && return
1625 local cur="${COMP_WORDS[COMP_CWORD]}"
1626 case "$cur" in
1627 --pretty=*)
1628 __gitcomp "$__git_log_pretty_formats
1629 " "" "${cur##--pretty=}"
1630 return
1632 --format=*)
1633 __gitcomp "$__git_log_pretty_formats
1634 " "" "${cur##--format=}"
1635 return
1637 --*)
1638 __gitcomp "--pretty= --format=
1639 $__git_diff_common_options
1641 return
1643 esac
1644 __git_complete_file
1647 _git_show_branch ()
1649 local cur="${COMP_WORDS[COMP_CWORD]}"
1650 case "$cur" in
1651 --*)
1652 __gitcomp "
1653 --all --remotes --topo-order --current --more=
1654 --list --independent --merge-base --no-name
1655 --sha1-name --topics --reflog
1657 return
1659 esac
1660 __git_complete_revlist
1663 _git_stash ()
1665 local subcommands='save list show apply clear drop pop create branch'
1666 local subcommand="$(__git_find_subcommand "$subcommands")"
1667 if [ -z "$subcommand" ]; then
1668 __gitcomp "$subcommands"
1669 else
1670 local cur="${COMP_WORDS[COMP_CWORD]}"
1671 case "$subcommand,$cur" in
1672 save,--*)
1673 __gitcomp "--keep-index"
1675 apply,--*)
1676 __gitcomp "--index"
1678 show,--*|drop,--*|pop,--*|branch,--*)
1679 COMPREPLY=()
1681 show,*|apply,*|drop,*|pop,*|branch,*)
1682 __gitcomp "$(git --git-dir="$(__gitdir)" stash list \
1683 | sed -n -e 's/:.*//p')"
1686 COMPREPLY=()
1688 esac
1692 _git_submodule ()
1694 __git_has_doubledash && return
1696 local subcommands="add status init update summary foreach sync"
1697 if [ -z "$(__git_find_subcommand "$subcommands")" ]; then
1698 local cur="${COMP_WORDS[COMP_CWORD]}"
1699 case "$cur" in
1700 --*)
1701 __gitcomp "--quiet --cached"
1704 __gitcomp "$subcommands"
1706 esac
1707 return
1711 _git_svn ()
1713 local subcommands="
1714 init fetch clone rebase dcommit log find-rev
1715 set-tree commit-diff info create-ignore propget
1716 proplist show-ignore show-externals branch tag blame
1717 migrate
1719 local subcommand="$(__git_find_subcommand "$subcommands")"
1720 if [ -z "$subcommand" ]; then
1721 __gitcomp "$subcommands"
1722 else
1723 local remote_opts="--username= --config-dir= --no-auth-cache"
1724 local fc_opts="
1725 --follow-parent --authors-file= --repack=
1726 --no-metadata --use-svm-props --use-svnsync-props
1727 --log-window-size= --no-checkout --quiet
1728 --repack-flags --use-log-author --localtime
1729 --ignore-paths= $remote_opts
1731 local init_opts="
1732 --template= --shared= --trunk= --tags=
1733 --branches= --stdlayout --minimize-url
1734 --no-metadata --use-svm-props --use-svnsync-props
1735 --rewrite-root= --prefix= --use-log-author
1736 --add-author-from $remote_opts
1738 local cmt_opts="
1739 --edit --rmdir --find-copies-harder --copy-similarity=
1742 local cur="${COMP_WORDS[COMP_CWORD]}"
1743 case "$subcommand,$cur" in
1744 fetch,--*)
1745 __gitcomp "--revision= --fetch-all $fc_opts"
1747 clone,--*)
1748 __gitcomp "--revision= $fc_opts $init_opts"
1750 init,--*)
1751 __gitcomp "$init_opts"
1753 dcommit,--*)
1754 __gitcomp "
1755 --merge --strategy= --verbose --dry-run
1756 --fetch-all --no-rebase --commit-url
1757 --revision $cmt_opts $fc_opts
1760 set-tree,--*)
1761 __gitcomp "--stdin $cmt_opts $fc_opts"
1763 create-ignore,--*|propget,--*|proplist,--*|show-ignore,--*|\
1764 show-externals,--*)
1765 __gitcomp "--revision="
1767 log,--*)
1768 __gitcomp "
1769 --limit= --revision= --verbose --incremental
1770 --oneline --show-commit --non-recursive
1771 --authors-file= --color
1774 rebase,--*)
1775 __gitcomp "
1776 --merge --verbose --strategy= --local
1777 --fetch-all --dry-run $fc_opts
1780 commit-diff,--*)
1781 __gitcomp "--message= --file= --revision= $cmt_opts"
1783 info,--*)
1784 __gitcomp "--url"
1786 branch,--*)
1787 __gitcomp "--dry-run --message --tag"
1789 tag,--*)
1790 __gitcomp "--dry-run --message"
1792 blame,--*)
1793 __gitcomp "--git-format"
1795 migrate,--*)
1796 __gitcomp "
1797 --config-dir= --ignore-paths= --minimize
1798 --no-auth-cache --username=
1802 COMPREPLY=()
1804 esac
1808 _git_tag ()
1810 local i c=1 f=0
1811 while [ $c -lt $COMP_CWORD ]; do
1812 i="${COMP_WORDS[c]}"
1813 case "$i" in
1814 -d|-v)
1815 __gitcomp "$(__git_tags)"
1816 return
1821 esac
1822 c=$((++c))
1823 done
1825 case "${COMP_WORDS[COMP_CWORD-1]}" in
1826 -m|-F)
1827 COMPREPLY=()
1829 -*|tag)
1830 if [ $f = 1 ]; then
1831 __gitcomp "$(__git_tags)"
1832 else
1833 COMPREPLY=()
1837 __gitcomp "$(__git_refs)"
1839 esac
1842 _git ()
1844 local i c=1 command __git_dir
1846 while [ $c -lt $COMP_CWORD ]; do
1847 i="${COMP_WORDS[c]}"
1848 case "$i" in
1849 --git-dir=*) __git_dir="${i#--git-dir=}" ;;
1850 --bare) __git_dir="." ;;
1851 --version|-p|--paginate) ;;
1852 --help) command="help"; break ;;
1853 *) command="$i"; break ;;
1854 esac
1855 c=$((++c))
1856 done
1858 if [ -z "$command" ]; then
1859 case "${COMP_WORDS[COMP_CWORD]}" in
1860 --*) __gitcomp "
1861 --paginate
1862 --no-pager
1863 --git-dir=
1864 --bare
1865 --version
1866 --exec-path
1867 --work-tree=
1868 --help
1871 *) __gitcomp "$(__git_porcelain_commands) $(__git_aliases)" ;;
1872 esac
1873 return
1876 local expansion=$(__git_aliased_command "$command")
1877 [ "$expansion" ] && command="$expansion"
1879 case "$command" in
1880 am) _git_am ;;
1881 add) _git_add ;;
1882 apply) _git_apply ;;
1883 archive) _git_archive ;;
1884 bisect) _git_bisect ;;
1885 bundle) _git_bundle ;;
1886 branch) _git_branch ;;
1887 checkout) _git_checkout ;;
1888 cherry) _git_cherry ;;
1889 cherry-pick) _git_cherry_pick ;;
1890 clean) _git_clean ;;
1891 clone) _git_clone ;;
1892 commit) _git_commit ;;
1893 config) _git_config ;;
1894 describe) _git_describe ;;
1895 diff) _git_diff ;;
1896 fetch) _git_fetch ;;
1897 format-patch) _git_format_patch ;;
1898 fsck) _git_fsck ;;
1899 gc) _git_gc ;;
1900 grep) _git_grep ;;
1901 help) _git_help ;;
1902 init) _git_init ;;
1903 log) _git_log ;;
1904 ls-files) _git_ls_files ;;
1905 ls-remote) _git_ls_remote ;;
1906 ls-tree) _git_ls_tree ;;
1907 merge) _git_merge;;
1908 mergetool) _git_mergetool;;
1909 merge-base) _git_merge_base ;;
1910 mv) _git_mv ;;
1911 name-rev) _git_name_rev ;;
1912 pull) _git_pull ;;
1913 push) _git_push ;;
1914 rebase) _git_rebase ;;
1915 remote) _git_remote ;;
1916 reset) _git_reset ;;
1917 revert) _git_revert ;;
1918 rm) _git_rm ;;
1919 send-email) _git_send_email ;;
1920 shortlog) _git_shortlog ;;
1921 show) _git_show ;;
1922 show-branch) _git_show_branch ;;
1923 stash) _git_stash ;;
1924 stage) _git_add ;;
1925 submodule) _git_submodule ;;
1926 svn) _git_svn ;;
1927 tag) _git_tag ;;
1928 whatchanged) _git_log ;;
1929 *) COMPREPLY=() ;;
1930 esac
1933 _gitk ()
1935 __git_has_doubledash && return
1937 local cur="${COMP_WORDS[COMP_CWORD]}"
1938 local g="$(__gitdir)"
1939 local merge=""
1940 if [ -f $g/MERGE_HEAD ]; then
1941 merge="--merge"
1943 case "$cur" in
1944 --*)
1945 __gitcomp "
1946 $__git_log_common_options
1947 $__git_log_gitk_options
1948 $merge
1950 return
1952 esac
1953 __git_complete_revlist
1956 complete -o bashdefault -o default -o nospace -F _git git 2>/dev/null \
1957 || complete -o default -o nospace -F _git git
1958 complete -o bashdefault -o default -o nospace -F _gitk gitk 2>/dev/null \
1959 || complete -o default -o nospace -F _gitk gitk
1961 # The following are necessary only for Cygwin, and only are needed
1962 # when the user has tab-completed the executable name and consequently
1963 # included the '.exe' suffix.
1965 if [ Cygwin = "$(uname -o 2>/dev/null)" ]; then
1966 complete -o bashdefault -o default -o nospace -F _git git.exe 2>/dev/null \
1967 || complete -o default -o nospace -F _git git.exe