git-completion.bash 30.0 KB
Newer Older
1 2 3
#
# bash completion support for core Git.
#
4
# Copyright (C) 2006,2007 Shawn O. Pearce <spearce@spearce.org>
5
# Conceptually based on gitcompletion (http://gitweb.hawaga.org.uk/).
6
# Distributed under the GNU General Public License, version 2.0.
7 8 9 10 11 12 13 14
#
# The contained completion routines provide support for completing:
#
#    *) local and remote branch names
#    *) local and remote tag names
#    *) .git/remotes file names
#    *) git 'subcommands'
#    *) tree paths within 'ref:path/to/file' expressions
15
#    *) common --long-options
16 17 18 19 20 21 22
#
# To use these routines:
#
#    1) Copy this file to somewhere (e.g. ~/.git-completion.sh).
#    2) Added the following line to your .bashrc:
#        source ~/.git-completion.sh
#
23 24 25 26 27 28 29
#    3) You may want to make sure the git executable is available
#       in your PATH before this script is sourced, as some caching
#       is performed while the script loads.  If git isn't found
#       at source time then all lookups will be done on demand,
#       which may be slightly slower.
#
#    4) Consider changing your PS1 to also show the current branch:
30 31 32 33 34 35
#        PS1='[\u@\h \W$(__git_ps1 " (%s)")]\$ '
#
#       The argument to __git_ps1 will be displayed only if you
#       are currently in a git repository.  The %s token will be
#       the name of the current branch.
#
36 37 38 39 40 41 42 43 44 45 46
# To submit patches:
#
#    *) Read Documentation/SubmittingPatches
#    *) Send all patches to the current maintainer:
#
#       "Shawn O. Pearce" <spearce@spearce.org>
#
#    *) Always CC the Git mailing list:
#
#       git@vger.kernel.org
#
47

48 49 50 51 52
case "$COMP_WORDBREAKS" in
*:*) : great ;;
*)   COMP_WORDBREAKS="$COMP_WORDBREAKS:"
esac

53 54
__gitdir ()
{
55 56 57 58 59 60 61 62 63 64 65 66 67
	if [ -z "$1" ]; then
		if [ -n "$__git_dir" ]; then
			echo "$__git_dir"
		elif [ -d .git ]; then
			echo .git
		else
			git rev-parse --git-dir 2>/dev/null
		fi
	elif [ -d "$1/.git" ]; then
		echo "$1/.git"
	else
		echo "$1"
	fi
68 69
}

70 71
__git_ps1 ()
{
72 73 74 75
	local g="$(git rev-parse --git-dir 2>/dev/null)"
	if [ -n "$g" ]; then
		local r
		local b
76
		if [ -d "$g/rebase-apply" ]
77
		then
78
			if test -f "$g/rebase-apply/rebasing"
J
Junio C Hamano 已提交
79 80
			then
				r="|REBASE"
81
			elif test -f "$g/rebase-apply/applying"
J
Junio C Hamano 已提交
82 83 84 85 86
			then
				r="|AM"
			else
				r="|AM/REBASE"
			fi
87
			b="$(git symbolic-ref HEAD 2>/dev/null)"
88
		elif [ -f "$g/rebase-merge/interactive" ]
89 90
		then
			r="|REBASE-i"
91 92
			b="$(cat "$g/rebase-merge/head-name")"
		elif [ -d "$g/rebase-merge" ]
93 94
		then
			r="|REBASE-m"
95
			b="$(cat "$g/rebase-merge/head-name")"
96 97 98 99 100
		elif [ -f "$g/MERGE_HEAD" ]
		then
			r="|MERGING"
			b="$(git symbolic-ref HEAD 2>/dev/null)"
		else
101
			if [ -f "$g/BISECT_LOG" ]
102 103 104 105 106
			then
				r="|BISECTING"
			fi
			if ! b="$(git symbolic-ref HEAD 2>/dev/null)"
			then
107 108
				if ! b="$(git describe --exact-match HEAD 2>/dev/null)"
				then
109
					b="$(cut -c1-7 "$g/HEAD")..."
110
				fi
111 112 113
			fi
		fi

114
		if [ -n "$1" ]; then
115
			printf "$1" "${b##refs/heads/}$r"
116
		else
117
			printf " (%s)" "${b##refs/heads/}$r"
118 119 120 121
		fi
	fi
}

122 123 124 125 126 127 128 129 130 131 132 133
__gitcomp_1 ()
{
	local c IFS=' '$'\t'$'\n'
	for c in $1; do
		case "$c$2" in
		--*=*) printf %s$'\n' "$c$2" ;;
		*.)    printf %s$'\n' "$c$2" ;;
		*)     printf %s$'\n' "$c$2 " ;;
		esac
	done
}

134 135
__gitcomp ()
{
136
	local cur="${COMP_WORDS[COMP_CWORD]}"
137
	if [ $# -gt 2 ]; then
138 139
		cur="$3"
	fi
140 141 142 143 144
	case "$cur" in
	--*=)
		COMPREPLY=()
		;;
	*)
145 146 147 148
		local IFS=$'\n'
		COMPREPLY=($(compgen -P "$2" \
			-W "$(__gitcomp_1 "$1" "$4")" \
			-- "$cur"))
149 150
		;;
	esac
151 152
}

