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