]> git.ipfire.org Git - thirdparty/git.git/blame - contrib/completion/git-completion.bash
git-submodule - register submodule URL if adding in place
[thirdparty/git.git] / contrib / completion / git-completion.bash
CommitLineData
690d8824
JH
1#
2# bash completion support for core Git.
3#
c70680ce 4# Copyright (C) 2006,2007 Shawn O. Pearce <spearce@spearce.org>
690d8824 5# Conceptually based on gitcompletion (http://gitweb.hawaga.org.uk/).
c70680ce 6# Distributed under the GNU General Public License, version 2.0.
690d8824
JH
7#
8# The contained completion routines provide support for completing:
9#
10# *) local and remote branch names
11# *) local and remote tag names
12# *) .git/remotes file names
13# *) git 'subcommands'
14# *) tree paths within 'ref:path/to/file' expressions
c70680ce 15# *) common --long-options
690d8824
JH
16#
17# To use these routines:
18#
19# 1) Copy this file to somewhere (e.g. ~/.git-completion.sh).
20# 2) Added the following line to your .bashrc:
21# source ~/.git-completion.sh
22#
b51ec6bd
SP
23# 3) You may want to make sure the git executable is available
24# in your PATH before this script is sourced, as some caching
25# is performed while the script loads. If git isn't found
26# at source time then all lookups will be done on demand,
27# which may be slightly slower.
28#
29# 4) Consider changing your PS1 to also show the current branch:
d3d717a4
SP
30# PS1='[\u@\h \W$(__git_ps1 " (%s)")]\$ '
31#
32# The argument to __git_ps1 will be displayed only if you
33# are currently in a git repository. The %s token will be
34# the name of the current branch.
35#
c70680ce
SP
36# To submit patches:
37#
38# *) Read Documentation/SubmittingPatches
39# *) Send all patches to the current maintainer:
40#
41# "Shawn O. Pearce" <spearce@spearce.org>
42#
43# *) Always CC the Git mailing list:
44#
45# git@vger.kernel.org
46#
690d8824 47
873537fa
SP
48__gitdir ()
49{
67ffa114
SP
50 if [ -z "$1" ]; then
51 if [ -n "$__git_dir" ]; then
52 echo "$__git_dir"
53 elif [ -d .git ]; then
54 echo .git
55 else
56 git rev-parse --git-dir 2>/dev/null
57 fi
58 elif [ -d "$1/.git" ]; then
59 echo "$1/.git"
60 else
61 echo "$1"
62 fi
873537fa
SP
63}
64
d3d717a4
SP
65__git_ps1 ()
66{
e7520196
RR
67 local g="$(git rev-parse --git-dir 2>/dev/null)"
68 if [ -n "$g" ]; then
69 local r
70 local b
71 if [ -d "$g/../.dotest" ]
72 then
3041c324
JH
73 if test -f "$g/../.dotest/rebasing"
74 then
75 r="|REBASE"
76 elif test -f "$g/../.dotest/applying"
77 then
78 r="|AM"
79 else
80 r="|AM/REBASE"
81 fi
e7520196
RR
82 b="$(git symbolic-ref HEAD 2>/dev/null)"
83 elif [ -f "$g/.dotest-merge/interactive" ]
84 then
85 r="|REBASE-i"
a5c4f85b 86 b="$(cat "$g/.dotest-merge/head-name")"
e7520196
RR
87 elif [ -d "$g/.dotest-merge" ]
88 then
89 r="|REBASE-m"
a5c4f85b 90 b="$(cat "$g/.dotest-merge/head-name")"
e7520196
RR
91 elif [ -f "$g/MERGE_HEAD" ]
92 then
93 r="|MERGING"
94 b="$(git symbolic-ref HEAD 2>/dev/null)"
95 else
a5c4f85b 96 if [ -f "$g/BISECT_LOG" ]
e7520196
RR
97 then
98 r="|BISECTING"
99 fi
100 if ! b="$(git symbolic-ref HEAD 2>/dev/null)"
101 then
27c57888
SP
102 if ! b="$(git describe --exact-match HEAD 2>/dev/null)"
103 then
a5c4f85b 104 b="$(cut -c1-7 "$g/HEAD")..."
27c57888 105 fi
e7520196
RR
106 fi
107 fi
108
d3d717a4 109 if [ -n "$1" ]; then
e7520196 110 printf "$1" "${b##refs/heads/}$r"
d3d717a4 111 else
e7520196 112 printf " (%s)" "${b##refs/heads/}$r"
d3d717a4
SP
113 fi
114 fi
115}
116
ab02dfe5
SP
117__gitcomp_1 ()
118{
119 local c IFS=' '$'\t'$'\n'
120 for c in $1; do
121 case "$c$2" in
122 --*=*) printf %s$'\n' "$c$2" ;;
123 *.) printf %s$'\n' "$c$2" ;;
124 *) printf %s$'\n' "$c$2 " ;;
125 esac
126 done
127}
128
72e5e989
SP
129__gitcomp ()
130{
78d4d6a2 131 local cur="${COMP_WORDS[COMP_CWORD]}"
b3391775 132 if [ $# -gt 2 ]; then
78d4d6a2
SP
133 cur="$3"
134 fi
5447aac7
SG
135 case "$cur" in
136 --*=)
137 COMPREPLY=()
5447aac7
SG
138 ;;
139 *)
ab02dfe5
SP
140 local IFS=$'\n'
141 COMPREPLY=($(compgen -P "$2" \
142 -W "$(__gitcomp_1 "$1" "$4")" \
143 -- "$cur"))
5447aac7
SG
144 ;;
145 esac
72e5e989
SP
146}
147
5de40f59
SP
148__git_heads ()
149{
67ffa114 150 local cmd i is_hash=y dir="$(__gitdir "$1")"
5de40f59
SP
151 if [ -d "$dir" ]; then
152 for i in $(git --git-dir="$dir" \
153 for-each-ref --format='%(refname)' \
154 refs/heads ); do
155 echo "${i#refs/heads/}"
156 done
157 return
158 fi
799596a5 159 for i in $(git ls-remote "$1" 2>/dev/null); do
5de40f59
SP
160 case "$is_hash,$i" in
161 y,*) is_hash=n ;;
162 n,*^{}) is_hash=y ;;
163 n,refs/heads/*) is_hash=y; echo "${i#refs/heads/}" ;;
164 n,*) is_hash=y; echo "$i" ;;
165 esac
166 done
167}
168
88e21dc7
SP
169__git_tags ()
170{
171 local cmd i is_hash=y dir="$(__gitdir "$1")"
172 if [ -d "$dir" ]; then
173 for i in $(git --git-dir="$dir" \
174 for-each-ref --format='%(refname)' \
175 refs/tags ); do
176 echo "${i#refs/tags/}"
177 done
178 return
179 fi
799596a5 180 for i in $(git ls-remote "$1" 2>/dev/null); do
88e21dc7
SP
181 case "$is_hash,$i" in
182 y,*) is_hash=n ;;
183 n,*^{}) is_hash=y ;;
184 n,refs/tags/*) is_hash=y; echo "${i#refs/tags/}" ;;
185 n,*) is_hash=y; echo "$i" ;;
186 esac
187 done
188}
189
690d8824
JH
190__git_refs ()
191{
67ffa114 192 local cmd i is_hash=y dir="$(__gitdir "$1")"
873537fa 193 if [ -d "$dir" ]; then
35e65ecc
SP
194 if [ -e "$dir/HEAD" ]; then echo HEAD; fi
195 for i in $(git --git-dir="$dir" \
196 for-each-ref --format='%(refname)' \
197 refs/tags refs/heads refs/remotes); do
198 case "$i" in
199 refs/tags/*) echo "${i#refs/tags/}" ;;
200 refs/heads/*) echo "${i#refs/heads/}" ;;
201 refs/remotes/*) echo "${i#refs/remotes/}" ;;
202 *) echo "$i" ;;
203 esac
204 done
205 return
690d8824 206 fi
799596a5 207 for i in $(git ls-remote "$dir" 2>/dev/null); do
690d8824
JH
208 case "$is_hash,$i" in
209 y,*) is_hash=n ;;
210 n,*^{}) is_hash=y ;;
211 n,refs/tags/*) is_hash=y; echo "${i#refs/tags/}" ;;
212 n,refs/heads/*) is_hash=y; echo "${i#refs/heads/}" ;;
35e65ecc 213 n,refs/remotes/*) is_hash=y; echo "${i#refs/remotes/}" ;;
690d8824
JH
214 n,*) is_hash=y; echo "$i" ;;
215 esac
216 done
217}
218
219__git_refs2 ()
220{
67ffa114
SP
221 local i
222 for i in $(__git_refs "$1"); do
223 echo "$i:$i"
690d8824
JH
224 done
225}
226
5de40f59
SP
227__git_refs_remotes ()
228{
229 local cmd i is_hash=y
799596a5 230 for i in $(git ls-remote "$1" 2>/dev/null); do
5de40f59
SP
231 case "$is_hash,$i" in
232 n,refs/heads/*)
233 is_hash=y
234 echo "$i:refs/remotes/$1/${i#refs/heads/}"
235 ;;
236 y,*) is_hash=n ;;
237 n,*^{}) is_hash=y ;;
238 n,refs/tags/*) is_hash=y;;
239 n,*) is_hash=y; ;;
240 esac
241 done
242}
243
690d8824
JH
244__git_remotes ()
245{
873537fa 246 local i ngoff IFS=$'\n' d="$(__gitdir)"
56fc25f2 247 shopt -q nullglob || ngoff=1
690d8824 248 shopt -s nullglob
873537fa
SP
249 for i in "$d/remotes"/*; do
250 echo ${i#$d/remotes/}
690d8824 251 done
56fc25f2 252 [ "$ngoff" ] && shopt -u nullglob
e0d10e1c 253 for i in $(git --git-dir="$d" config --list); do
56fc25f2
SP
254 case "$i" in
255 remote.*.url=*)
256 i="${i#remote.}"
257 echo "${i/.url=*/}"
258 ;;
259 esac
260 done
690d8824
JH
261}
262
4ad91321
SP
263__git_merge_strategies ()
264{
b51ec6bd
SP
265 if [ -n "$__git_merge_strategylist" ]; then
266 echo "$__git_merge_strategylist"
267 return
268 fi
4ad91321
SP
269 sed -n "/^all_strategies='/{
270 s/^all_strategies='//
271 s/'//
272 p
273 q
274 }" "$(git --exec-path)/git-merge"
275}
b51ec6bd
SP
276__git_merge_strategylist=
277__git_merge_strategylist="$(__git_merge_strategies 2>/dev/null)"
4ad91321 278
690d8824
JH
279__git_complete_file ()
280{
a79c6551 281 local pfx ls ref cur="${COMP_WORDS[COMP_CWORD]}"
690d8824
JH
282 case "$cur" in
283 ?*:*)
a79c6551
SP
284 ref="${cur%%:*}"
285 cur="${cur#*:}"
690d8824
JH
286 case "$cur" in
287 ?*/*)
a79c6551
SP
288 pfx="${cur%/*}"
289 cur="${cur##*/}"
690d8824
JH
290 ls="$ref:$pfx"
291 pfx="$pfx/"
292 ;;
293 *)
294 ls="$ref"
295 ;;
296 esac
297 COMPREPLY=($(compgen -P "$pfx" \
873537fa 298 -W "$(git --git-dir="$(__gitdir)" ls-tree "$ls" \
690d8824
JH
299 | sed '/^100... blob /s,^.* ,,
300 /^040000 tree /{
301 s,^.* ,,
302 s,$,/,
303 }
304 s/^.* //')" \
305 -- "$cur"))
306 ;;
307 *)
b3391775 308 __gitcomp "$(__git_refs)"
690d8824
JH
309 ;;
310 esac
311}
312
f53352fb
SP
313__git_complete_revlist ()
314{
315 local pfx cur="${COMP_WORDS[COMP_CWORD]}"
316 case "$cur" in
317 *...*)
318 pfx="${cur%...*}..."
319 cur="${cur#*...}"
b3391775 320 __gitcomp "$(__git_refs)" "$pfx" "$cur"
f53352fb
SP
321 ;;
322 *..*)
323 pfx="${cur%..*}.."
324 cur="${cur#*..}"
b3391775
SP
325 __gitcomp "$(__git_refs)" "$pfx" "$cur"
326 ;;
f53352fb 327 *)
b3391775 328 __gitcomp "$(__git_refs)"
f53352fb
SP
329 ;;
330 esac
331}
332
f2bb9f88
SP
333__git_commands ()
334{
b51ec6bd
SP
335 if [ -n "$__git_commandlist" ]; then
336 echo "$__git_commandlist"
337 return
338 fi
f2bb9f88
SP
339 local i IFS=" "$'\n'
340 for i in $(git help -a|egrep '^ ')
341 do
342 case $i in
718a087a 343 *--*) : helper pattern;;
a925c6f1
SP
344 applymbox) : ask gittus;;
345 applypatch) : ask gittus;;
346 archimport) : import;;
2e3a430a 347 cat-file) : plumbing;;
56d99c67 348 check-attr) : plumbing;;
f2bb9f88
SP
349 check-ref-format) : plumbing;;
350 commit-tree) : plumbing;;
a925c6f1
SP
351 cvsexportcommit) : export;;
352 cvsimport) : import;;
f2bb9f88
SP
353 cvsserver) : daemon;;
354 daemon) : daemon;;
5cfb4fe5
SP
355 diff-files) : plumbing;;
356 diff-index) : plumbing;;
357 diff-tree) : plumbing;;
c6ec3b13 358 fast-import) : import;;
a925c6f1 359 fsck-objects) : plumbing;;
f2bb9f88 360 fetch-pack) : plumbing;;
a925c6f1 361 fmt-merge-msg) : plumbing;;
56d99c67 362 for-each-ref) : plumbing;;
f2bb9f88
SP
363 hash-object) : plumbing;;
364 http-*) : transport;;
365 index-pack) : plumbing;;
a925c6f1 366 init-db) : deprecated;;
f2bb9f88
SP
367 local-fetch) : plumbing;;
368 mailinfo) : plumbing;;
369 mailsplit) : plumbing;;
370 merge-*) : plumbing;;
371 mktree) : plumbing;;
372 mktag) : plumbing;;
373 pack-objects) : plumbing;;
374 pack-redundant) : plumbing;;
375 pack-refs) : plumbing;;
376 parse-remote) : plumbing;;
377 patch-id) : plumbing;;
378 peek-remote) : plumbing;;
a925c6f1
SP
379 prune) : plumbing;;
380 prune-packed) : plumbing;;
381 quiltimport) : import;;
f2bb9f88
SP
382 read-tree) : plumbing;;
383 receive-pack) : plumbing;;
2e3a430a 384 reflog) : plumbing;;
5c66d0d4 385 repo-config) : deprecated;;
f2bb9f88
SP
386 rerere) : plumbing;;
387 rev-list) : plumbing;;
388 rev-parse) : plumbing;;
389 runstatus) : plumbing;;
390 sh-setup) : internal;;
391 shell) : daemon;;
392 send-pack) : plumbing;;
393 show-index) : plumbing;;
394 ssh-*) : transport;;
395 stripspace) : plumbing;;
396 symbolic-ref) : plumbing;;
a925c6f1 397 tar-tree) : deprecated;;
f2bb9f88
SP
398 unpack-file) : plumbing;;
399 unpack-objects) : plumbing;;
a925c6f1 400 update-index) : plumbing;;
f2bb9f88
SP
401 update-ref) : plumbing;;
402 update-server-info) : daemon;;
403 upload-archive) : plumbing;;
404 upload-pack) : plumbing;;
405 write-tree) : plumbing;;
a925c6f1 406 verify-tag) : plumbing;;
f2bb9f88
SP
407 *) echo $i;;
408 esac
409 done
410}
b51ec6bd
SP
411__git_commandlist=
412__git_commandlist="$(__git_commands 2>/dev/null)"
f2bb9f88 413
367dce2a
DS
414__git_aliases ()
415{
56fc25f2 416 local i IFS=$'\n'
e0d10e1c 417 for i in $(git --git-dir="$(__gitdir)" config --list); do
56fc25f2
SP
418 case "$i" in
419 alias.*)
420 i="${i#alias.}"
421 echo "${i/=*/}"
422 ;;
423 esac
424 done
367dce2a
DS
425}
426
427__git_aliased_command ()
428{
873537fa 429 local word cmdline=$(git --git-dir="$(__gitdir)" \
e0d10e1c 430 config --get "alias.$1")
367dce2a
DS
431 for word in $cmdline; do
432 if [ "${word##-*}" ]; then
433 echo $word
434 return
435 fi
436 done
437}
438
3ff1320d
SG
439__git_find_subcommand ()
440{
441 local word subcommand c=1
442
443 while [ $c -lt $COMP_CWORD ]; do
444 word="${COMP_WORDS[c]}"
445 for subcommand in $1; do
446 if [ "$subcommand" = "$word" ]; then
447 echo "$subcommand"
448 return
449 fi
450 done
451 c=$((++c))
452 done
453}
454
d773c631
SG
455__git_has_doubledash ()
456{
457 local c=1
458 while [ $c -lt $COMP_CWORD ]; do
459 if [ "--" = "${COMP_WORDS[c]}" ]; then
460 return 0
461 fi
462 c=$((++c))
463 done
464 return 1
465}
466
88329195
SP
467__git_whitespacelist="nowarn warn error error-all strip"
468
469_git_am ()
470{
471 local cur="${COMP_WORDS[COMP_CWORD]}"
472 if [ -d .dotest ]; then
b3391775 473 __gitcomp "--skip --resolved"
88329195
SP
474 return
475 fi
476 case "$cur" in
477 --whitespace=*)
b3391775 478 __gitcomp "$__git_whitespacelist" "" "${cur##--whitespace=}"
88329195
SP
479 return
480 ;;
481 --*)
b3391775 482 __gitcomp "
88329195
SP
483 --signoff --utf8 --binary --3way --interactive
484 --whitespace=
b3391775 485 "
88329195
SP
486 return
487 esac
488 COMPREPLY=()
489}
490
491_git_apply ()
492{
493 local cur="${COMP_WORDS[COMP_CWORD]}"
494 case "$cur" in
495 --whitespace=*)
b3391775 496 __gitcomp "$__git_whitespacelist" "" "${cur##--whitespace=}"
88329195
SP
497 return
498 ;;
499 --*)
b3391775 500 __gitcomp "
88329195
SP
501 --stat --numstat --summary --check --index
502 --cached --index-info --reverse --reject --unidiff-zero
503 --apply --no-add --exclude=
504 --whitespace= --inaccurate-eof --verbose
b3391775 505 "
88329195
SP
506 return
507 esac
508 COMPREPLY=()
509}
510
8435b548
SP
511_git_add ()
512{
d773c631
SG
513 __git_has_doubledash && return
514
8435b548
SP
515 local cur="${COMP_WORDS[COMP_CWORD]}"
516 case "$cur" in
517 --*)
1d284cba
SG
518 __gitcomp "
519 --interactive --refresh --patch --update --dry-run
520 --ignore-errors
521 "
8435b548
SP
522 return
523 esac
524 COMPREPLY=()
525}
526
b2e69f62
SP
527_git_bisect ()
528{
d773c631
SG
529 __git_has_doubledash && return
530
bf11d461 531 local subcommands="start bad good skip reset visualize replay log run"
3ff1320d
SG
532 local subcommand="$(__git_find_subcommand "$subcommands")"
533 if [ -z "$subcommand" ]; then
534 __gitcomp "$subcommands"
b2e69f62
SP
535 return
536 fi
537
3ff1320d 538 case "$subcommand" in
bf11d461 539 bad|good|reset|skip)
b2e69f62
SP
540 __gitcomp "$(__git_refs)"
541 ;;
542 *)
543 COMPREPLY=()
544 ;;
545 esac
546}
547
690d8824
JH
548_git_branch ()
549{
b9217642
SG
550 local i c=1 only_local_ref="n" has_r="n"
551
552 while [ $c -lt $COMP_CWORD ]; do
553 i="${COMP_WORDS[c]}"
554 case "$i" in
555 -d|-m) only_local_ref="y" ;;
556 -r) has_r="y" ;;
557 esac
558 c=$((++c))
559 done
560
3b376b0c
SG
561 case "${COMP_WORDS[COMP_CWORD]}" in
562 --*=*) COMPREPLY=() ;;
563 --*)
564 __gitcomp "
565 --color --no-color --verbose --abbrev= --no-abbrev
50e61025 566 --track --no-track --contains --merged --no-merged
3b376b0c
SG
567 "
568 ;;
b9217642
SG
569 *)
570 if [ $only_local_ref = "y" -a $has_r = "n" ]; then
571 __gitcomp "$(__git_heads)"
572 else
573 __gitcomp "$(__git_refs)"
574 fi
575 ;;
3b376b0c 576 esac
690d8824
JH
577}
578
374a58c9
ML
579_git_bundle ()
580{
581 local mycword="$COMP_CWORD"
582 case "${COMP_WORDS[0]}" in
583 git)
584 local cmd="${COMP_WORDS[2]}"
585 mycword="$((mycword-1))"
586 ;;
587 git-bundle*)
588 local cmd="${COMP_WORDS[1]}"
589 ;;
590 esac
591 case "$mycword" in
592 1)
593 __gitcomp "create list-heads verify unbundle"
594 ;;
595 2)
596 # looking for a file
597 ;;
598 *)
599 case "$cmd" in
600 create)
601 __git_complete_revlist
602 ;;
603 esac
604 ;;
605 esac
606}
607
690d8824
JH
608_git_checkout ()
609{
b3391775 610 __gitcomp "$(__git_refs)"
690d8824
JH
611}
612
d8a9fea5
SP
613_git_cherry ()
614{
615 __gitcomp "$(__git_refs)"
616}
617
1273231e
SP
618_git_cherry_pick ()
619{
620 local cur="${COMP_WORDS[COMP_CWORD]}"
621 case "$cur" in
622 --*)
b3391775 623 __gitcomp "--edit --no-commit"
1273231e
SP
624 ;;
625 *)
b3391775 626 __gitcomp "$(__git_refs)"
1273231e
SP
627 ;;
628 esac
629}
630
4548e855
SP
631_git_commit ()
632{
d773c631
SG
633 __git_has_doubledash && return
634
4548e855
SP
635 local cur="${COMP_WORDS[COMP_CWORD]}"
636 case "$cur" in
637 --*)
b3391775 638 __gitcomp "
4548e855
SP
639 --all --author= --signoff --verify --no-verify
640 --edit --amend --include --only
b3391775 641 "
4548e855
SP
642 return
643 esac
644 COMPREPLY=()
645}
646
217926c0
SP
647_git_describe ()
648{
649 __gitcomp "$(__git_refs)"
650}
651
690d8824
JH
652_git_diff ()
653{
d773c631
SG
654 __git_has_doubledash && return
655
b3a4f858
JS
656 local cur="${COMP_WORDS[COMP_CWORD]}"
657 case "$cur" in
658 --*)
659 __gitcomp "--cached --stat --numstat --shortstat --summary
660 --patch-with-stat --name-only --name-status --color
661 --no-color --color-words --no-renames --check
662 --full-index --binary --abbrev --diff-filter
663 --find-copies-harder --pickaxe-all --pickaxe-regex
664 --text --ignore-space-at-eol --ignore-space-change
665 --ignore-all-space --exit-code --quiet --ext-diff
aba201c6
PO
666 --no-ext-diff
667 --no-prefix --src-prefix= --dst-prefix=
f4574139 668 --base --ours --theirs
aba201c6 669 "
b3a4f858
JS
670 return
671 ;;
672 esac
690d8824
JH
673 __git_complete_file
674}
675
676_git_diff_tree ()
677{
b3391775 678 __gitcomp "$(__git_refs)"
690d8824
JH
679}
680
681_git_fetch ()
682{
683 local cur="${COMP_WORDS[COMP_CWORD]}"
684
685 case "${COMP_WORDS[0]},$COMP_CWORD" in
686 git-fetch*,1)
b3391775 687 __gitcomp "$(__git_remotes)"
690d8824
JH
688 ;;
689 git,2)
b3391775 690 __gitcomp "$(__git_remotes)"
690d8824
JH
691 ;;
692 *)
693 case "$cur" in
694 *:*)
b3391775 695 __gitcomp "$(__git_refs)" "" "${cur#*:}"
690d8824
JH
696 ;;
697 *)
698 local remote
699 case "${COMP_WORDS[0]}" in
700 git-fetch) remote="${COMP_WORDS[1]}" ;;
701 git) remote="${COMP_WORDS[2]}" ;;
702 esac
b3391775 703 __gitcomp "$(__git_refs2 "$remote")"
690d8824
JH
704 ;;
705 esac
706 ;;
707 esac
708}
709
f53352fb
SP
710_git_format_patch ()
711{
712 local cur="${COMP_WORDS[COMP_CWORD]}"
713 case "$cur" in
714 --*)
b3391775 715 __gitcomp "
f53352fb
SP
716 --stdout --attach --thread
717 --output-directory
718 --numbered --start-number
47e98eec 719 --numbered-files
f53352fb
SP
720 --keep-subject
721 --signoff
722 --in-reply-to=
723 --full-index --binary
ec804891 724 --not --all
be5f5bf0 725 --cover-letter
aba201c6 726 --no-prefix --src-prefix= --dst-prefix=
b3391775 727 "
f53352fb
SP
728 return
729 ;;
730 esac
731 __git_complete_revlist
732}
733
b26c8748
SP
734_git_gc ()
735{
736 local cur="${COMP_WORDS[COMP_CWORD]}"
737 case "$cur" in
738 --*)
47e98eec 739 __gitcomp "--prune --aggressive"
b26c8748
SP
740 return
741 ;;
742 esac
743 COMPREPLY=()
744}
745
690d8824
JH
746_git_ls_remote ()
747{
b3391775 748 __gitcomp "$(__git_remotes)"
690d8824
JH
749}
750
751_git_ls_tree ()
752{
753 __git_complete_file
754}
755
756_git_log ()
757{
d773c631
SG
758 __git_has_doubledash && return
759
6e31b866
SP
760 local cur="${COMP_WORDS[COMP_CWORD]}"
761 case "$cur" in
762 --pretty=*)
b3391775 763 __gitcomp "
6e31b866 764 oneline short medium full fuller email raw
b3391775 765 " "" "${cur##--pretty=}"
6e31b866
SP
766 return
767 ;;
47e98eec
SP
768 --date=*)
769 __gitcomp "
770 relative iso8601 rfc2822 short local default
771 " "" "${cur##--date=}"
772 return
773 ;;
6e31b866 774 --*)
b3391775 775 __gitcomp "
6e31b866
SP
776 --max-count= --max-age= --since= --after=
777 --min-age= --before= --until=
8f87fae6 778 --root --topo-order --date-order --reverse
47e98eec 779 --no-merges --follow
6e31b866 780 --abbrev-commit --abbrev=
47e98eec 781 --relative-date --date=
6e31b866
SP
782 --author= --committer= --grep=
783 --all-match
8f87fae6 784 --pretty= --name-status --name-only --raw
ec804891 785 --not --all
7d37b5bf 786 --left-right --cherry-pick
20827d99 787 --graph
66aafad5
TL
788 --stat --numstat --shortstat
789 --decorate --diff-filter=
790 --color-words --walk-reflogs
b3391775 791 "
6e31b866
SP
792 return
793 ;;
794 esac
f53352fb 795 __git_complete_revlist
690d8824
JH
796}
797
4ad91321
SP
798_git_merge ()
799{
800 local cur="${COMP_WORDS[COMP_CWORD]}"
ce1e39d2
SP
801 case "${COMP_WORDS[COMP_CWORD-1]}" in
802 -s|--strategy)
b3391775 803 __gitcomp "$(__git_merge_strategies)"
ce1e39d2
SP
804 return
805 esac
4ad91321 806 case "$cur" in
ce1e39d2 807 --strategy=*)
b3391775 808 __gitcomp "$(__git_merge_strategies)" "" "${cur##--strategy=}"
ce1e39d2
SP
809 return
810 ;;
4ad91321 811 --*)
b3391775 812 __gitcomp "
efb779f8 813 --no-commit --no-stat --log --no-log --squash --strategy
b3391775 814 "
4ad91321
SP
815 return
816 esac
b3391775 817 __gitcomp "$(__git_refs)"
4ad91321
SP
818}
819
690d8824
JH
820_git_merge_base ()
821{
b3391775 822 __gitcomp "$(__git_refs)"
690d8824
JH
823}
824
d33909bf
SP
825_git_name_rev ()
826{
b3391775 827 __gitcomp "--tags --all --stdin"
d33909bf
SP
828}
829
690d8824
JH
830_git_pull ()
831{
832 local cur="${COMP_WORDS[COMP_CWORD]}"
833
834 case "${COMP_WORDS[0]},$COMP_CWORD" in
835 git-pull*,1)
b3391775 836 __gitcomp "$(__git_remotes)"
690d8824
JH
837 ;;
838 git,2)
b3391775 839 __gitcomp "$(__git_remotes)"
690d8824
JH
840 ;;
841 *)
842 local remote
843 case "${COMP_WORDS[0]}" in
844 git-pull) remote="${COMP_WORDS[1]}" ;;
845 git) remote="${COMP_WORDS[2]}" ;;
846 esac
b3391775 847 __gitcomp "$(__git_refs "$remote")"
690d8824
JH
848 ;;
849 esac
850}
851
852_git_push ()
853{
854 local cur="${COMP_WORDS[COMP_CWORD]}"
855
856 case "${COMP_WORDS[0]},$COMP_CWORD" in
857 git-push*,1)
b3391775 858 __gitcomp "$(__git_remotes)"
690d8824
JH
859 ;;
860 git,2)
b3391775 861 __gitcomp "$(__git_remotes)"
690d8824
JH
862 ;;
863 *)
864 case "$cur" in
865 *:*)
866 local remote
867 case "${COMP_WORDS[0]}" in
868 git-push) remote="${COMP_WORDS[1]}" ;;
869 git) remote="${COMP_WORDS[2]}" ;;
870 esac
b3391775 871 __gitcomp "$(__git_refs "$remote")" "" "${cur#*:}"
690d8824 872 ;;
161fea83
SP
873 +*)
874 __gitcomp "$(__git_refs)" + "${cur#+}"
875 ;;
690d8824 876 *)
92d7c8e3 877 __gitcomp "$(__git_refs)"
690d8824
JH
878 ;;
879 esac
880 ;;
881 esac
882}
883
61d926a3
SP
884_git_rebase ()
885{
51fe1209
SG
886 local cur="${COMP_WORDS[COMP_CWORD]}" dir="$(__gitdir)"
887 if [ -d .dotest ] || [ -d "$dir"/.dotest-merge ]; then
b3391775 888 __gitcomp "--continue --skip --abort"
61d926a3
SP
889 return
890 fi
ce1e39d2
SP
891 case "${COMP_WORDS[COMP_CWORD-1]}" in
892 -s|--strategy)
b3391775 893 __gitcomp "$(__git_merge_strategies)"
ce1e39d2
SP
894 return
895 esac
61d926a3 896 case "$cur" in
ce1e39d2 897 --strategy=*)
b3391775 898 __gitcomp "$(__git_merge_strategies)" "" "${cur##--strategy=}"
ce1e39d2
SP
899 return
900 ;;
61d926a3 901 --*)
d9e3b702 902 __gitcomp "--onto --merge --strategy --interactive"
61d926a3
SP
903 return
904 esac
b3391775 905 __gitcomp "$(__git_refs)"
61d926a3
SP
906}
907
e0d10e1c 908_git_config ()
5de40f59
SP
909{
910 local cur="${COMP_WORDS[COMP_CWORD]}"
911 local prv="${COMP_WORDS[COMP_CWORD-1]}"
912 case "$prv" in
913 branch.*.remote)
78d4d6a2 914 __gitcomp "$(__git_remotes)"
5de40f59
SP
915 return
916 ;;
917 branch.*.merge)
78d4d6a2 918 __gitcomp "$(__git_refs)"
5de40f59
SP
919 return
920 ;;
921 remote.*.fetch)
922 local remote="${prv#remote.}"
923 remote="${remote%.fetch}"
78d4d6a2 924 __gitcomp "$(__git_refs_remotes "$remote")"
5de40f59
SP
925 return
926 ;;
927 remote.*.push)
928 local remote="${prv#remote.}"
929 remote="${remote%.push}"
78d4d6a2 930 __gitcomp "$(git --git-dir="$(__gitdir)" \
5de40f59 931 for-each-ref --format='%(refname):%(refname)' \
78d4d6a2
SP
932 refs/heads)"
933 return
934 ;;
935 pull.twohead|pull.octopus)
936 __gitcomp "$(__git_merge_strategies)"
937 return
938 ;;
939 color.branch|color.diff|color.status)
940 __gitcomp "always never auto"
941 return
942 ;;
943 color.*.*)
944 __gitcomp "
945 black red green yellow blue magenta cyan white
946 bold dim ul blink reverse
947 "
5de40f59
SP
948 return
949 ;;
950 *.*)
951 COMPREPLY=()
952 return
953 ;;
954 esac
955 case "$cur" in
956 --*)
78d4d6a2 957 __gitcomp "
47e98eec 958 --global --system --file=
12977705 959 --list --replace-all
5de40f59 960 --get --get-all --get-regexp
1b71eb35 961 --add --unset --unset-all
12977705 962 --remove-section --rename-section
78d4d6a2 963 "
5de40f59
SP
964 return
965 ;;
966 branch.*.*)
967 local pfx="${cur%.*}."
968 cur="${cur##*.}"
78d4d6a2 969 __gitcomp "remote merge" "$pfx" "$cur"
5de40f59
SP
970 return
971 ;;
972 branch.*)
973 local pfx="${cur%.*}."
974 cur="${cur#*.}"
78d4d6a2 975 __gitcomp "$(__git_heads)" "$pfx" "$cur" "."
5de40f59
SP
976 return
977 ;;
978 remote.*.*)
979 local pfx="${cur%.*}."
980 cur="${cur##*.}"
12977705
SP
981 __gitcomp "
982 url fetch push skipDefaultUpdate
983 receivepack uploadpack tagopt
984 " "$pfx" "$cur"
5de40f59
SP
985 return
986 ;;
987 remote.*)
988 local pfx="${cur%.*}."
989 cur="${cur#*.}"
78d4d6a2 990 __gitcomp "$(__git_remotes)" "$pfx" "$cur" "."
5de40f59
SP
991 return
992 ;;
993 esac
78d4d6a2 994 __gitcomp "
5de40f59
SP
995 apply.whitespace
996 core.fileMode
997 core.gitProxy
998 core.ignoreStat
999 core.preferSymlinkRefs
1000 core.logAllRefUpdates
47e98eec 1001 core.loosecompression
5de40f59
SP
1002 core.repositoryFormatVersion
1003 core.sharedRepository
1004 core.warnAmbiguousRefs
1005 core.compression
78d4d6a2
SP
1006 core.packedGitWindowSize
1007 core.packedGitLimit
2122591b 1008 clean.requireForce
78d4d6a2
SP
1009 color.branch
1010 color.branch.current
1011 color.branch.local
1012 color.branch.remote
1013 color.branch.plain
a159ca0c 1014 color.diff
78d4d6a2
SP
1015 color.diff.plain
1016 color.diff.meta
1017 color.diff.frag
1018 color.diff.old
1019 color.diff.new
1020 color.diff.commit
1021 color.diff.whitespace
a159ca0c 1022 color.pager
a159ca0c 1023 color.status
78d4d6a2
SP
1024 color.status.header
1025 color.status.added
1026 color.status.changed
1027 color.status.untracked
1028 diff.renameLimit
1029 diff.renames
1030 fetch.unpackLimit
1031 format.headers
47e98eec 1032 format.subjectprefix
78d4d6a2
SP
1033 gitcvs.enabled
1034 gitcvs.logfile
12977705 1035 gitcvs.allbinary
6aeeffd1
JE
1036 gitcvs.dbname gitcvs.dbdriver gitcvs.dbuser gitcvs.dbpass
1037 gitcvs.dbtablenameprefix
12977705 1038 gc.packrefs
78d4d6a2
SP
1039 gc.reflogexpire
1040 gc.reflogexpireunreachable
1041 gc.rerereresolved
1042 gc.rerereunresolved
5de40f59
SP
1043 http.sslVerify
1044 http.sslCert
1045 http.sslKey
1046 http.sslCAInfo
1047 http.sslCAPath
1048 http.maxRequests
78d4d6a2
SP
1049 http.lowSpeedLimit
1050 http.lowSpeedTime
5de40f59 1051 http.noEPSV
78d4d6a2
SP
1052 i18n.commitEncoding
1053 i18n.logOutputEncoding
1054 log.showroot
12977705 1055 merge.tool
78d4d6a2
SP
1056 merge.summary
1057 merge.verbosity
5de40f59 1058 pack.window
12977705 1059 pack.depth
47e98eec
SP
1060 pack.windowMemory
1061 pack.compression
1062 pack.deltaCacheSize
1063 pack.deltaCacheLimit
78d4d6a2
SP
1064 pull.octopus
1065 pull.twohead
5de40f59 1066 repack.useDeltaBaseOffset
78d4d6a2
SP
1067 showbranch.default
1068 tar.umask
1069 transfer.unpackLimit
5de40f59
SP
1070 receive.unpackLimit
1071 receive.denyNonFastForwards
78d4d6a2
SP
1072 user.name
1073 user.email
1074 user.signingkey
5de40f59 1075 branch. remote.
78d4d6a2 1076 "
5de40f59
SP
1077}
1078
88293c67
SP
1079_git_remote ()
1080{
3ff1320d
SG
1081 local subcommands="add rm show prune update"
1082 local subcommand="$(__git_find_subcommand "$subcommands")"
1083 if [ -z "$subcommand" ]; then
3903c618 1084 __gitcomp "$subcommands"
88293c67
SP
1085 return
1086 fi
1087
3ff1320d 1088 case "$subcommand" in
a3b811a4 1089 rm|show|prune)
88293c67
SP
1090 __gitcomp "$(__git_remotes)"
1091 ;;
fb72759b
SP
1092 update)
1093 local i c='' IFS=$'\n'
1094 for i in $(git --git-dir="$(__gitdir)" config --list); do
1095 case "$i" in
1096 remotes.*)
1097 i="${i#remotes.}"
1098 c="$c ${i/=*/}"
1099 ;;
1100 esac
1101 done
1102 __gitcomp "$c"
1103 ;;
88293c67
SP
1104 *)
1105 COMPREPLY=()
1106 ;;
1107 esac
1108}
1109
67e78c3b
SP
1110_git_reset ()
1111{
d773c631
SG
1112 __git_has_doubledash && return
1113
67e78c3b 1114 local cur="${COMP_WORDS[COMP_CWORD]}"
b3391775
SP
1115 case "$cur" in
1116 --*)
1117 __gitcomp "--mixed --hard --soft"
1118 return
1119 ;;
1120 esac
1121 __gitcomp "$(__git_refs)"
67e78c3b
SP
1122}
1123
1fd6bec9
SP
1124_git_shortlog ()
1125{
d773c631
SG
1126 __git_has_doubledash && return
1127
1fd6bec9
SP
1128 local cur="${COMP_WORDS[COMP_CWORD]}"
1129 case "$cur" in
1130 --*)
1131 __gitcomp "
1132 --max-count= --max-age= --since= --after=
1133 --min-age= --before= --until=
1134 --no-merges
1135 --author= --committer= --grep=
1136 --all-match
1137 --not --all
1138 --numbered --summary
1139 "
1140 return
1141 ;;
1142 esac
1143 __git_complete_revlist
1144}
1145
90131924
SP
1146_git_show ()
1147{
1148 local cur="${COMP_WORDS[COMP_CWORD]}"
1149 case "$cur" in
1150 --pretty=*)
b3391775 1151 __gitcomp "
90131924 1152 oneline short medium full fuller email raw
b3391775 1153 " "" "${cur##--pretty=}"
90131924
SP
1154 return
1155 ;;
1156 --*)
b3391775 1157 __gitcomp "--pretty="
90131924
SP
1158 return
1159 ;;
1160 esac
1161 __git_complete_file
1162}
1163
7fd53fce
JH
1164_git_stash ()
1165{
88b302f5 1166 local subcommands='save list show apply clear drop pop create'
7bedebca
SG
1167 local subcommand="$(__git_find_subcommand "$subcommands")"
1168 if [ -z "$subcommand" ]; then
3ff1320d 1169 __gitcomp "$subcommands"
7bedebca
SG
1170 else
1171 local cur="${COMP_WORDS[COMP_CWORD]}"
1172 case "$subcommand,$cur" in
1173 save,--*)
1174 __gitcomp "--keep-index"
1175 ;;
1176 *)
1177 COMPREPLY=()
1178 ;;
1179 esac
3ff1320d 1180 fi
7fd53fce
JH
1181}
1182
be86f7a0
SP
1183_git_submodule ()
1184{
d773c631
SG
1185 __git_has_doubledash && return
1186
3ff1320d
SG
1187 local subcommands="add status init update"
1188 if [ -z "$(__git_find_subcommand "$subcommands")" ]; then
be86f7a0
SP
1189 local cur="${COMP_WORDS[COMP_CWORD]}"
1190 case "$cur" in
1191 --*)
1192 __gitcomp "--quiet --cached"
1193 ;;
1194 *)
3ff1320d 1195 __gitcomp "$subcommands"
be86f7a0
SP
1196 ;;
1197 esac
1198 return
1199 fi
1200}
1201
47f6ee28
SG
1202_git_svn ()
1203{
1204 local subcommands="
1205 init fetch clone rebase dcommit log find-rev
1206 set-tree commit-diff info create-ignore propget
1207 proplist show-ignore show-externals
1208 "
1209 local subcommand="$(__git_find_subcommand "$subcommands")"
1210 if [ -z "$subcommand" ]; then
1211 __gitcomp "$subcommands"
1212 else
1213 local remote_opts="--username= --config-dir= --no-auth-cache"
1214 local fc_opts="
1215 --follow-parent --authors-file= --repack=
1216 --no-metadata --use-svm-props --use-svnsync-props
1217 --log-window-size= --no-checkout --quiet
1218 --repack-flags --user-log-author $remote_opts
1219 "
1220 local init_opts="
1221 --template= --shared= --trunk= --tags=
1222 --branches= --stdlayout --minimize-url
1223 --no-metadata --use-svm-props --use-svnsync-props
1224 --rewrite-root= $remote_opts
1225 "
1226 local cmt_opts="
1227 --edit --rmdir --find-copies-harder --copy-similarity=
1228 "
1229
1230 local cur="${COMP_WORDS[COMP_CWORD]}"
1231 case "$subcommand,$cur" in
1232 fetch,--*)
1233 __gitcomp "--revision= --fetch-all $fc_opts"
1234 ;;
1235 clone,--*)
1236 __gitcomp "--revision= $fc_opts $init_opts"
1237 ;;
1238 init,--*)
1239 __gitcomp "$init_opts"
1240 ;;
1241 dcommit,--*)
1242 __gitcomp "
1243 --merge --strategy= --verbose --dry-run
1244 --fetch-all --no-rebase $cmt_opts $fc_opts
1245 "
1246 ;;
1247 set-tree,--*)
1248 __gitcomp "--stdin $cmt_opts $fc_opts"
1249 ;;
1250 create-ignore,--*|propget,--*|proplist,--*|show-ignore,--*|\
1251 show-externals,--*)
1252 __gitcomp "--revision="
1253 ;;
1254 log,--*)
1255 __gitcomp "
1256 --limit= --revision= --verbose --incremental
1257 --oneline --show-commit --non-recursive
1258 --authors-file=
1259 "
1260 ;;
1261 rebase,--*)
1262 __gitcomp "
1263 --merge --verbose --strategy= --local
1264 --fetch-all $fc_opts
1265 "
1266 ;;
1267 commit-diff,--*)
1268 __gitcomp "--message= --file= --revision= $cmt_opts"
1269 ;;
1270 info,--*)
1271 __gitcomp "--url"
1272 ;;
1273 *)
1274 COMPREPLY=()
1275 ;;
1276 esac
1277 fi
1278}
1279
88e21dc7
SP
1280_git_tag ()
1281{
1282 local i c=1 f=0
1283 while [ $c -lt $COMP_CWORD ]; do
1284 i="${COMP_WORDS[c]}"
1285 case "$i" in
1286 -d|-v)
1287 __gitcomp "$(__git_tags)"
1288 return
1289 ;;
1290 -f)
1291 f=1
1292 ;;
1293 esac
1294 c=$((++c))
1295 done
1296
1297 case "${COMP_WORDS[COMP_CWORD-1]}" in
1298 -m|-F)
1299 COMPREPLY=()
1300 ;;
1301 -*|tag|git-tag)
1302 if [ $f = 1 ]; then
1303 __gitcomp "$(__git_tags)"
1304 else
1305 COMPREPLY=()
1306 fi
1307 ;;
1308 *)
1309 __gitcomp "$(__git_refs)"
1310 ;;
1311 esac
1312}
1313
690d8824
JH
1314_git ()
1315{
873537fa
SP
1316 local i c=1 command __git_dir
1317
1318 while [ $c -lt $COMP_CWORD ]; do
1319 i="${COMP_WORDS[c]}"
1320 case "$i" in
1321 --git-dir=*) __git_dir="${i#--git-dir=}" ;;
1322 --bare) __git_dir="." ;;
1323 --version|--help|-p|--paginate) ;;
1324 *) command="$i"; break ;;
1325 esac
1326 c=$((++c))
1327 done
1328
1d17b22e 1329 if [ -z "$command" ]; then
72e5e989
SP
1330 case "${COMP_WORDS[COMP_CWORD]}" in
1331 --*=*) COMPREPLY=() ;;
47e98eec 1332 --*) __gitcomp "
ce5a2c95 1333 --paginate
47e98eec
SP
1334 --no-pager
1335 --git-dir=
1336 --bare
1337 --version
1338 --exec-path
ce5a2c95
TL
1339 --work-tree=
1340 --help
47e98eec
SP
1341 "
1342 ;;
72e5e989
SP
1343 *) __gitcomp "$(__git_commands) $(__git_aliases)" ;;
1344 esac
1345 return
873537fa 1346 fi
367dce2a 1347
873537fa
SP
1348 local expansion=$(__git_aliased_command "$command")
1349 [ "$expansion" ] && command="$expansion"
367dce2a 1350
873537fa 1351 case "$command" in
88329195 1352 am) _git_am ;;
8435b548 1353 add) _git_add ;;
88329195 1354 apply) _git_apply ;;
b2e69f62 1355 bisect) _git_bisect ;;
374a58c9 1356 bundle) _git_bundle ;;
873537fa 1357 branch) _git_branch ;;
873537fa 1358 checkout) _git_checkout ;;
d8a9fea5 1359 cherry) _git_cherry ;;
1273231e 1360 cherry-pick) _git_cherry_pick ;;
4548e855 1361 commit) _git_commit ;;
e0d10e1c 1362 config) _git_config ;;
217926c0 1363 describe) _git_describe ;;
873537fa 1364 diff) _git_diff ;;
873537fa 1365 fetch) _git_fetch ;;
f53352fb 1366 format-patch) _git_format_patch ;;
b26c8748 1367 gc) _git_gc ;;
873537fa
SP
1368 log) _git_log ;;
1369 ls-remote) _git_ls_remote ;;
1370 ls-tree) _git_ls_tree ;;
4ad91321 1371 merge) _git_merge;;
873537fa 1372 merge-base) _git_merge_base ;;
d33909bf 1373 name-rev) _git_name_rev ;;
873537fa
SP
1374 pull) _git_pull ;;
1375 push) _git_push ;;
61d926a3 1376 rebase) _git_rebase ;;
88293c67 1377 remote) _git_remote ;;
873537fa 1378 reset) _git_reset ;;
1fd6bec9 1379 shortlog) _git_shortlog ;;
90131924 1380 show) _git_show ;;
873537fa 1381 show-branch) _git_log ;;
7fd53fce 1382 stash) _git_stash ;;
be86f7a0 1383 submodule) _git_submodule ;;
47f6ee28 1384 svn) _git_svn ;;
88e21dc7 1385 tag) _git_tag ;;
873537fa
SP
1386 whatchanged) _git_log ;;
1387 *) COMPREPLY=() ;;
1388 esac
690d8824
JH
1389}
1390
1391_gitk ()
1392{
d773c631
SG
1393 __git_has_doubledash && return
1394
690d8824 1395 local cur="${COMP_WORDS[COMP_CWORD]}"
07ba53f7
RQ
1396 local g="$(git rev-parse --git-dir 2>/dev/null)"
1397 local merge=""
1398 if [ -f $g/MERGE_HEAD ]; then
1399 merge="--merge"
1400 fi
b3391775
SP
1401 case "$cur" in
1402 --*)
07ba53f7 1403 __gitcomp "--not --all $merge"
b3391775
SP
1404 return
1405 ;;
1406 esac
ec804891 1407 __git_complete_revlist
690d8824
JH
1408}
1409
1410complete -o default -o nospace -F _git git
b3391775
SP
1411complete -o default -o nospace -F _gitk gitk
1412complete -o default -o nospace -F _git_am git-am
1413complete -o default -o nospace -F _git_apply git-apply
b2e69f62 1414complete -o default -o nospace -F _git_bisect git-bisect
b3391775 1415complete -o default -o nospace -F _git_branch git-branch
374a58c9 1416complete -o default -o nospace -F _git_bundle git-bundle
b3391775 1417complete -o default -o nospace -F _git_checkout git-checkout
d8a9fea5 1418complete -o default -o nospace -F _git_cherry git-cherry
b3391775
SP
1419complete -o default -o nospace -F _git_cherry_pick git-cherry-pick
1420complete -o default -o nospace -F _git_commit git-commit
217926c0 1421complete -o default -o nospace -F _git_describe git-describe
690d8824 1422complete -o default -o nospace -F _git_diff git-diff
690d8824 1423complete -o default -o nospace -F _git_fetch git-fetch
f53352fb 1424complete -o default -o nospace -F _git_format_patch git-format-patch
b26c8748 1425complete -o default -o nospace -F _git_gc git-gc
690d8824 1426complete -o default -o nospace -F _git_log git-log
b3391775 1427complete -o default -o nospace -F _git_ls_remote git-ls-remote
690d8824 1428complete -o default -o nospace -F _git_ls_tree git-ls-tree
b3391775
SP
1429complete -o default -o nospace -F _git_merge git-merge
1430complete -o default -o nospace -F _git_merge_base git-merge-base
1431complete -o default -o nospace -F _git_name_rev git-name-rev
690d8824
JH
1432complete -o default -o nospace -F _git_pull git-pull
1433complete -o default -o nospace -F _git_push git-push
b3391775
SP
1434complete -o default -o nospace -F _git_rebase git-rebase
1435complete -o default -o nospace -F _git_config git-config
88293c67 1436complete -o default -o nospace -F _git_remote git-remote
b3391775 1437complete -o default -o nospace -F _git_reset git-reset
1fd6bec9 1438complete -o default -o nospace -F _git_shortlog git-shortlog
90131924 1439complete -o default -o nospace -F _git_show git-show
7fd53fce 1440complete -o default -o nospace -F _git_stash git-stash
be86f7a0 1441complete -o default -o nospace -F _git_submodule git-submodule
47f6ee28 1442complete -o default -o nospace -F _git_svn git-svn
144d33de 1443complete -o default -o nospace -F _git_log git-show-branch
88e21dc7 1444complete -o default -o nospace -F _git_tag git-tag
690d8824
JH
1445complete -o default -o nospace -F _git_log git-whatchanged
1446
1447# The following are necessary only for Cygwin, and only are needed
1448# when the user has tab-completed the executable name and consequently
1449# included the '.exe' suffix.
1450#
76c3eb51 1451if [ Cygwin = "$(uname -o 2>/dev/null)" ]; then
b3391775
SP
1452complete -o default -o nospace -F _git_add git-add.exe
1453complete -o default -o nospace -F _git_apply git-apply.exe
144d33de 1454complete -o default -o nospace -F _git git.exe
b3391775 1455complete -o default -o nospace -F _git_branch git-branch.exe
374a58c9 1456complete -o default -o nospace -F _git_bundle git-bundle.exe
d8a9fea5 1457complete -o default -o nospace -F _git_cherry git-cherry.exe
217926c0 1458complete -o default -o nospace -F _git_describe git-describe.exe
690d8824 1459complete -o default -o nospace -F _git_diff git-diff.exe
f53352fb 1460complete -o default -o nospace -F _git_format_patch git-format-patch.exe
690d8824
JH
1461complete -o default -o nospace -F _git_log git-log.exe
1462complete -o default -o nospace -F _git_ls_tree git-ls-tree.exe
b3391775
SP
1463complete -o default -o nospace -F _git_merge_base git-merge-base.exe
1464complete -o default -o nospace -F _git_name_rev git-name-rev.exe
690d8824 1465complete -o default -o nospace -F _git_push git-push.exe
b3391775 1466complete -o default -o nospace -F _git_config git-config
1fd6bec9 1467complete -o default -o nospace -F _git_shortlog git-shortlog.exe
90131924 1468complete -o default -o nospace -F _git_show git-show.exe
144d33de 1469complete -o default -o nospace -F _git_log git-show-branch.exe
88e21dc7 1470complete -o default -o nospace -F _git_tag git-tag.exe
690d8824 1471complete -o default -o nospace -F _git_log git-whatchanged.exe
76c3eb51 1472fi