153 154
__git_heads ()
{
155
	local cmd i is_hash=y dir="$(__gitdir "$1")"
156 157 158 159 160 161 162 163
	if [ -d "$dir" ]; then
		for i in $(git --git-dir="$dir" \
			for-each-ref --format='%(refname)' \
			refs/heads ); do
			echo "${i#refs/heads/}"
		done
		return
	fi
164
	for i in $(git ls-remote "$1" 2>/dev/null); do
165 166 167 168 169 170 171 172 173
		case "$is_hash,$i" in
		y,*) is_hash=n ;;
		n,*^{}) is_hash=y ;;
		n,refs/heads/*) is_hash=y; echo "${i#refs/heads/}" ;;
		n,*) is_hash=y; echo "$i" ;;
		esac
	done
}

174 175 176 177 178 179 180 181 182 183 184
__git_tags ()
{
	local cmd i is_hash=y dir="$(__gitdir "$1")"
	if [ -d "$dir" ]; then
		for i in $(git --git-dir="$dir" \
			for-each-ref --format='%(refname)' \
			refs/tags ); do
			echo "${i#refs/tags/}"
		done
		return
	fi
185
	for i in $(git ls-remote "$1" 2>/dev/null); do
186 187 188 189 190 191 192 193 194
		case "$is_hash,$i" in
		y,*) is_hash=n ;;
		n,*^{}) is_hash=y ;;
		n,refs/tags/*) is_hash=y; echo "${i#refs/tags/}" ;;
		n,*) is_hash=y; echo "$i" ;;
		esac
	done
}

195 196
__git_refs ()
{
197
	local cmd i is_hash=y dir="$(__gitdir "$1")"
198
	if [ -d "$dir" ]; then
199 200 201 202 203 204 205 206 207 208 209 210
		if [ -e "$dir/HEAD" ]; then echo HEAD; fi
		for i in $(git --git-dir="$dir" \
			for-each-ref --format='%(refname)' \
			refs/tags refs/heads refs/remotes); do
			case "$i" in
				refs/tags/*)    echo "${i#refs/tags/}" ;;
				refs/heads/*)   echo "${i#refs/heads/}" ;;
				refs/remotes/*) echo "${i#refs/remotes/}" ;;
				*)              echo "$i" ;;
			esac
		done
		return
211
	fi
212
	for i in $(git ls-remote "$dir" 2>/dev/null); do
213 214 215 216 217
		case "$is_hash,$i" in
		y,*) is_hash=n ;;
		n,*^{}) is_hash=y ;;
		n,refs/tags/*) is_hash=y; echo "${i#refs/tags/}" ;;
		n,refs/heads/*) is_hash=y; echo "${i#refs/heads/}" ;;
218
		n,refs/remotes/*) is_hash=y; echo "${i#refs/remotes/}" ;;
219 220 221 222 223 224 225
		n,*) is_hash=y; echo "$i" ;;
		esac
	done
}

__git_refs2 ()
{
226 227 228
	local i
	for i in $(__git_refs "$1"); do
		echo "$i:$i"
229 230 231
	done
}

232 233 234
__git_refs_remotes ()
{
	local cmd i is_hash=y
235
	for i in $(git ls-remote "$1" 2>/dev/null); do
236 237 238 239 240 241 242 243 244 245 246 247 248
		case "$is_hash,$i" in
		n,refs/heads/*)
			is_hash=y
			echo "$i:refs/remotes/$1/${i#refs/heads/}"
			;;
		y,*) is_hash=n ;;
		n,*^{}) is_hash=y ;;
		n,refs/tags/*) is_hash=y;;
		n,*) is_hash=y; ;;
		esac
	done
}

249 250
__git_remotes ()
{
251
	local i ngoff IFS=$'\n' d="$(__gitdir)"
252
	shopt -q nullglob || ngoff=1
253
	shopt -s nullglob
254 255
	for i in "$d/remotes"/*; do
		echo ${i#$d/remotes/}
256
	done
257
	[ "$ngoff" ] && shopt -u nullglob
258
	for i in $(git --git-dir="$d" config --list); do
259 260 261 262 263 264 265
		case "$i" in
		remote.*.url=*)
			i="${i#remote.}"
			echo "${i/.url=*/}"
			;;
		esac
	done
266 267
}

268 269
__git_merge_strategies ()
{
270 271 272 273
	if [ -n "$__git_merge_strategylist" ]; then
		echo "$__git_merge_strategylist"
		return
	fi
274 275 276 277 278 279 280
	sed -n "/^all_strategies='/{
		s/^all_strategies='//
		s/'//
		p
		q
		}" "$(git --exec-path)/git-merge"
}
281 282
__git_merge_strategylist=
__git_merge_strategylist="$(__git_merge_strategies 2>/dev/null)"
283

284 285
__git_complete_file ()
{
286
	local pfx ls ref cur="${COMP_WORDS[COMP_CWORD]}"
287 288
	case "$cur" in
	?*:*)
289 290
		ref="${cur%%:*}"
		cur="${cur#*:}"
291 292
		case "$cur" in
		?*/*)
293 294
			pfx="${cur%/*}"
			cur="${cur##*/}"
295 296 297 298 299 300 301
			ls="$ref:$pfx"
			pfx="$pfx/"
			;;
		*)
			ls="$ref"
			;;
	    esac
302 303 304 305 306 307

		case "$COMP_WORDBREAKS" in
		*:*) : great ;;
		*)   pfx="$ref:$pfx" ;;
		esac

308
		local IFS=$'\n'
309
		COMPREPLY=($(compgen -P "$pfx" \
310
			-W "$(git --git-dir="$(__gitdir)" ls-tree "$ls" \
311 312 313 314 315 316 317 318
				| sed '/^100... blob /{
				           s,^.*	,,
				           s,$, ,
				       }
				       /^120000 blob /{
				           s,^.*	,,
				           s,$, ,
				       }
319 320 321 322 323 324 325 326
				       /^040000 tree /{
				           s,^.*	,,
				           s,$,/,
				       }
				       s/^.*	//')" \
			-- "$cur"))
		;;
	*)
327
		__gitcomp "$(__git_refs)"
328 329 330 331
		;;
	esac
}

332 333 334 335 336 337 338
__git_complete_revlist ()
{
	local pfx cur="${COMP_WORDS[COMP_CWORD]}"
	case "$cur" in
	*...*)
		pfx="${cur%...*}..."
		cur="${cur#*...}"
339
		__gitcomp "$(__git_refs)" "$pfx" "$cur"
340 341 342 343
		;;
	*..*)
		pfx="${cur%..*}.."
		cur="${cur#*..}"
344 345
		__gitcomp "$(__git_refs)" "$pfx" "$cur"
		;;
346
	*)
347
		__gitcomp "$(__git_refs)"
348 349 350 351
		;;
	esac
}

