]>
Commit | Line | Data |
---|---|---|
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 | { | |
67 | local b="$(git symbolic-ref HEAD 2>/dev/null)" | |
68 | if [ -n "$b" ]; then | |
69 | if [ -n "$1" ]; then | |
70 | printf "$1" "${b##refs/heads/}" | |
71 | else | |
72 | printf " (%s)" "${b##refs/heads/}" | |
73 | fi | |
74 | fi | |
75 | } | |
76 | ||
72e5e989 SP |
77 | __gitcomp () |
78 | { | |
79 | local all c s=$'\n' IFS=' '$'\t'$'\n' | |
78d4d6a2 | 80 | local cur="${COMP_WORDS[COMP_CWORD]}" |
b3391775 | 81 | if [ $# -gt 2 ]; then |
78d4d6a2 SP |
82 | cur="$3" |
83 | fi | |
72e5e989 | 84 | for c in $1; do |
78d4d6a2 SP |
85 | case "$c$4" in |
86 | --*=*) all="$all$c$4$s" ;; | |
87 | *.) all="$all$c$4$s" ;; | |
88 | *) all="$all$c$4 $s" ;; | |
72e5e989 SP |
89 | esac |
90 | done | |
91 | IFS=$s | |
78d4d6a2 | 92 | COMPREPLY=($(compgen -P "$2" -W "$all" -- "$cur")) |
72e5e989 SP |
93 | return |
94 | } | |
95 | ||
5de40f59 SP |
96 | __git_heads () |
97 | { | |
67ffa114 | 98 | local cmd i is_hash=y dir="$(__gitdir "$1")" |
5de40f59 SP |
99 | if [ -d "$dir" ]; then |
100 | for i in $(git --git-dir="$dir" \ | |
101 | for-each-ref --format='%(refname)' \ | |
102 | refs/heads ); do | |
103 | echo "${i#refs/heads/}" | |
104 | done | |
105 | return | |
106 | fi | |
67ffa114 | 107 | for i in $(git-ls-remote "$1" 2>/dev/null); do |
5de40f59 SP |
108 | case "$is_hash,$i" in |
109 | y,*) is_hash=n ;; | |
110 | n,*^{}) is_hash=y ;; | |
111 | n,refs/heads/*) is_hash=y; echo "${i#refs/heads/}" ;; | |
112 | n,*) is_hash=y; echo "$i" ;; | |
113 | esac | |
114 | done | |
115 | } | |
116 | ||
690d8824 JH |
117 | __git_refs () |
118 | { | |
67ffa114 | 119 | local cmd i is_hash=y dir="$(__gitdir "$1")" |
873537fa | 120 | if [ -d "$dir" ]; then |
35e65ecc SP |
121 | if [ -e "$dir/HEAD" ]; then echo HEAD; fi |
122 | for i in $(git --git-dir="$dir" \ | |
123 | for-each-ref --format='%(refname)' \ | |
124 | refs/tags refs/heads refs/remotes); do | |
125 | case "$i" in | |
126 | refs/tags/*) echo "${i#refs/tags/}" ;; | |
127 | refs/heads/*) echo "${i#refs/heads/}" ;; | |
128 | refs/remotes/*) echo "${i#refs/remotes/}" ;; | |
129 | *) echo "$i" ;; | |
130 | esac | |
131 | done | |
132 | return | |
690d8824 | 133 | fi |
35e65ecc | 134 | for i in $(git-ls-remote "$dir" 2>/dev/null); do |
690d8824 JH |
135 | case "$is_hash,$i" in |
136 | y,*) is_hash=n ;; | |
137 | n,*^{}) is_hash=y ;; | |
138 | n,refs/tags/*) is_hash=y; echo "${i#refs/tags/}" ;; | |
139 | n,refs/heads/*) is_hash=y; echo "${i#refs/heads/}" ;; | |
35e65ecc | 140 | n,refs/remotes/*) is_hash=y; echo "${i#refs/remotes/}" ;; |
690d8824 JH |
141 | n,*) is_hash=y; echo "$i" ;; |
142 | esac | |
143 | done | |
144 | } | |
145 | ||
146 | __git_refs2 () | |
147 | { | |
67ffa114 SP |
148 | local i |
149 | for i in $(__git_refs "$1"); do | |
150 | echo "$i:$i" | |
690d8824 JH |
151 | done |
152 | } | |
153 | ||
5de40f59 SP |
154 | __git_refs_remotes () |
155 | { | |
156 | local cmd i is_hash=y | |
157 | for i in $(git-ls-remote "$1" 2>/dev/null); do | |
158 | case "$is_hash,$i" in | |
159 | n,refs/heads/*) | |
160 | is_hash=y | |
161 | echo "$i:refs/remotes/$1/${i#refs/heads/}" | |
162 | ;; | |
163 | y,*) is_hash=n ;; | |
164 | n,*^{}) is_hash=y ;; | |
165 | n,refs/tags/*) is_hash=y;; | |
166 | n,*) is_hash=y; ;; | |
167 | esac | |
168 | done | |
169 | } | |
170 | ||
690d8824 JH |
171 | __git_remotes () |
172 | { | |
873537fa | 173 | local i ngoff IFS=$'\n' d="$(__gitdir)" |
56fc25f2 | 174 | shopt -q nullglob || ngoff=1 |
690d8824 | 175 | shopt -s nullglob |
873537fa SP |
176 | for i in "$d/remotes"/*; do |
177 | echo ${i#$d/remotes/} | |
690d8824 | 178 | done |
56fc25f2 | 179 | [ "$ngoff" ] && shopt -u nullglob |
e0d10e1c | 180 | for i in $(git --git-dir="$d" config --list); do |
56fc25f2 SP |
181 | case "$i" in |
182 | remote.*.url=*) | |
183 | i="${i#remote.}" | |
184 | echo "${i/.url=*/}" | |
185 | ;; | |
186 | esac | |
187 | done | |
690d8824 JH |
188 | } |
189 | ||
4ad91321 SP |
190 | __git_merge_strategies () |
191 | { | |
b51ec6bd SP |
192 | if [ -n "$__git_merge_strategylist" ]; then |
193 | echo "$__git_merge_strategylist" | |
194 | return | |
195 | fi | |
4ad91321 SP |
196 | sed -n "/^all_strategies='/{ |
197 | s/^all_strategies='// | |
198 | s/'// | |
199 | p | |
200 | q | |
201 | }" "$(git --exec-path)/git-merge" | |
202 | } | |
b51ec6bd SP |
203 | __git_merge_strategylist= |
204 | __git_merge_strategylist="$(__git_merge_strategies 2>/dev/null)" | |
4ad91321 | 205 | |
690d8824 JH |
206 | __git_complete_file () |
207 | { | |
a79c6551 | 208 | local pfx ls ref cur="${COMP_WORDS[COMP_CWORD]}" |
690d8824 JH |
209 | case "$cur" in |
210 | ?*:*) | |
a79c6551 SP |
211 | ref="${cur%%:*}" |
212 | cur="${cur#*:}" | |
690d8824 JH |
213 | case "$cur" in |
214 | ?*/*) | |
a79c6551 SP |
215 | pfx="${cur%/*}" |
216 | cur="${cur##*/}" | |
690d8824 JH |
217 | ls="$ref:$pfx" |
218 | pfx="$pfx/" | |
219 | ;; | |
220 | *) | |
221 | ls="$ref" | |
222 | ;; | |
223 | esac | |
224 | COMPREPLY=($(compgen -P "$pfx" \ | |
873537fa | 225 | -W "$(git --git-dir="$(__gitdir)" ls-tree "$ls" \ |
690d8824 JH |
226 | | sed '/^100... blob /s,^.* ,, |
227 | /^040000 tree /{ | |
228 | s,^.* ,, | |
229 | s,$,/, | |
230 | } | |
231 | s/^.* //')" \ | |
232 | -- "$cur")) | |
233 | ;; | |
234 | *) | |
b3391775 | 235 | __gitcomp "$(__git_refs)" |
690d8824 JH |
236 | ;; |
237 | esac | |
238 | } | |
239 | ||
f53352fb SP |
240 | __git_complete_revlist () |
241 | { | |
242 | local pfx cur="${COMP_WORDS[COMP_CWORD]}" | |
243 | case "$cur" in | |
244 | *...*) | |
245 | pfx="${cur%...*}..." | |
246 | cur="${cur#*...}" | |
b3391775 | 247 | __gitcomp "$(__git_refs)" "$pfx" "$cur" |
f53352fb SP |
248 | ;; |
249 | *..*) | |
250 | pfx="${cur%..*}.." | |
251 | cur="${cur#*..}" | |
b3391775 SP |
252 | __gitcomp "$(__git_refs)" "$pfx" "$cur" |
253 | ;; | |
254 | *.) | |
255 | __gitcomp "$cur." | |
f53352fb SP |
256 | ;; |
257 | *) | |
b3391775 | 258 | __gitcomp "$(__git_refs)" |
f53352fb SP |
259 | ;; |
260 | esac | |
261 | } | |
262 | ||
f2bb9f88 SP |
263 | __git_commands () |
264 | { | |
b51ec6bd SP |
265 | if [ -n "$__git_commandlist" ]; then |
266 | echo "$__git_commandlist" | |
267 | return | |
268 | fi | |
f2bb9f88 SP |
269 | local i IFS=" "$'\n' |
270 | for i in $(git help -a|egrep '^ ') | |
271 | do | |
272 | case $i in | |
8435b548 | 273 | add--interactive) : plumbing;; |
a925c6f1 SP |
274 | applymbox) : ask gittus;; |
275 | applypatch) : ask gittus;; | |
276 | archimport) : import;; | |
2e3a430a | 277 | cat-file) : plumbing;; |
56d99c67 | 278 | check-attr) : plumbing;; |
f2bb9f88 SP |
279 | check-ref-format) : plumbing;; |
280 | commit-tree) : plumbing;; | |
281 | convert-objects) : plumbing;; | |
a925c6f1 SP |
282 | cvsexportcommit) : export;; |
283 | cvsimport) : import;; | |
f2bb9f88 SP |
284 | cvsserver) : daemon;; |
285 | daemon) : daemon;; | |
5cfb4fe5 SP |
286 | diff-files) : plumbing;; |
287 | diff-index) : plumbing;; | |
288 | diff-tree) : plumbing;; | |
c6ec3b13 | 289 | fast-import) : import;; |
a925c6f1 | 290 | fsck-objects) : plumbing;; |
56d99c67 | 291 | fetch--tool) : plumbing;; |
f2bb9f88 | 292 | fetch-pack) : plumbing;; |
a925c6f1 | 293 | fmt-merge-msg) : plumbing;; |
56d99c67 | 294 | for-each-ref) : plumbing;; |
f2bb9f88 SP |
295 | hash-object) : plumbing;; |
296 | http-*) : transport;; | |
297 | index-pack) : plumbing;; | |
a925c6f1 | 298 | init-db) : deprecated;; |
f2bb9f88 SP |
299 | local-fetch) : plumbing;; |
300 | mailinfo) : plumbing;; | |
301 | mailsplit) : plumbing;; | |
302 | merge-*) : plumbing;; | |
303 | mktree) : plumbing;; | |
304 | mktag) : plumbing;; | |
305 | pack-objects) : plumbing;; | |
306 | pack-redundant) : plumbing;; | |
307 | pack-refs) : plumbing;; | |
308 | parse-remote) : plumbing;; | |
309 | patch-id) : plumbing;; | |
310 | peek-remote) : plumbing;; | |
a925c6f1 SP |
311 | prune) : plumbing;; |
312 | prune-packed) : plumbing;; | |
313 | quiltimport) : import;; | |
f2bb9f88 SP |
314 | read-tree) : plumbing;; |
315 | receive-pack) : plumbing;; | |
2e3a430a | 316 | reflog) : plumbing;; |
a925c6f1 | 317 | repo-config) : plumbing;; |
f2bb9f88 SP |
318 | rerere) : plumbing;; |
319 | rev-list) : plumbing;; | |
320 | rev-parse) : plumbing;; | |
321 | runstatus) : plumbing;; | |
322 | sh-setup) : internal;; | |
323 | shell) : daemon;; | |
324 | send-pack) : plumbing;; | |
325 | show-index) : plumbing;; | |
326 | ssh-*) : transport;; | |
327 | stripspace) : plumbing;; | |
a925c6f1 SP |
328 | svn) : import export;; |
329 | svnimport) : import;; | |
f2bb9f88 | 330 | symbolic-ref) : plumbing;; |
a925c6f1 | 331 | tar-tree) : deprecated;; |
f2bb9f88 SP |
332 | unpack-file) : plumbing;; |
333 | unpack-objects) : plumbing;; | |
a925c6f1 | 334 | update-index) : plumbing;; |
f2bb9f88 SP |
335 | update-ref) : plumbing;; |
336 | update-server-info) : daemon;; | |
337 | upload-archive) : plumbing;; | |
338 | upload-pack) : plumbing;; | |
339 | write-tree) : plumbing;; | |
a925c6f1 | 340 | verify-tag) : plumbing;; |
f2bb9f88 SP |
341 | *) echo $i;; |
342 | esac | |
343 | done | |
344 | } | |
b51ec6bd SP |
345 | __git_commandlist= |
346 | __git_commandlist="$(__git_commands 2>/dev/null)" | |
f2bb9f88 | 347 | |
367dce2a DS |
348 | __git_aliases () |
349 | { | |
56fc25f2 | 350 | local i IFS=$'\n' |
e0d10e1c | 351 | for i in $(git --git-dir="$(__gitdir)" config --list); do |
56fc25f2 SP |
352 | case "$i" in |
353 | alias.*) | |
354 | i="${i#alias.}" | |
355 | echo "${i/=*/}" | |
356 | ;; | |
357 | esac | |
358 | done | |
367dce2a DS |
359 | } |
360 | ||
361 | __git_aliased_command () | |
362 | { | |
873537fa | 363 | local word cmdline=$(git --git-dir="$(__gitdir)" \ |
e0d10e1c | 364 | config --get "alias.$1") |
367dce2a DS |
365 | for word in $cmdline; do |
366 | if [ "${word##-*}" ]; then | |
367 | echo $word | |
368 | return | |
369 | fi | |
370 | done | |
371 | } | |
372 | ||
88329195 SP |
373 | __git_whitespacelist="nowarn warn error error-all strip" |
374 | ||
375 | _git_am () | |
376 | { | |
377 | local cur="${COMP_WORDS[COMP_CWORD]}" | |
378 | if [ -d .dotest ]; then | |
b3391775 | 379 | __gitcomp "--skip --resolved" |
88329195 SP |
380 | return |
381 | fi | |
382 | case "$cur" in | |
383 | --whitespace=*) | |
b3391775 | 384 | __gitcomp "$__git_whitespacelist" "" "${cur##--whitespace=}" |
88329195 SP |
385 | return |
386 | ;; | |
387 | --*) | |
b3391775 | 388 | __gitcomp " |
88329195 SP |
389 | --signoff --utf8 --binary --3way --interactive |
390 | --whitespace= | |
b3391775 | 391 | " |
88329195 SP |
392 | return |
393 | esac | |
394 | COMPREPLY=() | |
395 | } | |
396 | ||
397 | _git_apply () | |
398 | { | |
399 | local cur="${COMP_WORDS[COMP_CWORD]}" | |
400 | case "$cur" in | |
401 | --whitespace=*) | |
b3391775 | 402 | __gitcomp "$__git_whitespacelist" "" "${cur##--whitespace=}" |
88329195 SP |
403 | return |
404 | ;; | |
405 | --*) | |
b3391775 | 406 | __gitcomp " |
88329195 SP |
407 | --stat --numstat --summary --check --index |
408 | --cached --index-info --reverse --reject --unidiff-zero | |
409 | --apply --no-add --exclude= | |
410 | --whitespace= --inaccurate-eof --verbose | |
b3391775 | 411 | " |
88329195 SP |
412 | return |
413 | esac | |
414 | COMPREPLY=() | |
415 | } | |
416 | ||
8435b548 SP |
417 | _git_add () |
418 | { | |
419 | local cur="${COMP_WORDS[COMP_CWORD]}" | |
420 | case "$cur" in | |
421 | --*) | |
47e98eec | 422 | __gitcomp "--interactive --refresh" |
8435b548 SP |
423 | return |
424 | esac | |
425 | COMPREPLY=() | |
426 | } | |
427 | ||
b2e69f62 SP |
428 | _git_bisect () |
429 | { | |
430 | local i c=1 command | |
431 | while [ $c -lt $COMP_CWORD ]; do | |
432 | i="${COMP_WORDS[c]}" | |
433 | case "$i" in | |
434 | start|bad|good|reset|visualize|replay|log) | |
435 | command="$i" | |
436 | break | |
437 | ;; | |
438 | esac | |
439 | c=$((++c)) | |
440 | done | |
441 | ||
442 | if [ $c -eq $COMP_CWORD -a -z "$command" ]; then | |
443 | __gitcomp "start bad good reset visualize replay log" | |
444 | return | |
445 | fi | |
446 | ||
447 | case "$command" in | |
448 | bad|good|reset) | |
449 | __gitcomp "$(__git_refs)" | |
450 | ;; | |
451 | *) | |
452 | COMPREPLY=() | |
453 | ;; | |
454 | esac | |
455 | } | |
456 | ||
690d8824 JH |
457 | _git_branch () |
458 | { | |
b3391775 | 459 | __gitcomp "$(__git_refs)" |
690d8824 JH |
460 | } |
461 | ||
374a58c9 ML |
462 | _git_bundle () |
463 | { | |
464 | local mycword="$COMP_CWORD" | |
465 | case "${COMP_WORDS[0]}" in | |
466 | git) | |
467 | local cmd="${COMP_WORDS[2]}" | |
468 | mycword="$((mycword-1))" | |
469 | ;; | |
470 | git-bundle*) | |
471 | local cmd="${COMP_WORDS[1]}" | |
472 | ;; | |
473 | esac | |
474 | case "$mycword" in | |
475 | 1) | |
476 | __gitcomp "create list-heads verify unbundle" | |
477 | ;; | |
478 | 2) | |
479 | # looking for a file | |
480 | ;; | |
481 | *) | |
482 | case "$cmd" in | |
483 | create) | |
484 | __git_complete_revlist | |
485 | ;; | |
486 | esac | |
487 | ;; | |
488 | esac | |
489 | } | |
490 | ||
690d8824 JH |
491 | _git_checkout () |
492 | { | |
b3391775 | 493 | __gitcomp "$(__git_refs)" |
690d8824 JH |
494 | } |
495 | ||
d8a9fea5 SP |
496 | _git_cherry () |
497 | { | |
498 | __gitcomp "$(__git_refs)" | |
499 | } | |
500 | ||
1273231e SP |
501 | _git_cherry_pick () |
502 | { | |
503 | local cur="${COMP_WORDS[COMP_CWORD]}" | |
504 | case "$cur" in | |
505 | --*) | |
b3391775 | 506 | __gitcomp "--edit --no-commit" |
1273231e SP |
507 | ;; |
508 | *) | |
b3391775 | 509 | __gitcomp "$(__git_refs)" |
1273231e SP |
510 | ;; |
511 | esac | |
512 | } | |
513 | ||
4548e855 SP |
514 | _git_commit () |
515 | { | |
516 | local cur="${COMP_WORDS[COMP_CWORD]}" | |
517 | case "$cur" in | |
518 | --*) | |
b3391775 | 519 | __gitcomp " |
4548e855 SP |
520 | --all --author= --signoff --verify --no-verify |
521 | --edit --amend --include --only | |
b3391775 | 522 | " |
4548e855 SP |
523 | return |
524 | esac | |
525 | COMPREPLY=() | |
526 | } | |
527 | ||
217926c0 SP |
528 | _git_describe () |
529 | { | |
530 | __gitcomp "$(__git_refs)" | |
531 | } | |
532 | ||
690d8824 JH |
533 | _git_diff () |
534 | { | |
535 | __git_complete_file | |
536 | } | |
537 | ||
538 | _git_diff_tree () | |
539 | { | |
b3391775 | 540 | __gitcomp "$(__git_refs)" |
690d8824 JH |
541 | } |
542 | ||
543 | _git_fetch () | |
544 | { | |
545 | local cur="${COMP_WORDS[COMP_CWORD]}" | |
546 | ||
547 | case "${COMP_WORDS[0]},$COMP_CWORD" in | |
548 | git-fetch*,1) | |
b3391775 | 549 | __gitcomp "$(__git_remotes)" |
690d8824 JH |
550 | ;; |
551 | git,2) | |
b3391775 | 552 | __gitcomp "$(__git_remotes)" |
690d8824 JH |
553 | ;; |
554 | *) | |
555 | case "$cur" in | |
556 | *:*) | |
b3391775 | 557 | __gitcomp "$(__git_refs)" "" "${cur#*:}" |
690d8824 JH |
558 | ;; |
559 | *) | |
560 | local remote | |
561 | case "${COMP_WORDS[0]}" in | |
562 | git-fetch) remote="${COMP_WORDS[1]}" ;; | |
563 | git) remote="${COMP_WORDS[2]}" ;; | |
564 | esac | |
b3391775 | 565 | __gitcomp "$(__git_refs2 "$remote")" |
690d8824 JH |
566 | ;; |
567 | esac | |
568 | ;; | |
569 | esac | |
570 | } | |
571 | ||
f53352fb SP |
572 | _git_format_patch () |
573 | { | |
574 | local cur="${COMP_WORDS[COMP_CWORD]}" | |
575 | case "$cur" in | |
576 | --*) | |
b3391775 | 577 | __gitcomp " |
f53352fb SP |
578 | --stdout --attach --thread |
579 | --output-directory | |
580 | --numbered --start-number | |
47e98eec | 581 | --numbered-files |
f53352fb SP |
582 | --keep-subject |
583 | --signoff | |
584 | --in-reply-to= | |
585 | --full-index --binary | |
ec804891 | 586 | --not --all |
b3391775 | 587 | " |
f53352fb SP |
588 | return |
589 | ;; | |
590 | esac | |
591 | __git_complete_revlist | |
592 | } | |
593 | ||
b26c8748 SP |
594 | _git_gc () |
595 | { | |
596 | local cur="${COMP_WORDS[COMP_CWORD]}" | |
597 | case "$cur" in | |
598 | --*) | |
47e98eec | 599 | __gitcomp "--prune --aggressive" |
b26c8748 SP |
600 | return |
601 | ;; | |
602 | esac | |
603 | COMPREPLY=() | |
604 | } | |
605 | ||
690d8824 JH |
606 | _git_ls_remote () |
607 | { | |
b3391775 | 608 | __gitcomp "$(__git_remotes)" |
690d8824 JH |
609 | } |
610 | ||
611 | _git_ls_tree () | |
612 | { | |
613 | __git_complete_file | |
614 | } | |
615 | ||
616 | _git_log () | |
617 | { | |
6e31b866 SP |
618 | local cur="${COMP_WORDS[COMP_CWORD]}" |
619 | case "$cur" in | |
620 | --pretty=*) | |
b3391775 | 621 | __gitcomp " |
6e31b866 | 622 | oneline short medium full fuller email raw |
b3391775 | 623 | " "" "${cur##--pretty=}" |
6e31b866 SP |
624 | return |
625 | ;; | |
47e98eec SP |
626 | --date=*) |
627 | __gitcomp " | |
628 | relative iso8601 rfc2822 short local default | |
629 | " "" "${cur##--date=}" | |
630 | return | |
631 | ;; | |
6e31b866 | 632 | --*) |
b3391775 | 633 | __gitcomp " |
6e31b866 SP |
634 | --max-count= --max-age= --since= --after= |
635 | --min-age= --before= --until= | |
8f87fae6 | 636 | --root --topo-order --date-order --reverse |
47e98eec | 637 | --no-merges --follow |
6e31b866 | 638 | --abbrev-commit --abbrev= |
47e98eec | 639 | --relative-date --date= |
6e31b866 SP |
640 | --author= --committer= --grep= |
641 | --all-match | |
8f87fae6 | 642 | --pretty= --name-status --name-only --raw |
ec804891 | 643 | --not --all |
7d37b5bf | 644 | --left-right --cherry-pick |
b3391775 | 645 | " |
6e31b866 SP |
646 | return |
647 | ;; | |
648 | esac | |
f53352fb | 649 | __git_complete_revlist |
690d8824 JH |
650 | } |
651 | ||
4ad91321 SP |
652 | _git_merge () |
653 | { | |
654 | local cur="${COMP_WORDS[COMP_CWORD]}" | |
ce1e39d2 SP |
655 | case "${COMP_WORDS[COMP_CWORD-1]}" in |
656 | -s|--strategy) | |
b3391775 | 657 | __gitcomp "$(__git_merge_strategies)" |
ce1e39d2 SP |
658 | return |
659 | esac | |
4ad91321 | 660 | case "$cur" in |
ce1e39d2 | 661 | --strategy=*) |
b3391775 | 662 | __gitcomp "$(__git_merge_strategies)" "" "${cur##--strategy=}" |
ce1e39d2 SP |
663 | return |
664 | ;; | |
4ad91321 | 665 | --*) |
b3391775 | 666 | __gitcomp " |
61d926a3 | 667 | --no-commit --no-summary --squash --strategy |
b3391775 | 668 | " |
4ad91321 SP |
669 | return |
670 | esac | |
b3391775 | 671 | __gitcomp "$(__git_refs)" |
4ad91321 SP |
672 | } |
673 | ||
690d8824 JH |
674 | _git_merge_base () |
675 | { | |
b3391775 | 676 | __gitcomp "$(__git_refs)" |
690d8824 JH |
677 | } |
678 | ||
d33909bf SP |
679 | _git_name_rev () |
680 | { | |
b3391775 | 681 | __gitcomp "--tags --all --stdin" |
d33909bf SP |
682 | } |
683 | ||
690d8824 JH |
684 | _git_pull () |
685 | { | |
686 | local cur="${COMP_WORDS[COMP_CWORD]}" | |
687 | ||
688 | case "${COMP_WORDS[0]},$COMP_CWORD" in | |
689 | git-pull*,1) | |
b3391775 | 690 | __gitcomp "$(__git_remotes)" |
690d8824 JH |
691 | ;; |
692 | git,2) | |
b3391775 | 693 | __gitcomp "$(__git_remotes)" |
690d8824 JH |
694 | ;; |
695 | *) | |
696 | local remote | |
697 | case "${COMP_WORDS[0]}" in | |
698 | git-pull) remote="${COMP_WORDS[1]}" ;; | |
699 | git) remote="${COMP_WORDS[2]}" ;; | |
700 | esac | |
b3391775 | 701 | __gitcomp "$(__git_refs "$remote")" |
690d8824 JH |
702 | ;; |
703 | esac | |
704 | } | |
705 | ||
706 | _git_push () | |
707 | { | |
708 | local cur="${COMP_WORDS[COMP_CWORD]}" | |
709 | ||
710 | case "${COMP_WORDS[0]},$COMP_CWORD" in | |
711 | git-push*,1) | |
b3391775 | 712 | __gitcomp "$(__git_remotes)" |
690d8824 JH |
713 | ;; |
714 | git,2) | |
b3391775 | 715 | __gitcomp "$(__git_remotes)" |
690d8824 JH |
716 | ;; |
717 | *) | |
718 | case "$cur" in | |
719 | *:*) | |
720 | local remote | |
721 | case "${COMP_WORDS[0]}" in | |
722 | git-push) remote="${COMP_WORDS[1]}" ;; | |
723 | git) remote="${COMP_WORDS[2]}" ;; | |
724 | esac | |
b3391775 | 725 | __gitcomp "$(__git_refs "$remote")" "" "${cur#*:}" |
690d8824 | 726 | ;; |
161fea83 SP |
727 | +*) |
728 | __gitcomp "$(__git_refs)" + "${cur#+}" | |
729 | ;; | |
690d8824 | 730 | *) |
92d7c8e3 | 731 | __gitcomp "$(__git_refs)" |
690d8824 JH |
732 | ;; |
733 | esac | |
734 | ;; | |
735 | esac | |
736 | } | |
737 | ||
61d926a3 SP |
738 | _git_rebase () |
739 | { | |
740 | local cur="${COMP_WORDS[COMP_CWORD]}" | |
c5650b08 | 741 | if [ -d .dotest ] || [ -d .git/.dotest-merge ]; then |
b3391775 | 742 | __gitcomp "--continue --skip --abort" |
61d926a3 SP |
743 | return |
744 | fi | |
ce1e39d2 SP |
745 | case "${COMP_WORDS[COMP_CWORD-1]}" in |
746 | -s|--strategy) | |
b3391775 | 747 | __gitcomp "$(__git_merge_strategies)" |
ce1e39d2 SP |
748 | return |
749 | esac | |
61d926a3 | 750 | case "$cur" in |
ce1e39d2 | 751 | --strategy=*) |
b3391775 | 752 | __gitcomp "$(__git_merge_strategies)" "" "${cur##--strategy=}" |
ce1e39d2 SP |
753 | return |
754 | ;; | |
61d926a3 | 755 | --*) |
b3391775 | 756 | __gitcomp "--onto --merge --strategy" |
61d926a3 SP |
757 | return |
758 | esac | |
b3391775 | 759 | __gitcomp "$(__git_refs)" |
61d926a3 SP |
760 | } |
761 | ||
e0d10e1c | 762 | _git_config () |
5de40f59 SP |
763 | { |
764 | local cur="${COMP_WORDS[COMP_CWORD]}" | |
765 | local prv="${COMP_WORDS[COMP_CWORD-1]}" | |
766 | case "$prv" in | |
767 | branch.*.remote) | |
78d4d6a2 | 768 | __gitcomp "$(__git_remotes)" |
5de40f59 SP |
769 | return |
770 | ;; | |
771 | branch.*.merge) | |
78d4d6a2 | 772 | __gitcomp "$(__git_refs)" |
5de40f59 SP |
773 | return |
774 | ;; | |
775 | remote.*.fetch) | |
776 | local remote="${prv#remote.}" | |
777 | remote="${remote%.fetch}" | |
78d4d6a2 | 778 | __gitcomp "$(__git_refs_remotes "$remote")" |
5de40f59 SP |
779 | return |
780 | ;; | |
781 | remote.*.push) | |
782 | local remote="${prv#remote.}" | |
783 | remote="${remote%.push}" | |
78d4d6a2 | 784 | __gitcomp "$(git --git-dir="$(__gitdir)" \ |
5de40f59 | 785 | for-each-ref --format='%(refname):%(refname)' \ |
78d4d6a2 SP |
786 | refs/heads)" |
787 | return | |
788 | ;; | |
789 | pull.twohead|pull.octopus) | |
790 | __gitcomp "$(__git_merge_strategies)" | |
791 | return | |
792 | ;; | |
793 | color.branch|color.diff|color.status) | |
794 | __gitcomp "always never auto" | |
795 | return | |
796 | ;; | |
797 | color.*.*) | |
798 | __gitcomp " | |
799 | black red green yellow blue magenta cyan white | |
800 | bold dim ul blink reverse | |
801 | " | |
5de40f59 SP |
802 | return |
803 | ;; | |
804 | *.*) | |
805 | COMPREPLY=() | |
806 | return | |
807 | ;; | |
808 | esac | |
809 | case "$cur" in | |
810 | --*) | |
78d4d6a2 | 811 | __gitcomp " |
47e98eec | 812 | --global --system --file= |
12977705 | 813 | --list --replace-all |
5de40f59 | 814 | --get --get-all --get-regexp |
1b71eb35 | 815 | --add --unset --unset-all |
12977705 | 816 | --remove-section --rename-section |
78d4d6a2 | 817 | " |
5de40f59 SP |
818 | return |
819 | ;; | |
820 | branch.*.*) | |
821 | local pfx="${cur%.*}." | |
822 | cur="${cur##*.}" | |
78d4d6a2 | 823 | __gitcomp "remote merge" "$pfx" "$cur" |
5de40f59 SP |
824 | return |
825 | ;; | |
826 | branch.*) | |
827 | local pfx="${cur%.*}." | |
828 | cur="${cur#*.}" | |
78d4d6a2 | 829 | __gitcomp "$(__git_heads)" "$pfx" "$cur" "." |
5de40f59 SP |
830 | return |
831 | ;; | |
832 | remote.*.*) | |
833 | local pfx="${cur%.*}." | |
834 | cur="${cur##*.}" | |
12977705 SP |
835 | __gitcomp " |
836 | url fetch push skipDefaultUpdate | |
837 | receivepack uploadpack tagopt | |
838 | " "$pfx" "$cur" | |
5de40f59 SP |
839 | return |
840 | ;; | |
841 | remote.*) | |
842 | local pfx="${cur%.*}." | |
843 | cur="${cur#*.}" | |
78d4d6a2 | 844 | __gitcomp "$(__git_remotes)" "$pfx" "$cur" "." |
5de40f59 SP |
845 | return |
846 | ;; | |
847 | esac | |
78d4d6a2 | 848 | __gitcomp " |
5de40f59 SP |
849 | apply.whitespace |
850 | core.fileMode | |
851 | core.gitProxy | |
852 | core.ignoreStat | |
853 | core.preferSymlinkRefs | |
854 | core.logAllRefUpdates | |
47e98eec | 855 | core.loosecompression |
5de40f59 SP |
856 | core.repositoryFormatVersion |
857 | core.sharedRepository | |
858 | core.warnAmbiguousRefs | |
859 | core.compression | |
860 | core.legacyHeaders | |
78d4d6a2 SP |
861 | core.packedGitWindowSize |
862 | core.packedGitLimit | |
2122591b | 863 | clean.requireForce |
78d4d6a2 SP |
864 | color.branch |
865 | color.branch.current | |
866 | color.branch.local | |
867 | color.branch.remote | |
868 | color.branch.plain | |
a159ca0c | 869 | color.diff |
78d4d6a2 SP |
870 | color.diff.plain |
871 | color.diff.meta | |
872 | color.diff.frag | |
873 | color.diff.old | |
874 | color.diff.new | |
875 | color.diff.commit | |
876 | color.diff.whitespace | |
a159ca0c | 877 | color.pager |
a159ca0c | 878 | color.status |
78d4d6a2 SP |
879 | color.status.header |
880 | color.status.added | |
881 | color.status.changed | |
882 | color.status.untracked | |
883 | diff.renameLimit | |
884 | diff.renames | |
885 | fetch.unpackLimit | |
886 | format.headers | |
47e98eec | 887 | format.subjectprefix |
78d4d6a2 SP |
888 | gitcvs.enabled |
889 | gitcvs.logfile | |
12977705 SP |
890 | gitcvs.allbinary |
891 | gitcvs.dbname gitcvs.dbdriver gitcvs.dbuser gitcvs.dvpass | |
892 | gc.packrefs | |
78d4d6a2 SP |
893 | gc.reflogexpire |
894 | gc.reflogexpireunreachable | |
895 | gc.rerereresolved | |
896 | gc.rerereunresolved | |
5de40f59 SP |
897 | http.sslVerify |
898 | http.sslCert | |
899 | http.sslKey | |
900 | http.sslCAInfo | |
901 | http.sslCAPath | |
902 | http.maxRequests | |
78d4d6a2 SP |
903 | http.lowSpeedLimit |
904 | http.lowSpeedTime | |
5de40f59 | 905 | http.noEPSV |
78d4d6a2 SP |
906 | i18n.commitEncoding |
907 | i18n.logOutputEncoding | |
908 | log.showroot | |
12977705 | 909 | merge.tool |
78d4d6a2 SP |
910 | merge.summary |
911 | merge.verbosity | |
5de40f59 | 912 | pack.window |
12977705 | 913 | pack.depth |
47e98eec SP |
914 | pack.windowMemory |
915 | pack.compression | |
916 | pack.deltaCacheSize | |
917 | pack.deltaCacheLimit | |
78d4d6a2 SP |
918 | pull.octopus |
919 | pull.twohead | |
5de40f59 | 920 | repack.useDeltaBaseOffset |
78d4d6a2 SP |
921 | show.difftree |
922 | showbranch.default | |
923 | tar.umask | |
924 | transfer.unpackLimit | |
5de40f59 SP |
925 | receive.unpackLimit |
926 | receive.denyNonFastForwards | |
78d4d6a2 SP |
927 | user.name |
928 | user.email | |
929 | user.signingkey | |
930 | whatchanged.difftree | |
5de40f59 | 931 | branch. remote. |
78d4d6a2 | 932 | " |
5de40f59 SP |
933 | } |
934 | ||
88293c67 SP |
935 | _git_remote () |
936 | { | |
937 | local i c=1 command | |
938 | while [ $c -lt $COMP_CWORD ]; do | |
939 | i="${COMP_WORDS[c]}" | |
940 | case "$i" in | |
fb72759b | 941 | add|show|prune|update) command="$i"; break ;; |
88293c67 SP |
942 | esac |
943 | c=$((++c)) | |
944 | done | |
945 | ||
946 | if [ $c -eq $COMP_CWORD -a -z "$command" ]; then | |
fb72759b | 947 | __gitcomp "add show prune update" |
88293c67 SP |
948 | return |
949 | fi | |
950 | ||
951 | case "$command" in | |
952 | show|prune) | |
953 | __gitcomp "$(__git_remotes)" | |
954 | ;; | |
fb72759b SP |
955 | update) |
956 | local i c='' IFS=$'\n' | |
957 | for i in $(git --git-dir="$(__gitdir)" config --list); do | |
958 | case "$i" in | |
959 | remotes.*) | |
960 | i="${i#remotes.}" | |
961 | c="$c ${i/=*/}" | |
962 | ;; | |
963 | esac | |
964 | done | |
965 | __gitcomp "$c" | |
966 | ;; | |
88293c67 SP |
967 | *) |
968 | COMPREPLY=() | |
969 | ;; | |
970 | esac | |
971 | } | |
972 | ||
67e78c3b SP |
973 | _git_reset () |
974 | { | |
975 | local cur="${COMP_WORDS[COMP_CWORD]}" | |
b3391775 SP |
976 | case "$cur" in |
977 | --*) | |
978 | __gitcomp "--mixed --hard --soft" | |
979 | return | |
980 | ;; | |
981 | esac | |
982 | __gitcomp "$(__git_refs)" | |
67e78c3b SP |
983 | } |
984 | ||
1fd6bec9 SP |
985 | _git_shortlog () |
986 | { | |
987 | local cur="${COMP_WORDS[COMP_CWORD]}" | |
988 | case "$cur" in | |
989 | --*) | |
990 | __gitcomp " | |
991 | --max-count= --max-age= --since= --after= | |
992 | --min-age= --before= --until= | |
993 | --no-merges | |
994 | --author= --committer= --grep= | |
995 | --all-match | |
996 | --not --all | |
997 | --numbered --summary | |
998 | " | |
999 | return | |
1000 | ;; | |
1001 | esac | |
1002 | __git_complete_revlist | |
1003 | } | |
1004 | ||
90131924 SP |
1005 | _git_show () |
1006 | { | |
1007 | local cur="${COMP_WORDS[COMP_CWORD]}" | |
1008 | case "$cur" in | |
1009 | --pretty=*) | |
b3391775 | 1010 | __gitcomp " |
90131924 | 1011 | oneline short medium full fuller email raw |
b3391775 | 1012 | " "" "${cur##--pretty=}" |
90131924 SP |
1013 | return |
1014 | ;; | |
1015 | --*) | |
b3391775 | 1016 | __gitcomp "--pretty=" |
90131924 SP |
1017 | return |
1018 | ;; | |
1019 | esac | |
1020 | __git_complete_file | |
1021 | } | |
1022 | ||
7fd53fce JH |
1023 | _git_stash () |
1024 | { | |
1025 | __gitcomp 'list show apply clear' | |
1026 | } | |
1027 | ||
be86f7a0 SP |
1028 | _git_submodule () |
1029 | { | |
1030 | local i c=1 command | |
1031 | while [ $c -lt $COMP_CWORD ]; do | |
1032 | i="${COMP_WORDS[c]}" | |
1033 | case "$i" in | |
1034 | add|status|init|update) command="$i"; break ;; | |
1035 | esac | |
1036 | c=$((++c)) | |
1037 | done | |
1038 | ||
1039 | if [ $c -eq $COMP_CWORD -a -z "$command" ]; then | |
1040 | local cur="${COMP_WORDS[COMP_CWORD]}" | |
1041 | case "$cur" in | |
1042 | --*) | |
1043 | __gitcomp "--quiet --cached" | |
1044 | ;; | |
1045 | *) | |
1046 | __gitcomp "add status init update" | |
1047 | ;; | |
1048 | esac | |
1049 | return | |
1050 | fi | |
1051 | } | |
1052 | ||
690d8824 JH |
1053 | _git () |
1054 | { | |
873537fa SP |
1055 | local i c=1 command __git_dir |
1056 | ||
1057 | while [ $c -lt $COMP_CWORD ]; do | |
1058 | i="${COMP_WORDS[c]}" | |
1059 | case "$i" in | |
1060 | --git-dir=*) __git_dir="${i#--git-dir=}" ;; | |
1061 | --bare) __git_dir="." ;; | |
1062 | --version|--help|-p|--paginate) ;; | |
1063 | *) command="$i"; break ;; | |
1064 | esac | |
1065 | c=$((++c)) | |
1066 | done | |
1067 | ||
1068 | if [ $c -eq $COMP_CWORD -a -z "$command" ]; then | |
72e5e989 SP |
1069 | case "${COMP_WORDS[COMP_CWORD]}" in |
1070 | --*=*) COMPREPLY=() ;; | |
47e98eec SP |
1071 | --*) __gitcomp " |
1072 | --no-pager | |
1073 | --git-dir= | |
1074 | --bare | |
1075 | --version | |
1076 | --exec-path | |
1077 | " | |
1078 | ;; | |
72e5e989 SP |
1079 | *) __gitcomp "$(__git_commands) $(__git_aliases)" ;; |
1080 | esac | |
1081 | return | |
873537fa | 1082 | fi |
367dce2a | 1083 | |
873537fa SP |
1084 | local expansion=$(__git_aliased_command "$command") |
1085 | [ "$expansion" ] && command="$expansion" | |
367dce2a | 1086 | |
873537fa | 1087 | case "$command" in |
88329195 | 1088 | am) _git_am ;; |
8435b548 | 1089 | add) _git_add ;; |
88329195 | 1090 | apply) _git_apply ;; |
b2e69f62 | 1091 | bisect) _git_bisect ;; |
374a58c9 | 1092 | bundle) _git_bundle ;; |
873537fa | 1093 | branch) _git_branch ;; |
873537fa | 1094 | checkout) _git_checkout ;; |
d8a9fea5 | 1095 | cherry) _git_cherry ;; |
1273231e | 1096 | cherry-pick) _git_cherry_pick ;; |
4548e855 | 1097 | commit) _git_commit ;; |
e0d10e1c | 1098 | config) _git_config ;; |
217926c0 | 1099 | describe) _git_describe ;; |
873537fa | 1100 | diff) _git_diff ;; |
873537fa | 1101 | fetch) _git_fetch ;; |
f53352fb | 1102 | format-patch) _git_format_patch ;; |
b26c8748 | 1103 | gc) _git_gc ;; |
873537fa SP |
1104 | log) _git_log ;; |
1105 | ls-remote) _git_ls_remote ;; | |
1106 | ls-tree) _git_ls_tree ;; | |
4ad91321 | 1107 | merge) _git_merge;; |
873537fa | 1108 | merge-base) _git_merge_base ;; |
d33909bf | 1109 | name-rev) _git_name_rev ;; |
873537fa SP |
1110 | pull) _git_pull ;; |
1111 | push) _git_push ;; | |
61d926a3 | 1112 | rebase) _git_rebase ;; |
88293c67 | 1113 | remote) _git_remote ;; |
873537fa | 1114 | reset) _git_reset ;; |
1fd6bec9 | 1115 | shortlog) _git_shortlog ;; |
90131924 | 1116 | show) _git_show ;; |
873537fa | 1117 | show-branch) _git_log ;; |
7fd53fce | 1118 | stash) _git_stash ;; |
be86f7a0 | 1119 | submodule) _git_submodule ;; |
873537fa SP |
1120 | whatchanged) _git_log ;; |
1121 | *) COMPREPLY=() ;; | |
1122 | esac | |
690d8824 JH |
1123 | } |
1124 | ||
1125 | _gitk () | |
1126 | { | |
1127 | local cur="${COMP_WORDS[COMP_CWORD]}" | |
b3391775 SP |
1128 | case "$cur" in |
1129 | --*) | |
1130 | __gitcomp "--not --all" | |
1131 | return | |
1132 | ;; | |
1133 | esac | |
ec804891 | 1134 | __git_complete_revlist |
690d8824 JH |
1135 | } |
1136 | ||
1137 | complete -o default -o nospace -F _git git | |
b3391775 SP |
1138 | complete -o default -o nospace -F _gitk gitk |
1139 | complete -o default -o nospace -F _git_am git-am | |
1140 | complete -o default -o nospace -F _git_apply git-apply | |
b2e69f62 | 1141 | complete -o default -o nospace -F _git_bisect git-bisect |
b3391775 | 1142 | complete -o default -o nospace -F _git_branch git-branch |
374a58c9 | 1143 | complete -o default -o nospace -F _git_bundle git-bundle |
b3391775 | 1144 | complete -o default -o nospace -F _git_checkout git-checkout |
d8a9fea5 | 1145 | complete -o default -o nospace -F _git_cherry git-cherry |
b3391775 SP |
1146 | complete -o default -o nospace -F _git_cherry_pick git-cherry-pick |
1147 | complete -o default -o nospace -F _git_commit git-commit | |
217926c0 | 1148 | complete -o default -o nospace -F _git_describe git-describe |
690d8824 | 1149 | complete -o default -o nospace -F _git_diff git-diff |
690d8824 | 1150 | complete -o default -o nospace -F _git_fetch git-fetch |
f53352fb | 1151 | complete -o default -o nospace -F _git_format_patch git-format-patch |
b26c8748 | 1152 | complete -o default -o nospace -F _git_gc git-gc |
690d8824 | 1153 | complete -o default -o nospace -F _git_log git-log |
b3391775 | 1154 | complete -o default -o nospace -F _git_ls_remote git-ls-remote |
690d8824 | 1155 | complete -o default -o nospace -F _git_ls_tree git-ls-tree |
b3391775 SP |
1156 | complete -o default -o nospace -F _git_merge git-merge |
1157 | complete -o default -o nospace -F _git_merge_base git-merge-base | |
1158 | complete -o default -o nospace -F _git_name_rev git-name-rev | |
690d8824 JH |
1159 | complete -o default -o nospace -F _git_pull git-pull |
1160 | complete -o default -o nospace -F _git_push git-push | |
b3391775 SP |
1161 | complete -o default -o nospace -F _git_rebase git-rebase |
1162 | complete -o default -o nospace -F _git_config git-config | |
88293c67 | 1163 | complete -o default -o nospace -F _git_remote git-remote |
b3391775 | 1164 | complete -o default -o nospace -F _git_reset git-reset |
1fd6bec9 | 1165 | complete -o default -o nospace -F _git_shortlog git-shortlog |
90131924 | 1166 | complete -o default -o nospace -F _git_show git-show |
7fd53fce | 1167 | complete -o default -o nospace -F _git_stash git-stash |
be86f7a0 | 1168 | complete -o default -o nospace -F _git_submodule git-submodule |
144d33de | 1169 | complete -o default -o nospace -F _git_log git-show-branch |
690d8824 JH |
1170 | complete -o default -o nospace -F _git_log git-whatchanged |
1171 | ||
1172 | # The following are necessary only for Cygwin, and only are needed | |
1173 | # when the user has tab-completed the executable name and consequently | |
1174 | # included the '.exe' suffix. | |
1175 | # | |
76c3eb51 | 1176 | if [ Cygwin = "$(uname -o 2>/dev/null)" ]; then |
b3391775 SP |
1177 | complete -o default -o nospace -F _git_add git-add.exe |
1178 | complete -o default -o nospace -F _git_apply git-apply.exe | |
144d33de | 1179 | complete -o default -o nospace -F _git git.exe |
b3391775 | 1180 | complete -o default -o nospace -F _git_branch git-branch.exe |
374a58c9 | 1181 | complete -o default -o nospace -F _git_bundle git-bundle.exe |
d8a9fea5 | 1182 | complete -o default -o nospace -F _git_cherry git-cherry.exe |
217926c0 | 1183 | complete -o default -o nospace -F _git_describe git-describe.exe |
690d8824 | 1184 | complete -o default -o nospace -F _git_diff git-diff.exe |
f53352fb | 1185 | complete -o default -o nospace -F _git_format_patch git-format-patch.exe |
690d8824 JH |
1186 | complete -o default -o nospace -F _git_log git-log.exe |
1187 | complete -o default -o nospace -F _git_ls_tree git-ls-tree.exe | |
b3391775 SP |
1188 | complete -o default -o nospace -F _git_merge_base git-merge-base.exe |
1189 | complete -o default -o nospace -F _git_name_rev git-name-rev.exe | |
690d8824 | 1190 | complete -o default -o nospace -F _git_push git-push.exe |
b3391775 | 1191 | complete -o default -o nospace -F _git_config git-config |
1fd6bec9 | 1192 | complete -o default -o nospace -F _git_shortlog git-shortlog.exe |
90131924 | 1193 | complete -o default -o nospace -F _git_show git-show.exe |
144d33de | 1194 | complete -o default -o nospace -F _git_log git-show-branch.exe |
690d8824 | 1195 | complete -o default -o nospace -F _git_log git-whatchanged.exe |
76c3eb51 | 1196 | fi |