352
__git_all_commands ()
353
{
354 355
	if [ -n "$__git_all_commandlist" ]; then
		echo "$__git_all_commandlist"
356 357
		return
	fi
358 359
	local i IFS=" "$'\n'
	for i in $(git help -a|egrep '^ ')
360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377
	do
		case $i in
		*--*)             : helper pattern;;
		*) echo $i;;
		esac
	done
}
__git_all_commandlist=
__git_all_commandlist="$(__git_all_commands 2>/dev/null)"

__git_porcelain_commands ()
{
	if [ -n "$__git_porcelain_commandlist" ]; then
		echo "$__git_porcelain_commandlist"
		return
	fi
	local i IFS=" "$'\n'
	for i in "help" $(__git_all_commands)
378 379
	do
		case $i in
380
		*--*)             : helper pattern;;
381 382 383
		applymbox)        : ask gittus;;
		applypatch)       : ask gittus;;
		archimport)       : import;;
384
		cat-file)         : plumbing;;
385
		check-attr)       : plumbing;;
386 387
		check-ref-format) : plumbing;;
		commit-tree)      : plumbing;;
388 389
		cvsexportcommit)  : export;;
		cvsimport)        : import;;
390 391
		cvsserver)        : daemon;;
		daemon)           : daemon;;
392 393 394
		diff-files)       : plumbing;;
		diff-index)       : plumbing;;
		diff-tree)        : plumbing;;
S
Shawn O. Pearce 已提交
395
		fast-import)      : import;;
396
		fsck-objects)     : plumbing;;
397
		fetch-pack)       : plumbing;;
398
		fmt-merge-msg)    : plumbing;;
399
		for-each-ref)     : plumbing;;
400 401 402
		hash-object)      : plumbing;;
		http-*)           : transport;;
		index-pack)       : plumbing;;
403
		init-db)          : deprecated;;
404 405 406 407 408 409 410 411 412 413 414 415
		local-fetch)      : plumbing;;
		mailinfo)         : plumbing;;
		mailsplit)        : plumbing;;
		merge-*)          : plumbing;;
		mktree)           : plumbing;;
		mktag)            : plumbing;;
		pack-objects)     : plumbing;;
		pack-redundant)   : plumbing;;
		pack-refs)        : plumbing;;
		parse-remote)     : plumbing;;
		patch-id)         : plumbing;;
		peek-remote)      : plumbing;;
416 417 418
		prune)            : plumbing;;
		prune-packed)     : plumbing;;
		quiltimport)      : import;;
419 420
		read-tree)        : plumbing;;
		receive-pack)     : plumbing;;
421
		reflog)           : plumbing;;
422
		repo-config)      : deprecated;;
423 424 425 426 427 428 429 430 431 432 433
		rerere)           : plumbing;;
		rev-list)         : plumbing;;
		rev-parse)        : plumbing;;
		runstatus)        : plumbing;;
		sh-setup)         : internal;;
		shell)            : daemon;;
		send-pack)        : plumbing;;
		show-index)       : plumbing;;
		ssh-*)            : transport;;
		stripspace)       : plumbing;;
		symbolic-ref)     : plumbing;;
434
		tar-tree)         : deprecated;;
435 436
		unpack-file)      : plumbing;;
		unpack-objects)   : plumbing;;
437
		update-index)     : plumbing;;
438 439 440 441 442
		update-ref)       : plumbing;;
		update-server-info) : daemon;;
		upload-archive)   : plumbing;;
		upload-pack)      : plumbing;;
		write-tree)       : plumbing;;
443
		verify-tag)       : plumbing;;
444 445 446 447
		*) echo $i;;
		esac
	done
}
448 449
__git_porcelain_commandlist=
__git_porcelain_commandlist="$(__git_porcelain_commands 2>/dev/null)"
450

451 452
__git_aliases ()
{
453
	local i IFS=$'\n'
454
	for i in $(git --git-dir="$(__gitdir)" config --list); do
455 456 457 458 459 460 461
		case "$i" in
		alias.*)
			i="${i#alias.}"
			echo "${i/=*/}"
			;;
		esac
	done
462 463 464 465
}

__git_aliased_command ()
{
466
	local word cmdline=$(git --git-dir="$(__gitdir)" \
467
		config --get "alias.$1")
468 469 470 471 472 473 474 475
	for word in $cmdline; do
		if [ "${word##-*}" ]; then
			echo $word
			return
		fi
	done
}

476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491
__git_find_subcommand ()
{
	local word subcommand c=1

	while [ $c -lt $COMP_CWORD ]; do
		word="${COMP_WORDS[c]}"
		for subcommand in $1; do
			if [ "$subcommand" = "$word" ]; then
				echo "$subcommand"
				return
			fi
		done
		c=$((++c))
	done
}

492 493 494 495 496 497 498 499 500 501 502 503
__git_has_doubledash ()
{
	local c=1
	while [ $c -lt $COMP_CWORD ]; do
		if [ "--" = "${COMP_WORDS[c]}" ]; then
			return 0
		fi
		c=$((++c))
	done
	return 1
}

504 505 506 507
__git_whitespacelist="nowarn warn error error-all strip"

_git_am ()
{
508
	local cur="${COMP_WORDS[COMP_CWORD]}" dir="$(__gitdir)"
509
	if [ -d "$dir"/rebase-apply ]; then
510
		__gitcomp "--skip --resolved --abort"
511 512 513 514
		return
	fi
	case "$cur" in
	--whitespace=*)
515
		__gitcomp "$__git_whitespacelist" "" "${cur##--whitespace=}"
516 517 518
		return
		;;
	--*)
519
		__gitcomp "
520 521
			--signoff --utf8 --binary --3way --interactive
			--whitespace=
522
			"
523 524 525 526 527 528 529 530 531 532
		return
	esac
	COMPREPLY=()
}

_git_apply ()
{
	local cur="${COMP_WORDS[COMP_CWORD]}"
	case "$cur" in
	--whitespace=*)
533
		__gitcomp "$__git_whitespacelist" "" "${cur##--whitespace=}"
534 535 536
		return
		;;
	--*)
537
		__gitcomp "
538 539 540 541
			--stat --numstat --summary --check --index
			--cached --index-info --reverse --reject --unidiff-zero
			--apply --no-add --exclude=
			--whitespace= --inaccurate-eof --verbose
542
			"
543 544 545 546 547
		return
	esac
	COMPREPLY=()
}

548 549
_git_add ()
{
550 551
	__git_has_doubledash && return

552 553 554
	local cur="${COMP_WORDS[COMP_CWORD]}"
	case "$cur" in
	--*)
555 556 557 558
		__gitcomp "
			--interactive --refresh --patch --update --dry-run
			--ignore-errors
			"
559 560 561 562 563
		return
	esac
	COMPREPLY=()
}

564 565
_git_bisect ()
{
566 567
	__git_has_doubledash && return

568
	local subcommands="start bad good skip reset visualize replay log run"
569 570 571
	local subcommand="$(__git_find_subcommand "$subcommands")"
	if [ -z "$subcommand" ]; then
		__gitcomp "$subcommands"
572 573 574
		return
	fi

575
	case "$subcommand" in
576
	bad|good|reset|skip)
577 578 579 580 581 582 583 584
		__gitcomp "$(__git_refs)"
		;;
	*)
		COMPREPLY=()
		;;
	esac
}

585 586
_git_branch ()
{
587 588 589 590 591 592 593 594 595 596 597
	local i c=1 only_local_ref="n" has_r="n"

	while [ $c -lt $COMP_CWORD ]; do
		i="${COMP_WORDS[c]}"
		case "$i" in
		-d|-m)	only_local_ref="y" ;;
		-r)	has_r="y" ;;
		esac
		c=$((++c))
	done

S
SZEDER Gábor 已提交
598 599 600 601 602
	case "${COMP_WORDS[COMP_CWORD]}" in
	--*=*)	COMPREPLY=() ;;
	--*)
		__gitcomp "
			--color --no-color --verbose --abbrev= --no-abbrev
603
			--track --no-track --contains --merged --no-merged
S
SZEDER Gábor 已提交
604 605
			"
		;;
606 607 608 609 610 611 612
	*)
		if [ $only_local_ref = "y" -a $has_r = "n" ]; then
			__gitcomp "$(__git_heads)"
		else
			__gitcomp "$(__git_refs)"
		fi
		;;
S
SZEDER Gábor 已提交
613
	esac
614 615
}

616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644
_git_bundle ()
{
	local mycword="$COMP_CWORD"
	case "${COMP_WORDS[0]}" in
	git)
		local cmd="${COMP_WORDS[2]}"
		mycword="$((mycword-1))"
		;;
	git-bundle*)
		local cmd="${COMP_WORDS[1]}"
		;;
	esac
	case "$mycword" in
	1)
		__gitcomp "create list-heads verify unbundle"
		;;
	2)
		# looking for a file
		;;
	*)
		case "$cmd" in
			create)
				__git_complete_revlist
			;;
		esac
		;;
	esac
}

645 646
_git_checkout ()
{
647 648
	__git_has_doubledash && return

649
	__gitcomp "$(__git_refs)"
650 651
}

652 653 654 655 656
_git_cherry ()
{
	__gitcomp "$(__git_refs)"
}

657 658 659 660 661
_git_cherry_pick ()
{
	local cur="${COMP_WORDS[COMP_CWORD]}"
	case "$cur" in
	--*)
662
		__gitcomp "--edit --no-commit"
663 664
		;;
	*)
665
		__gitcomp "$(__git_refs)"
666 667 668 669
		;;
	esac
}

670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694
_git_clone ()
{
	local cur="${COMP_WORDS[COMP_CWORD]}"
	case "$cur" in
	--*)
		__gitcomp "
			--local
			--no-hardlinks
			--shared
			--reference
			--quiet
			--no-checkout
			--bare
			--mirror
			--origin
			--upload-pack
			--template=
			--depth
			"
		return
		;;
	esac
	COMPREPLY=()
}

695 696
_git_commit ()
{
697 698
	__git_has_doubledash && return

699 700 701
	local cur="${COMP_WORDS[COMP_CWORD]}"
	case "$cur" in
	--*)
702
		__gitcomp "
703 704
			--all --author= --signoff --verify --no-verify
			--edit --amend --include --only
705
			"
706 707 708 709 710
		return
	esac
	COMPREPLY=()
}

711 712
_git_describe ()
{
713 714 715 716 717 718 719 720 721
	local cur="${COMP_WORDS[COMP_CWORD]}"
	case "$cur" in
	--*)
		__gitcomp "
			--all --tags --contains --abbrev= --candidates=
			--exact-match --debug --long --match --always
			"
		return
	esac
722 723 724
	__gitcomp "$(__git_refs)"
}

725 726
_git_diff ()
{
727 728
	__git_has_doubledash && return

729 730 731 732 733 734 735 736 737 738
	local cur="${COMP_WORDS[COMP_CWORD]}"
	case "$cur" in
	--*)
		__gitcomp "--cached --stat --numstat --shortstat --summary
			--patch-with-stat --name-only --name-status --color
			--no-color --color-words --no-renames --check
			--full-index --binary --abbrev --diff-filter
			--find-copies-harder --pickaxe-all --pickaxe-regex
			--text --ignore-space-at-eol --ignore-space-change
			--ignore-all-space --exit-code --quiet --ext-diff
739 740
			--no-ext-diff
			--no-prefix --src-prefix= --dst-prefix=
741
			--base --ours --theirs
742
			"
743 744 745
		return
		;;
	esac
746 747 748 749 750 751 752 753 754
	__git_complete_file
}

_git_fetch ()
{
	local cur="${COMP_WORDS[COMP_CWORD]}"

	case "${COMP_WORDS[0]},$COMP_CWORD" in
	git-fetch*,1)
755
		__gitcomp "$(__git_remotes)"
756 757
		;;
	git,2)
758
		__gitcomp "$(__git_remotes)"
759 760 761 762
		;;
	*)
		case "$cur" in
		*:*)
763 764 765 766 767 768
			local pfx=""
			case "$COMP_WORDBREAKS" in
			*:*) : great ;;
			*)   pfx="${cur%%:*}:" ;;
			esac
			__gitcomp "$(__git_refs)" "$pfx" "${cur#*:}"
769 770 771 772 773 774 775
			;;
		*)
			local remote
			case "${COMP_WORDS[0]}" in
			git-fetch) remote="${COMP_WORDS[1]}" ;;
			git)       remote="${COMP_WORDS[2]}" ;;
			esac
776
			__gitcomp "$(__git_refs2 "$remote")"
777 778 779 780 781 782
			;;
		esac
		;;
	esac
}

783 784 785 786 787
_git_format_patch ()
{
	local cur="${COMP_WORDS[COMP_CWORD]}"
	case "$cur" in
	--*)
788
		__gitcomp "
789 790 791
			--stdout --attach --thread
			--output-directory
			--numbered --start-number
792
			--numbered-files
793 794 795 796
			--keep-subject
			--signoff
			--in-reply-to=
			--full-index --binary
797
			--not --all
798
			--cover-letter
799
			--no-prefix --src-prefix= --dst-prefix=
800
			"
801 802 803 804 805 806
		return
		;;
	esac
	__git_complete_revlist
}

807 808 809 810 811
_git_gc ()
{
	local cur="${COMP_WORDS[COMP_CWORD]}"
	case "$cur" in
	--*)
812
		__gitcomp "--prune --aggressive"
813 814 815 816 817 818
		return
		;;
	esac
	COMPREPLY=()
}

819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841
_git_grep ()
{
	__git_has_doubledash && return

	local cur="${COMP_WORDS[COMP_CWORD]}"
	case "$cur" in
	--*)
		__gitcomp "
			--cached
			--text --ignore-case --word-regexp --invert-match
			--full-name
			--extended-regexp --basic-regexp --fixed-strings
			--files-with-matches --name-only
			--files-without-match
			--count
			--and --or --not --all-match
			"
		return
		;;
	esac
	COMPREPLY=()
}

842 843 844 845 846 847 848 849 850 851 852 853
_git_help ()
{
	local cur="${COMP_WORDS[COMP_CWORD]}"
	case "$cur" in
	--*)
		__gitcomp "--all --info --man --web"
		return
		;;
	esac
	__gitcomp "$(__git_all_commands)"
}

854 855
_git_ls_remote ()
{
856
	__gitcomp "$(__git_remotes)"
857 858 859 860 861 862 863 864 865
}

_git_ls_tree ()
{
	__git_complete_file
}

_git_log ()
{
866 867
	__git_has_doubledash && return

868 869 870
	local cur="${COMP_WORDS[COMP_CWORD]}"
	case "$cur" in
	--pretty=*)
871
		__gitcomp "
872
			oneline short medium full fuller email raw
873
			" "" "${cur##--pretty=}"
874 875
		return
		;;
876 877 878 879 880 881
	--date=*)
		__gitcomp "
			relative iso8601 rfc2822 short local default
		" "" "${cur##--date=}"
		return
		;;
882
	--*)
883
		__gitcomp "
884 885
			--max-count= --max-age= --since= --after=
			--min-age= --before= --until=
886
			--root --topo-order --date-order --reverse
887
			--no-merges --follow
888
			--abbrev-commit --abbrev=
889
			--relative-date --date=
890 891
			--author= --committer= --grep=
			--all-match
892
			--pretty= --name-status --name-only --raw
893
			--not --all
894
			--left-right --cherry-pick
895
			--graph
896 897 898
			--stat --numstat --shortstat
			--decorate --diff-filter=
			--color-words --walk-reflogs
899
			--parents --children --full-history
900
			"
901 902 903
		return
		;;
	esac
904
	__git_complete_revlist
905 906
}

907 908 909
_git_merge ()
{
	local cur="${COMP_WORDS[COMP_CWORD]}"
910 911
	case "${COMP_WORDS[COMP_CWORD-1]}" in
	-s|--strategy)
912
		__gitcomp "$(__git_merge_strategies)"
913 914
		return
	esac
915
	case "$cur" in
916
	--strategy=*)
917
		__gitcomp "$(__git_merge_strategies)" "" "${cur##--strategy=}"
918 919
		return
		;;
920
	--*)
921
		__gitcomp "
922
			--no-commit --no-stat --log --no-log --squash --strategy
923
			"
924 925
		return
	esac
926
	__gitcomp "$(__git_refs)"
927 928
}

929 930
_git_merge_base ()
{
931
	__gitcomp "$(__git_refs)"
932 933
}

934 935
_git_name_rev ()
{
936
	__gitcomp "--tags --all --stdin"
937 938
}

939 940 941 942 943 944
_git_pull ()
{
	local cur="${COMP_WORDS[COMP_CWORD]}"

	case "${COMP_WORDS[0]},$COMP_CWORD" in
	git-pull*,1)
945
		__gitcomp "$(__git_remotes)"
946 947
		;;
	git,2)
948
		__gitcomp "$(__git_remotes)"
949 950 951 952 953 954 955
		;;
	*)
		local remote
		case "${COMP_WORDS[0]}" in
		git-pull)  remote="${COMP_WORDS[1]}" ;;
		git)       remote="${COMP_WORDS[2]}" ;;
		esac
956
		__gitcomp "$(__git_refs "$remote")"
957 958 959 960 961 962 963 964 965 966
		;;
	esac
}

_git_push ()
{
	local cur="${COMP_WORDS[COMP_CWORD]}"

	case "${COMP_WORDS[0]},$COMP_CWORD" in
	git-push*,1)
967
		__gitcomp "$(__git_remotes)"
968 969
		;;
	git,2)
970
		__gitcomp "$(__git_remotes)"
971 972 973 974 975 976 977 978 979
		;;
	*)
		case "$cur" in
		*:*)
			local remote
			case "${COMP_WORDS[0]}" in
			git-push)  remote="${COMP_WORDS[1]}" ;;
			git)       remote="${COMP_WORDS[2]}" ;;
			esac
980 981 982 983 984 985 986 987

			local pfx=""
			case "$COMP_WORDBREAKS" in
			*:*) : great ;;
			*)   pfx="${cur%%:*}:" ;;
			esac

			__gitcomp "$(__git_refs "$remote")" "$pfx" "${cur#*:}"
988
			;;
989 990 991
		+*)
			__gitcomp "$(__git_refs)" + "${cur#+}"
			;;
992
		*)
993
			__gitcomp "$(__git_refs)"
994 995 996 997 998 999
			;;
		esac
		;;
	esac
}

1000 1001
_git_rebase ()
{
1002
	local cur="${COMP_WORDS[COMP_CWORD]}" dir="$(__gitdir)"
1003
	if [ -d "$dir"/rebase-apply ] || [ -d "$dir"/rebase-merge ]; then
1004
		__gitcomp "--continue --skip --abort"
1005 1006
		return
	fi
1007 1008
	case "${COMP_WORDS[COMP_CWORD-1]}" in
	-s|--strategy)
1009
		__gitcomp "$(__git_merge_strategies)"
1010 1011
		return
	esac
1012
	case "$cur" in
1013
	--strategy=*)
1014
		__gitcomp "$(__git_merge_strategies)" "" "${cur##--strategy=}"
1015 1016
		return
		;;
1017
	--*)
1018
		__gitcomp "--onto --merge --strategy --interactive"
1019 1020
		return
	esac
1021
	__gitcomp "$(__git_refs)"
1022 1023
}

1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041
_git_send_email ()
{
	local cur="${COMP_WORDS[COMP_CWORD]}"
	case "$cur" in
	--*)
		__gitcomp "--bcc --cc --cc-cmd --chain-reply-to --compose
			--dry-run --envelope-sender --from --identity
			--in-reply-to --no-chain-reply-to --no-signed-off-by-cc
			--no-suppress-from --no-thread --quiet
			--signed-off-by-cc --smtp-pass --smtp-server
			--smtp-server-port --smtp-ssl --smtp-user --subject
			--suppress-cc --suppress-from --thread --to"
		return
		;;
	esac
	COMPREPLY=()
}

1042
_git_config ()
1043 1044 1045 1046 1047
{
	local cur="${COMP_WORDS[COMP_CWORD]}"
	local prv="${COMP_WORDS[COMP_CWORD-1]}"
	case "$prv" in
	branch.*.remote)
1048
		__gitcomp "$(__git_remotes)"
1049 1050 1051
		return
		;;
	branch.*.merge)
1052
		__gitcomp "$(__git_refs)"
1053 1054 1055 1056 1057
		return
		;;
	remote.*.fetch)
		local remote="${prv#remote.}"
		remote="${remote%.fetch}"
1058
		__gitcomp "$(__git_refs_remotes "$remote")"
1059 1060 1061 1062 1063
		return
		;;
	remote.*.push)
		local remote="${prv#remote.}"
		remote="${remote%.push}"
1064
		__gitcomp "$(git --git-dir="$(__gitdir)" \
1065
			for-each-ref --format='%(refname):%(refname)' \
1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081
			refs/heads)"
		return
		;;
	pull.twohead|pull.octopus)
		__gitcomp "$(__git_merge_strategies)"
		return
		;;
	color.branch|color.diff|color.status)
		__gitcomp "always never auto"
		return
		;;
	color.*.*)
		__gitcomp "
			black red green yellow blue magenta cyan white
			bold dim ul blink reverse
			"
1082 1083 1084 1085 1086 1087 1088 1089 1090
		return
		;;
	*.*)
		COMPREPLY=()
		return
		;;
	esac
	case "$cur" in
	--*)
1091
		__gitcomp "
1092
			--global --system --file=
1093
			--list --replace-all
1094
			--get --get-all --get-regexp
1095
			--add --unset --unset-all
1096
			--remove-section --rename-section
1097
			"
1098 1099 1100 1101 1102
		return
		;;
	branch.*.*)
		local pfx="${cur%.*}."
		cur="${cur##*.}"
1103
		__gitcomp "remote merge" "$pfx" "$cur"
1104 1105 1106 1107 1108
		return
		;;
	branch.*)
		local pfx="${cur%.*}."
		cur="${cur#*.}"
1109
		__gitcomp "$(__git_heads)" "$pfx" "$cur" "."
1110 1111 1112 1113 1114
		return
		;;
	remote.*.*)
		local pfx="${cur%.*}."
		cur="${cur##*.}"
1115 1116 1117 1118
		__gitcomp "
			url fetch push skipDefaultUpdate
			receivepack uploadpack tagopt
			" "$pfx" "$cur"
1119 1120 1121 1122 1123
		return
		;;
	remote.*)
		local pfx="${cur%.*}."
		cur="${cur#*.}"
1124
		__gitcomp "$(__git_remotes)" "$pfx" "$cur" "."
1125 1126 1127
		return
		;;
	esac
1128
	__gitcomp "
1129 1130 1131 1132 1133 1134
		apply.whitespace
		core.fileMode
		core.gitProxy
		core.ignoreStat
		core.preferSymlinkRefs
		core.logAllRefUpdates
1135
		core.loosecompression
1136 1137 1138 1139
		core.repositoryFormatVersion
		core.sharedRepository
		core.warnAmbiguousRefs
		core.compression
1140 1141
		core.packedGitWindowSize
		core.packedGitLimit
1142
		clean.requireForce
1143 1144 1145 1146 1147
		color.branch
		color.branch.current
		color.branch.local
		color.branch.remote
		color.branch.plain
1148
		color.diff
1149 1150 1151 1152 1153 1154 1155
		color.diff.plain
		color.diff.meta
		color.diff.frag
		color.diff.old
		color.diff.new
		color.diff.commit
		color.diff.whitespace
1156 1157
		color.pager
		color.status
1158 1159 1160 1161 1162 1163 1164 1165
		color.status.header
		color.status.added
		color.status.changed
		color.status.untracked
		diff.renameLimit
		diff.renames
		fetch.unpackLimit
		format.headers
1166
		format.subjectprefix
1167 1168
		gitcvs.enabled
		gitcvs.logfile
1169
		gitcvs.allbinary
1170 1171
		gitcvs.dbname gitcvs.dbdriver gitcvs.dbuser gitcvs.dbpass
		gitcvs.dbtablenameprefix
1172
		gc.packrefs
1173 1174 1175 1176
		gc.reflogexpire
		gc.reflogexpireunreachable
		gc.rerereresolved
		gc.rerereunresolved
1177 1178 1179 1180 1181 1182
		http.sslVerify
		http.sslCert
		http.sslKey
		http.sslCAInfo
		http.sslCAPath
		http.maxRequests
1183 1184
		http.lowSpeedLimit
		http.lowSpeedTime
1185
		http.noEPSV
1186 1187 1188
		i18n.commitEncoding
		i18n.logOutputEncoding
		log.showroot
1189
		merge.tool
1190 1191
		merge.summary
		merge.verbosity
1192
		pack.window
1193
		pack.depth
1194 1195 1196 1197
		pack.windowMemory
		pack.compression
		pack.deltaCacheSize
		pack.deltaCacheLimit
1198 1199
		pull.octopus
		pull.twohead
1200
		repack.useDeltaBaseOffset
1201 1202 1203
		showbranch.default
		tar.umask
		transfer.unpackLimit
1204 1205
		receive.unpackLimit
		receive.denyNonFastForwards
1206 1207 1208
		user.name
		user.email
		user.signingkey
1209
		branch. remote.
1210
	"
1211 1212
}

1213 1214
_git_remote ()
{
1215 1216 1217
	local subcommands="add rm show prune update"
	local subcommand="$(__git_find_subcommand "$subcommands")"
	if [ -z "$subcommand" ]; then
1218
		__gitcomp "$subcommands"
1219 1220 1221
		return
	fi

1222
	case "$subcommand" in
1223
	rm|show|prune)
1224 1225
		__gitcomp "$(__git_remotes)"
		;;
1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237
	update)
		local i c='' IFS=$'\n'
		for i in $(git --git-dir="$(__gitdir)" config --list); do
			case "$i" in
			remotes.*)
				i="${i#remotes.}"
				c="$c ${i/=*/}"
				;;
			esac
		done
		__gitcomp "$c"
		;;
1238 1239 1240 1241 1242 1243
	*)
		COMPREPLY=()
		;;
	esac
}

1244 1245
_git_reset ()
{
1246 1247
	__git_has_doubledash && return

1248
	local cur="${COMP_WORDS[COMP_CWORD]}"
1249 1250 1251 1252 1253 1254 1255
	case "$cur" in
	--*)
		__gitcomp "--mixed --hard --soft"
		return
		;;
	esac
	__gitcomp "$(__git_refs)"
1256 1257
}

1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271
_git_rm ()
{
	__git_has_doubledash && return

	local cur="${COMP_WORDS[COMP_CWORD]}"
	case "$cur" in
	--*)
		__gitcomp "--cached --dry-run --ignore-unmatch --quiet"
		return
		;;
	esac
	COMPREPLY=()
}

1272 1273
_git_shortlog ()
{
1274 1275
	__git_has_doubledash && return

1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293
	local cur="${COMP_WORDS[COMP_CWORD]}"
	case "$cur" in
	--*)
		__gitcomp "
			--max-count= --max-age= --since= --after=
			--min-age= --before= --until=
			--no-merges
			--author= --committer= --grep=
			--all-match
			--not --all
			--numbered --summary
			"
		return
		;;
	esac
	__git_complete_revlist
}

1294 1295 1296 1297 1298
_git_show ()
{
	local cur="${COMP_WORDS[COMP_CWORD]}"
	case "$cur" in
	--pretty=*)
1299
		__gitcomp "
1300
			oneline short medium full fuller email raw
1301
			" "" "${cur##--pretty=}"
1302 1303 1304
		return
		;;
	--*)
1305
		__gitcomp "--pretty="
1306 1307 1308 1309 1310 1311
		return
		;;
	esac
	__git_complete_file
}

1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327
_git_show_branch ()
{
	local cur="${COMP_WORDS[COMP_CWORD]}"
	case "$cur" in
	--*)
		__gitcomp "
			--all --remotes --topo-order --current --more=
			--list --independent --merge-base --no-name
			--sha1-name --topics --reflog
			"
		return
		;;
	esac
	__git_complete_revlist
}

J
Junio C Hamano 已提交
1328 1329
_git_stash ()
{
1330
	local subcommands='save list show apply clear drop pop create'
1331 1332
	local subcommand="$(__git_find_subcommand "$subcommands")"
	if [ -z "$subcommand" ]; then
1333
		__gitcomp "$subcommands"
1334 1335 1336 1337 1338 1339 1340 1341 1342 1343
	else
		local cur="${COMP_WORDS[COMP_CWORD]}"
		case "$subcommand,$cur" in
		save,--*)
			__gitcomp "--keep-index"
			;;
		*)
			COMPREPLY=()
			;;
		esac
1344
	fi
J
Junio C Hamano 已提交
1345 1346
}

1347 1348
_git_submodule ()
{
1349 1350
	__git_has_doubledash && return

1351 1352
	local subcommands="add status init update"
	if [ -z "$(__git_find_subcommand "$subcommands")" ]; then
1353 1354 1355 1356 1357 1358
		local cur="${COMP_WORDS[COMP_CWORD]}"
		case "$cur" in
		--*)
			__gitcomp "--quiet --cached"
			;;
		*)
1359
			__gitcomp "$subcommands"
1360 1361 1362 1363 1364 1365
			;;
		esac
		return
	fi
}

1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443
_git_svn ()
{
	local subcommands="
		init fetch clone rebase dcommit log find-rev
		set-tree commit-diff info create-ignore propget
		proplist show-ignore show-externals
		"
	local subcommand="$(__git_find_subcommand "$subcommands")"
	if [ -z "$subcommand" ]; then
		__gitcomp "$subcommands"
	else
		local remote_opts="--username= --config-dir= --no-auth-cache"
		local fc_opts="
			--follow-parent --authors-file= --repack=
			--no-metadata --use-svm-props --use-svnsync-props
			--log-window-size= --no-checkout --quiet
			--repack-flags --user-log-author $remote_opts
			"
		local init_opts="
			--template= --shared= --trunk= --tags=
			--branches= --stdlayout --minimize-url
			--no-metadata --use-svm-props --use-svnsync-props
			--rewrite-root= $remote_opts
			"
		local cmt_opts="
			--edit --rmdir --find-copies-harder --copy-similarity=
			"

		local cur="${COMP_WORDS[COMP_CWORD]}"
		case "$subcommand,$cur" in
		fetch,--*)
			__gitcomp "--revision= --fetch-all $fc_opts"
			;;
		clone,--*)
			__gitcomp "--revision= $fc_opts $init_opts"
			;;
		init,--*)
			__gitcomp "$init_opts"
			;;
		dcommit,--*)
			__gitcomp "
				--merge --strategy= --verbose --dry-run
				--fetch-all --no-rebase $cmt_opts $fc_opts
				"
			;;
		set-tree,--*)
			__gitcomp "--stdin $cmt_opts $fc_opts"
			;;
		create-ignore,--*|propget,--*|proplist,--*|show-ignore,--*|\
		show-externals,--*)
			__gitcomp "--revision="
			;;
		log,--*)
			__gitcomp "
				--limit= --revision= --verbose --incremental
				--oneline --show-commit --non-recursive
				--authors-file=
				"
			;;
		rebase,--*)
			__gitcomp "
				--merge --verbose --strategy= --local
				--fetch-all $fc_opts
				"
			;;
		commit-diff,--*)
			__gitcomp "--message= --file= --revision= $cmt_opts"
			;;
		info,--*)
			__gitcomp "--url"
			;;
		*)
			COMPREPLY=()
			;;
		esac
	fi
}

1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477
_git_tag ()
{
	local i c=1 f=0
	while [ $c -lt $COMP_CWORD ]; do
		i="${COMP_WORDS[c]}"
		case "$i" in
		-d|-v)
			__gitcomp "$(__git_tags)"
			return
			;;
		-f)
			f=1
			;;
		esac
		c=$((++c))
	done

	case "${COMP_WORDS[COMP_CWORD-1]}" in
	-m|-F)
		COMPREPLY=()
		;;
	-*|tag|git-tag)
		if [ $f = 1 ]; then
			__gitcomp "$(__git_tags)"
		else
			COMPREPLY=()
		fi
		;;
	*)
		__gitcomp "$(__git_refs)"
		;;
	esac
}

1478 1479
_git ()
{
1480 1481 1482 1483 1484 1485 1486
	local i c=1 command __git_dir

	while [ $c -lt $COMP_CWORD ]; do
		i="${COMP_WORDS[c]}"
		case "$i" in
		--git-dir=*) __git_dir="${i#--git-dir=}" ;;
		--bare)      __git_dir="." ;;
1487 1488
		--version|-p|--paginate) ;;
		--help) command="help"; break ;;
1489 1490 1491 1492 1493
		*) command="$i"; break ;;
		esac
		c=$((++c))
	done

1494
	if [ -z "$command" ]; then
1495 1496
		case "${COMP_WORDS[COMP_CWORD]}" in
		--*=*) COMPREPLY=() ;;
1497
		--*)   __gitcomp "
1498
			--paginate
1499 1500 1501 1502 1503
			--no-pager
			--git-dir=
			--bare
			--version
			--exec-path
1504 1505
			--work-tree=
			--help
1506 1507
			"
			;;
1508
		*)     __gitcomp "$(__git_porcelain_commands) $(__git_aliases)" ;;
1509 1510
		esac
		return
1511
	fi
1512

1513 1514
	local expansion=$(__git_aliased_command "$command")
	[ "$expansion" ] && command="$expansion"
1515

1516
	case "$command" in
1517
	am)          _git_am ;;
1518
	add)         _git_add ;;
1519
	apply)       _git_apply ;;
1520
	bisect)      _git_bisect ;;
1521
	bundle)      _git_bundle ;;
1522 1523
	branch)      _git_branch ;;
	checkout)    _git_checkout ;;
1524
	cherry)      _git_cherry ;;
1525
	cherry-pick) _git_cherry_pick ;;
1526
	clone)       _git_clone ;;
1527
	commit)      _git_commit ;;
1528
	config)      _git_config ;;
1529
	describe)    _git_describe ;;
1530 1531
	diff)        _git_diff ;;
	fetch)       _git_fetch ;;
1532
	format-patch) _git_format_patch ;;
1533
	gc)          _git_gc ;;
1534
	grep)        _git_grep ;;
1535
	help)        _git_help ;;
1536 1537 1538
	log)         _git_log ;;
	ls-remote)   _git_ls_remote ;;
	ls-tree)     _git_ls_tree ;;
1539
	merge)       _git_merge;;
1540
	merge-base)  _git_merge_base ;;
1541
	name-rev)    _git_name_rev ;;
1542 1543
	pull)        _git_pull ;;
	push)        _git_push ;;
1544
	rebase)      _git_rebase ;;
1545
	remote)      _git_remote ;;
1546
	reset)       _git_reset ;;
1547
	rm)          _git_rm ;;
1548
	send-email)  _git_send_email ;;
1549
	shortlog)    _git_shortlog ;;
1550
	show)        _git_show ;;
1551
	show-branch) _git_show_branch ;;
J
Junio C Hamano 已提交
1552
	stash)       _git_stash ;;
1553
	submodule)   _git_submodule ;;
1554
	svn)         _git_svn ;;
1555
	tag)         _git_tag ;;
1556 1557 1558
	whatchanged) _git_log ;;
	*)           COMPREPLY=() ;;
	esac
1559 1560 1561 1562
}

_gitk ()
{
1563 1564
	__git_has_doubledash && return

1565
	local cur="${COMP_WORDS[COMP_CWORD]}"
1566 1567 1568 1569 1570
	local g="$(git rev-parse --git-dir 2>/dev/null)"
	local merge=""
	if [ -f $g/MERGE_HEAD ]; then
		merge="--merge"
	fi
1571 1572
	case "$cur" in
	--*)
1573
		__gitcomp "--not --all $merge"
1574 1575 1576
		return
		;;
	esac
1577
	__git_complete_revlist
1578 1579 1580
}

complete -o default -o nospace -F _git git
1581
complete -o default -o nospace -F _gitk gitk
1582 1583 1584 1585 1586

# The following are necessary only for Cygwin, and only are needed
# when the user has tab-completed the executable name and consequently
# included the '.exe' suffix.
#
1587
if [ Cygwin = "$(uname -o 2>/dev/null)" ]; then
1588
complete -o default -o nospace -F _git git.exe
1589
fi