3 # bash completion support for core Git.
5 # Copyright (C) 2006,2007 Shawn O. Pearce <spearce@spearce.org>
6 # Conceptually based on gitcompletion (http://gitweb.hawaga.org.uk/).
7 # Distributed under the GNU General Public License, version 2.0.
9 # The contained completion routines provide support for completing:
11 # *) local and remote branch names
12 # *) local and remote tag names
13 # *) .git/remotes file names
14 # *) git 'subcommands'
15 # *) tree paths within 'ref:path/to/file' expressions
16 # *) common --long-options
18 # To use these routines:
20 # 1) Copy this file to somewhere (e.g. ~/.git-completion.sh).
21 # 2) Added the following line to your .bashrc:
22 # source ~/.git-completion.sh
24 # Or, add the following lines to your .zshrc:
25 # autoload bashcompinit
27 # source ~/.git-completion.sh
29 # 3) Consider changing your PS1 to also show the current branch:
30 # PS1='[\u@\h \W$(__git_ps1 " (%s)")]\$ '
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.
36 # In addition, if you set GIT_PS1_SHOWDIRTYSTATE to a nonempty
37 # value, unstaged (*) and staged (+) changes will be shown next
38 # to the branch name. You can configure this per-repository
39 # with the bash.showDirtyState variable, which defaults to true
40 # once GIT_PS1_SHOWDIRTYSTATE is enabled.
42 # You can also see if currently something is stashed, by setting
43 # GIT_PS1_SHOWSTASHSTATE to a nonempty value. If something is stashed,
44 # then a '$' will be shown next to the branch name.
46 # If you would like to see if there're untracked files, then you can
47 # set GIT_PS1_SHOWUNTRACKEDFILES to a nonempty value. If there're
48 # untracked files, then a '%' will be shown next to the branch name.
50 # If you would like to see the difference between HEAD and its
51 # upstream, set GIT_PS1_SHOWUPSTREAM="auto". A "<" indicates
52 # you are behind, ">" indicates you are ahead, and "<>"
53 # indicates you have diverged. You can further control
54 # behaviour by setting GIT_PS1_SHOWUPSTREAM to a space-separated
56 # verbose show number of commits ahead/behind (+/-) upstream
57 # legacy don't use the '--count' option available in recent
58 # versions of git-rev-list
59 # git always compare HEAD to @{upstream}
60 # svn always compare HEAD to your SVN upstream
61 # By default, __git_ps1 will compare HEAD to your SVN upstream
62 # if it can find one, or @{upstream} otherwise. Once you have
63 # set GIT_PS1_SHOWUPSTREAM, you can override it on a
64 # per-repository basis by setting the bash.showUpstream config
70 # *) Read Documentation/SubmittingPatches
71 # *) Send all patches to the current maintainer:
73 # "Shawn O. Pearce" <spearce@spearce.org>
75 # *) Always CC the Git mailing list:
80 case "$COMP_WORDBREAKS" in
82 *) COMP_WORDBREAKS
="$COMP_WORDBREAKS:"
85 # __gitdir accepts 0 or 1 arguments (i.e., location)
86 # returns location of .git repo
89 if [ -z "${1-}" ]; then
90 if [ -n "${__git_dir-}" ]; then
92 elif [ -d .git
]; then
95 git rev-parse
--git-dir 2>/dev
/null
97 elif [ -d "$1/.git" ]; then
104 # stores the divergence from upstream in $p
105 # used by GIT_PS1_SHOWUPSTREAM
106 __git_ps1_show_upstream
()
109 local svn_remote
=() svn_url_pattern count n
110 local upstream
=git legacy
="" verbose
=""
112 # get some config options from git-config
113 while read key value
; do
116 GIT_PS1_SHOWUPSTREAM
="$value"
117 if [[ -z "${GIT_PS1_SHOWUPSTREAM}" ]]; then
123 svn_remote
[ $
((${#svn_remote[@]} + 1)) ]="$value"
124 svn_url_pattern
+="\\|$value"
125 upstream
=svn
+git
# default upstream is SVN if available, else git
128 done < <(git config
-z --get-regexp '^(svn-remote\..*\.url|bash\.showupstream)$' 2>/dev
/null |
tr '\0\n' '\n ')
130 # parse configuration values
131 for option
in ${GIT_PS1_SHOWUPSTREAM}; do
133 git|svn
) upstream
="$option" ;;
134 verbose
) verbose
=1 ;;
141 git
) upstream
="@{upstream}" ;;
143 # get the upstream from the "git-svn-id: ..." in a commit message
144 # (git-svn uses essentially the same procedure internally)
145 local svn_upstream
=($
(git log
--first-parent -1 \
146 --grep="^git-svn-id: \(${svn_url_pattern#??}\)" 2>/dev
/null
))
147 if [[ 0 -ne ${#svn_upstream[@]} ]]; then
148 svn_upstream
=${svn_upstream[ ${#svn_upstream[@]} - 2 ]}
149 svn_upstream
=${svn_upstream%@*}
150 local n_stop
="${#svn_remote[@]}"
151 for ((n
=1; n
<= n_stop
; ++n
)); do
152 svn_upstream
=${svn_upstream#${svn_remote[$n]}}
155 if [[ -z "$svn_upstream" ]]; then
156 # default branch name for checkouts with no layout:
157 upstream
=${GIT_SVN_ID:-git-svn}
159 upstream
=${svn_upstream#/}
161 elif [[ "svn+git" = "$upstream" ]]; then
162 upstream
="@{upstream}"
167 # Find how many commits we are ahead/behind our upstream
168 if [[ -z "$legacy" ]]; then
169 count
="$(git rev-list --count --left-right \
170 "$upstream"...HEAD 2>/dev/null)"
172 # produce equivalent output to --count for older versions of git
174 if commits
="$(git rev-list --left-right "$upstream"...HEAD 2>/dev/null)"
176 local commit behind
=0 ahead
=0
177 for commit
in $commits
186 count
="$behind $ahead"
192 # calculate the result
193 if [[ -z "$verbose" ]]; then
197 "0 0") # equal to upstream
199 "0 "*) # ahead of upstream
201 *" 0") # behind upstream
203 *) # diverged from upstream
210 "0 0") # equal to upstream
212 "0 "*) # ahead of upstream
213 p
=" u+${count#0 }" ;;
214 *" 0") # behind upstream
215 p
=" u-${count% 0}" ;;
216 *) # diverged from upstream
217 p
=" u+${count#* }-${count% *}" ;;
224 # __git_ps1 accepts 0 or 1 arguments (i.e., format string)
225 # returns text to add to bash PS1 prompt (includes branch name)
228 local g
="$(__gitdir)"
232 if [ -f "$g/rebase-merge/interactive" ]; then
234 b
="$(cat "$g/rebase-merge
/head-name
")"
235 elif [ -d "$g/rebase-merge" ]; then
237 b
="$(cat "$g/rebase-merge
/head-name
")"
239 if [ -d "$g/rebase-apply" ]; then
240 if [ -f "$g/rebase-apply/rebasing" ]; then
242 elif [ -f "$g/rebase-apply/applying" ]; then
247 elif [ -f "$g/MERGE_HEAD" ]; then
249 elif [ -f "$g/BISECT_LOG" ]; then
253 b
="$(git symbolic-ref HEAD 2>/dev/null)" ||
{
256 case "${GIT_PS1_DESCRIBE_STYLE-}" in
258 git describe --contains HEAD ;;
260 git describe --contains --all HEAD ;;
264 git describe --tags --exact-match HEAD ;;
265 esac 2>/dev/null)" ||
267 b
="$(cut -c1-7 "$g/HEAD
" 2>/dev/null)..." ||
280 if [ "true" = "$(git rev-parse --is-inside-git-dir 2>/dev/null)" ]; then
281 if [ "true" = "$(git rev-parse --is-bare-repository 2>/dev/null)" ]; then
286 elif [ "true" = "$(git rev-parse --is-inside-work-tree 2>/dev/null)" ]; then
287 if [ -n "${GIT_PS1_SHOWDIRTYSTATE-}" ]; then
288 if [ "$(git config --bool bash.showDirtyState)" != "false" ]; then
289 git
diff --no-ext-diff --quiet --exit-code || w
="*"
290 if git rev-parse
--quiet --verify HEAD
>/dev
/null
; then
291 git diff-index
--cached --quiet HEAD
-- || i
="+"
297 if [ -n "${GIT_PS1_SHOWSTASHSTATE-}" ]; then
298 git rev-parse
--verify refs
/stash
>/dev
/null
2>&1 && s
="$"
301 if [ -n "${GIT_PS1_SHOWUNTRACKEDFILES-}" ]; then
302 if [ -n "$(git ls-files --others --exclude-standard)" ]; then
307 if [ -n "${GIT_PS1_SHOWUPSTREAM-}" ]; then
308 __git_ps1_show_upstream
313 printf "${1:- (%s)}" "$c${b##refs/heads/}${f:+ $f}$r$p"
317 # __gitcomp_1 requires 2 arguments
320 local c IFS
=' '$
'\t'$
'\n'
323 --*=*) printf %s$
'\n' "$c$2" ;;
324 *.
) printf %s$
'\n' "$c$2" ;;
325 *) printf %s$
'\n' "$c$2 " ;;
330 # __gitcomp accepts 1, 2, 3, or 4 arguments
331 # generates completion reply with compgen
334 local cur
="${COMP_WORDS[COMP_CWORD]}"
335 if [ $# -gt 2 ]; then
344 COMPREPLY
=($
(compgen
-P "${2-}" \
345 -W "$(__gitcomp_1 "${1-}" "${4-}")" \
351 # __git_heads accepts 0 or 1 arguments (to pass to __gitdir)
354 local cmd i is_hash
=y dir
="$(__gitdir "${1-}")"
355 if [ -d "$dir" ]; then
356 git
--git-dir="$dir" for-each-ref
--format='%(refname:short)' \
360 for i
in $
(git ls-remote
"${1-}" 2>/dev
/null
); do
361 case "$is_hash,$i" in
364 n
,refs
/heads
/*) is_hash
=y
; echo "${i#refs/heads/}" ;;
365 n
,*) is_hash
=y
; echo "$i" ;;
370 # __git_tags accepts 0 or 1 arguments (to pass to __gitdir)
373 local cmd i is_hash
=y dir
="$(__gitdir "${1-}")"
374 if [ -d "$dir" ]; then
375 git
--git-dir="$dir" for-each-ref
--format='%(refname:short)' \
379 for i
in $
(git ls-remote
"${1-}" 2>/dev
/null
); do
380 case "$is_hash,$i" in
383 n
,refs
/tags
/*) is_hash
=y
; echo "${i#refs/tags/}" ;;
384 n
,*) is_hash
=y
; echo "$i" ;;
389 # __git_refs accepts 0, 1 (to pass to __gitdir), or 2 arguments
390 # presence of 2nd argument means use the guess heuristic employed
391 # by checkout for tracking branches
394 local i is_hash
=y dir
="$(__gitdir "${1-}")" track
="${2-}"
395 local cur
="${COMP_WORDS[COMP_CWORD]}" format refs
396 if [ -d "$dir" ]; then
404 for i
in HEAD FETCH_HEAD ORIG_HEAD MERGE_HEAD
; do
405 if [ -e "$dir/$i" ]; then echo $i; fi
407 format
="refname:short"
408 refs
="refs/tags refs/heads refs/remotes"
411 git
--git-dir="$dir" for-each-ref
--format="%($format)" \
413 if [ -n "$track" ]; then
414 # employ the heuristic used by git checkout
415 # Try to find a remote branch that matches the completion word
416 # but only output if the branch name is unique
418 git
--git-dir="$dir" for-each-ref
--shell --format="ref=%(refname:short)" \
423 if [[ "$ref" == "$cur"* ]]; then
430 for i
in $
(git ls-remote
"$dir" 2>/dev
/null
); do
431 case "$is_hash,$i" in
434 n
,refs
/tags
/*) is_hash
=y
; echo "${i#refs/tags/}" ;;
435 n
,refs
/heads
/*) is_hash
=y
; echo "${i#refs/heads/}" ;;
436 n
,refs
/remotes
/*) is_hash
=y
; echo "${i#refs/remotes/}" ;;
437 n
,*) is_hash
=y
; echo "$i" ;;
442 # __git_refs2 requires 1 argument (to pass to __git_refs)
446 for i
in $
(__git_refs
"$1"); do
451 # __git_refs_remotes requires 1 argument (to pass to ls-remote)
452 __git_refs_remotes
()
454 local cmd i is_hash
=y
455 for i
in $
(git ls-remote
"$1" 2>/dev
/null
); do
456 case "$is_hash,$i" in
459 echo "$i:refs/remotes/$1/${i#refs/heads/}"
463 n
,refs
/tags
/*) is_hash
=y
;;
471 local i ngoff IFS
=$
'\n' d
="$(__gitdir)"
472 shopt -q nullglob || ngoff
=1
474 for i
in "$d/remotes"/*; do
475 echo ${i#$d/remotes/}
477 [ "$ngoff" ] && shopt -u nullglob
478 for i
in $
(git
--git-dir="$d" config
--get-regexp 'remote\..*\.url' 2>/dev
/null
); do
484 __git_list_merge_strategies
()
486 git merge
-s help 2>&1 |
487 sed -n -e '/[Aa]vailable strategies are: /,/^$/{
496 __git_merge_strategies
=
497 # 'git merge -s help' (and thus detection of the merge strategy
498 # list) fails, unfortunately, if run outside of any git working
499 # tree. __git_merge_strategies is set to the empty string in
500 # that case, and the detection will be repeated the next time it
502 __git_compute_merge_strategies
()
504 : ${__git_merge_strategies:=$(__git_list_merge_strategies)}
507 __git_complete_file
()
509 local pfx
ls ref cur
="${COMP_WORDS[COMP_CWORD]}"
526 case "$COMP_WORDBREAKS" in
528 *) pfx
="$ref:$pfx" ;;
532 COMPREPLY
=($
(compgen
-P "$pfx" \
533 -W "$(git --git-dir="$
(__gitdir
)" ls-tree "$ls" \
534 | sed '/^100... blob /{
550 __gitcomp
"$(__git_refs)"
555 __git_complete_revlist
()
557 local pfx cur
="${COMP_WORDS[COMP_CWORD]}"
562 __gitcomp
"$(__git_refs)" "$pfx" "$cur"
567 __gitcomp
"$(__git_refs)" "$pfx" "$cur"
570 __gitcomp
"$(__git_refs)"
575 __git_complete_remote_or_refspec
()
577 local cmd
="${COMP_WORDS[1]}"
578 local cur
="${COMP_WORDS[COMP_CWORD]}"
579 local i c
=2 remote
="" pfx
="" lhs
=1 no_complete_refspec
=0
580 while [ $c -lt $COMP_CWORD ]; do
583 --mirror) [ "$cmd" = "push" ] && no_complete_refspec
=1 ;;
586 push
) no_complete_refspec
=1 ;;
595 *) remote
="$i"; break ;;
599 if [ -z "$remote" ]; then
600 __gitcomp
"$(__git_remotes)"
603 if [ $no_complete_refspec = 1 ]; then
607 [ "$remote" = "." ] && remote
=
610 case "$COMP_WORDBREAKS" in
612 *) pfx
="${cur%%:*}:" ;;
624 if [ $lhs = 1 ]; then
625 __gitcomp
"$(__git_refs2 "$remote")" "$pfx" "$cur"
627 __gitcomp
"$(__git_refs)" "$pfx" "$cur"
631 if [ $lhs = 1 ]; then
632 __gitcomp
"$(__git_refs "$remote")" "$pfx" "$cur"
634 __gitcomp
"$(__git_refs)" "$pfx" "$cur"
638 if [ $lhs = 1 ]; then
639 __gitcomp
"$(__git_refs)" "$pfx" "$cur"
641 __gitcomp
"$(__git_refs "$remote")" "$pfx" "$cur"
647 __git_complete_strategy
()
649 __git_compute_merge_strategies
650 case "${COMP_WORDS[COMP_CWORD-1]}" in
652 __gitcomp
"$__git_merge_strategies"
655 local cur
="${COMP_WORDS[COMP_CWORD]}"
658 __gitcomp
"$__git_merge_strategies" "" "${cur##--strategy=}"
665 __git_list_all_commands
()
668 for i
in $
(git
help -a|
egrep '^ [a-zA-Z0-9]')
671 *--*) : helper pattern
;;
678 __git_compute_all_commands
()
680 : ${__git_all_commands:=$(__git_list_all_commands)}
683 __git_list_porcelain_commands
()
686 __git_compute_all_commands
687 for i
in "help" $__git_all_commands
690 *--*) : helper pattern
;;
691 applymbox
) : ask gittus
;;
692 applypatch
) : ask gittus
;;
693 archimport
) : import
;;
694 cat-file
) : plumbing
;;
695 check-attr
) : plumbing
;;
696 check-ref-format
) : plumbing
;;
697 checkout-index
) : plumbing
;;
698 commit-tree
) : plumbing
;;
699 count-objects
) : infrequent
;;
700 cvsexportcommit
) : export;;
701 cvsimport
) : import
;;
702 cvsserver
) : daemon
;;
704 diff-files
) : plumbing
;;
705 diff-index
) : plumbing
;;
706 diff-tree
) : plumbing
;;
707 fast-import
) : import
;;
708 fast-export
) : export;;
709 fsck-objects
) : plumbing
;;
710 fetch-pack
) : plumbing
;;
711 fmt-merge-msg
) : plumbing
;;
712 for-each-ref
) : plumbing
;;
713 hash-object
) : plumbing
;;
714 http-
*) : transport
;;
715 index-pack
) : plumbing
;;
716 init-db
) : deprecated
;;
717 local-fetch
) : plumbing
;;
718 lost-found
) : infrequent
;;
719 ls-files
) : plumbing
;;
720 ls-remote
) : plumbing
;;
721 ls-tree
) : plumbing
;;
722 mailinfo
) : plumbing
;;
723 mailsplit
) : plumbing
;;
724 merge-
*) : plumbing
;;
727 pack-objects
) : plumbing
;;
728 pack-redundant
) : plumbing
;;
729 pack-refs
) : plumbing
;;
730 parse-remote
) : plumbing
;;
731 patch-id
) : plumbing
;;
732 peek-remote
) : plumbing
;;
734 prune-packed
) : plumbing
;;
735 quiltimport
) : import
;;
736 read-tree
) : plumbing
;;
737 receive-pack
) : plumbing
;;
738 remote-
*) : transport
;;
739 repo-config
) : deprecated
;;
741 rev-list
) : plumbing
;;
742 rev-parse
) : plumbing
;;
743 runstatus
) : plumbing
;;
744 sh-setup
) : internal
;;
746 show-ref
) : plumbing
;;
747 send-pack
) : plumbing
;;
748 show-index
) : plumbing
;;
750 stripspace
) : plumbing
;;
751 symbolic-ref
) : plumbing
;;
752 tar-tree
) : deprecated
;;
753 unpack-file
) : plumbing
;;
754 unpack-objects
) : plumbing
;;
755 update-index
) : plumbing
;;
756 update-ref
) : plumbing
;;
757 update-server-info
) : daemon
;;
758 upload-archive
) : plumbing
;;
759 upload-pack
) : plumbing
;;
760 write-tree
) : plumbing
;;
762 verify-pack
) : infrequent
;;
763 verify-tag
) : plumbing
;;
769 __git_porcelain_commands
=
770 __git_compute_porcelain_commands
()
772 __git_compute_all_commands
773 : ${__git_porcelain_commands:=$(__git_list_porcelain_commands)}
776 __git_pretty_aliases
()
779 for i
in $
(git
--git-dir="$(__gitdir)" config
--get-regexp "pretty\..*" 2>/dev
/null
); do
792 for i
in $
(git
--git-dir="$(__gitdir)" config
--get-regexp "alias\..*" 2>/dev
/null
); do
802 # __git_aliased_command requires 1 argument
803 __git_aliased_command
()
805 local word cmdline
=$
(git
--git-dir="$(__gitdir)" \
806 config
--get "alias.$1")
807 for word
in $cmdline; do
813 \
!*) : shell
command alias ;;
815 *=*) : setting env
;;
824 # __git_find_on_cmdline requires 1 argument
825 __git_find_on_cmdline
()
827 local word subcommand c
=1
829 while [ $c -lt $COMP_CWORD ]; do
830 word
="${COMP_WORDS[c]}"
831 for subcommand
in $1; do
832 if [ "$subcommand" = "$word" ]; then
841 __git_has_doubledash
()
844 while [ $c -lt $COMP_CWORD ]; do
845 if [ "--" = "${COMP_WORDS[c]}" ]; then
853 __git_whitespacelist
="nowarn warn error error-all fix"
857 local cur
="${COMP_WORDS[COMP_CWORD]}" dir
="$(__gitdir)"
858 if [ -d "$dir"/rebase-apply
]; then
859 __gitcomp
"--skip --continue --resolved --abort"
864 __gitcomp
"$__git_whitespacelist" "" "${cur##--whitespace=}"
869 --3way --committer-date-is-author-date --ignore-date
870 --ignore-whitespace --ignore-space-change
871 --interactive --keep --no-utf8 --signoff --utf8
872 --whitespace= --scissors
881 local cur
="${COMP_WORDS[COMP_CWORD]}"
884 __gitcomp
"$__git_whitespacelist" "" "${cur##--whitespace=}"
889 --stat --numstat --summary --check --index
890 --cached --index-info --reverse --reject --unidiff-zero
891 --apply --no-add --exclude=
892 --ignore-whitespace --ignore-space-change
893 --whitespace= --inaccurate-eof --verbose
902 __git_has_doubledash
&& return
904 local cur
="${COMP_WORDS[COMP_CWORD]}"
908 --interactive --refresh --patch --update --dry-run
909 --ignore-errors --intent-to-add
918 local cur
="${COMP_WORDS[COMP_CWORD]}"
921 __gitcomp
"$(git archive --list)" "" "${cur##--format=}"
925 __gitcomp
"$(__git_remotes)" "" "${cur##--remote=}"
930 --format= --list --verbose
931 --prefix= --remote= --exec=
941 __git_has_doubledash
&& return
943 local subcommands
="start bad good skip reset visualize replay log run"
944 local subcommand
="$(__git_find_on_cmdline "$subcommands")"
945 if [ -z "$subcommand" ]; then
946 if [ -f "$(__gitdir)"/BISECT_START
]; then
947 __gitcomp
"$subcommands"
949 __gitcomp
"replay start"
954 case "$subcommand" in
955 bad|good|
reset|skip|start
)
956 __gitcomp
"$(__git_refs)"
966 local i c
=1 only_local_ref
="n" has_r
="n"
968 while [ $c -lt $COMP_CWORD ]; do
971 -d|
-m) only_local_ref
="y" ;;
977 case "${COMP_WORDS[COMP_CWORD]}" in
980 --color --no-color --verbose --abbrev= --no-abbrev
981 --track --no-track --contains --merged --no-merged
986 if [ $only_local_ref = "y" -a $has_r = "n" ]; then
987 __gitcomp
"$(__git_heads)"
989 __gitcomp
"$(__git_refs)"
997 local cmd
="${COMP_WORDS[2]}"
998 case "$COMP_CWORD" in
1000 __gitcomp
"create list-heads verify unbundle"
1003 # looking for a file
1008 __git_complete_revlist
1017 __git_has_doubledash
&& return
1019 local cur
="${COMP_WORDS[COMP_CWORD]}"
1022 __gitcomp
"diff3 merge" "" "${cur##--conflict=}"
1026 --quiet --ours --theirs --track --no-track --merge
1027 --conflict= --orphan --patch
1031 # check if --track, --no-track, or --no-guess was specified
1032 # if so, disable DWIM mode
1033 local flags
="--track --no-track --no-guess" track
=1
1034 if [ -n "$(__git_find_on_cmdline "$flags")" ]; then
1037 __gitcomp
"$(__git_refs '' $track)"
1044 __gitcomp
"$(__git_refs)"
1049 local cur
="${COMP_WORDS[COMP_CWORD]}"
1052 __gitcomp
"--edit --no-commit"
1055 __gitcomp
"$(__git_refs)"
1062 __git_has_doubledash
&& return
1064 local cur
="${COMP_WORDS[COMP_CWORD]}"
1067 __gitcomp
"--dry-run --quiet"
1076 local cur
="${COMP_WORDS[COMP_CWORD]}"
1101 __git_has_doubledash
&& return
1103 local cur
="${COMP_WORDS[COMP_CWORD]}"
1106 __gitcomp
"default strip verbatim whitespace
1107 " "" "${cur##--cleanup=}"
1111 __gitcomp
"$(__git_refs)" "" "${cur##--reuse-message=}"
1115 __gitcomp
"$(__git_refs)" "" "${cur##--reedit-message=}"
1118 --untracked-files=*)
1119 __gitcomp
"all no normal" "" "${cur##--untracked-files=}"
1124 --all --author= --signoff --verify --no-verify
1125 --edit --amend --include --only --interactive
1126 --dry-run --reuse-message= --reedit-message=
1127 --reset-author --file= --message= --template=
1128 --cleanup= --untracked-files --untracked-files=
1138 local cur
="${COMP_WORDS[COMP_CWORD]}"
1142 --all --tags --contains --abbrev= --candidates=
1143 --exact-match --debug --long --match --always
1147 __gitcomp
"$(__git_refs)"
1150 __git_diff_common_options
="--stat --numstat --shortstat --summary
1151 --patch-with-stat --name-only --name-status --color
1152 --no-color --color-words --no-renames --check
1153 --full-index --binary --abbrev --diff-filter=
1154 --find-copies-harder
1155 --text --ignore-space-at-eol --ignore-space-change
1156 --ignore-all-space --exit-code --quiet --ext-diff
1158 --no-prefix --src-prefix= --dst-prefix=
1159 --inter-hunk-context=
1162 --dirstat --dirstat= --dirstat-by-file
1163 --dirstat-by-file= --cumulative
1168 __git_has_doubledash
&& return
1170 local cur
="${COMP_WORDS[COMP_CWORD]}"
1173 __gitcomp
"--cached --staged --pickaxe-all --pickaxe-regex
1174 --base --ours --theirs --no-index
1175 $__git_diff_common_options
1183 __git_mergetools_common
="diffuse ecmerge emerge kdiff3 meld opendiff
1184 tkdiff vimdiff gvimdiff xxdiff araxis p4merge
1189 __git_has_doubledash
&& return
1191 local cur
="${COMP_WORDS[COMP_CWORD]}"
1194 __gitcomp
"$__git_mergetools_common kompare" "" "${cur##--tool=}"
1198 __gitcomp
"--cached --staged --pickaxe-all --pickaxe-regex
1199 --base --ours --theirs
1200 --no-renames --diff-filter= --find-copies-harder
1201 --relative --ignore-submodules
1209 __git_fetch_options
="
1210 --quiet --verbose --append --upload-pack --force --keep --depth=
1211 --tags --no-tags --all --prune --dry-run
1216 local cur
="${COMP_WORDS[COMP_CWORD]}"
1219 __gitcomp
"$__git_fetch_options"
1223 __git_complete_remote_or_refspec
1226 _git_format_patch
()
1228 local cur
="${COMP_WORDS[COMP_CWORD]}"
1233 " "" "${cur##--thread=}"
1238 --stdout --attach --no-attach --thread --thread=
1240 --numbered --start-number
1243 --signoff --signature --no-signature
1244 --in-reply-to= --cc=
1245 --full-index --binary
1248 --no-prefix --src-prefix= --dst-prefix=
1249 --inline --suffix= --ignore-if-in-upstream
1255 __git_complete_revlist
1260 local cur
="${COMP_WORDS[COMP_CWORD]}"
1264 --tags --root --unreachable --cache --no-reflogs --full
1265 --strict --verbose --lost-found
1275 local cur
="${COMP_WORDS[COMP_CWORD]}"
1278 __gitcomp
"--prune --aggressive"
1292 __git_has_doubledash
&& return
1294 local cur
="${COMP_WORDS[COMP_CWORD]}"
1299 --text --ignore-case --word-regexp --invert-match
1301 --extended-regexp --basic-regexp --fixed-strings
1302 --files-with-matches --name-only
1303 --files-without-match
1306 --and --or --not --all-match
1312 __gitcomp
"$(__git_refs)"
1317 local cur
="${COMP_WORDS[COMP_CWORD]}"
1320 __gitcomp
"--all --info --man --web"
1324 __git_compute_all_commands
1325 __gitcomp
"$__git_all_commands
1326 attributes cli core-tutorial cvs-migration
1327 diffcore gitk glossary hooks ignore modules
1328 repository-layout tutorial tutorial-2
1335 local cur
="${COMP_WORDS[COMP_CWORD]}"
1339 false true umask group all world everybody
1340 " "" "${cur##--shared=}"
1344 __gitcomp
"--quiet --bare --template= --shared --shared="
1353 __git_has_doubledash
&& return
1355 local cur
="${COMP_WORDS[COMP_CWORD]}"
1358 __gitcomp
"--cached --deleted --modified --others --ignored
1359 --stage --directory --no-empty-directory --unmerged
1360 --killed --exclude= --exclude-from=
1361 --exclude-per-directory= --exclude-standard
1362 --error-unmatch --with-tree= --full-name
1363 --abbrev --ignored --exclude-per-directory
1373 __gitcomp
"$(__git_remotes)"
1381 # Options that go well for log, shortlog and gitk
1382 __git_log_common_options
="
1384 --branches --tags --remotes
1385 --first-parent --merges --no-merges
1387 --max-age= --since= --after=
1388 --min-age= --until= --before=
1390 # Options that go well for log and gitk (not shortlog)
1391 __git_log_gitk_options
="
1392 --dense --sparse --full-history
1393 --simplify-merges --simplify-by-decoration
1396 # Options that go well for log and shortlog (not gitk)
1397 __git_log_shortlog_options
="
1398 --author= --committer= --grep=
1402 __git_log_pretty_formats
="oneline short medium full fuller email raw format:"
1403 __git_log_date_formats
="relative iso8601 rfc2822 short local default raw"
1407 __git_has_doubledash
&& return
1409 local cur
="${COMP_WORDS[COMP_CWORD]}"
1410 local g
="$(git rev-parse --git-dir 2>/dev/null)"
1412 if [ -f "$g/MERGE_HEAD" ]; then
1417 __gitcomp
"$__git_log_pretty_formats $(__git_pretty_aliases)
1418 " "" "${cur##--pretty=}"
1422 __gitcomp
"$__git_log_pretty_formats $(__git_pretty_aliases)
1423 " "" "${cur##--format=}"
1427 __gitcomp
"$__git_log_date_formats" "" "${cur##--date=}"
1431 __gitcomp
"long short" "" "${cur##--decorate=}"
1436 $__git_log_common_options
1437 $__git_log_shortlog_options
1438 $__git_log_gitk_options
1439 --root --topo-order --date-order --reverse
1440 --follow --full-diff
1441 --abbrev-commit --abbrev=
1442 --relative-date --date=
1443 --pretty= --format= --oneline
1446 --decorate --decorate=
1448 --parents --children
1450 $__git_diff_common_options
1451 --pickaxe-all --pickaxe-regex
1456 __git_complete_revlist
1459 __git_merge_options
="
1460 --no-commit --no-stat --log --no-log --squash --strategy
1461 --commit --stat --no-squash --ff --no-ff --ff-only
1466 __git_complete_strategy
&& return
1468 local cur
="${COMP_WORDS[COMP_CWORD]}"
1471 __gitcomp
"$__git_merge_options"
1474 __gitcomp
"$(__git_refs)"
1479 local cur
="${COMP_WORDS[COMP_CWORD]}"
1482 __gitcomp
"$__git_mergetools_common tortoisemerge" "" "${cur##--tool=}"
1495 __gitcomp
"$(__git_refs)"
1500 local cur
="${COMP_WORDS[COMP_CWORD]}"
1503 __gitcomp
"--dry-run"
1512 __gitcomp
"--tags --all --stdin"
1517 local subcommands
='add append copy edit list prune remove show'
1518 local subcommand
="$(__git_find_on_cmdline "$subcommands")"
1519 local cur
="${COMP_WORDS[COMP_CWORD]}"
1521 case "$subcommand,$cur" in
1526 case "${COMP_WORDS[COMP_CWORD-1]}" in
1528 __gitcomp
"$(__git_refs)"
1531 __gitcomp
"$subcommands --ref"
1535 add
,--reuse-message=*|append
,--reuse-message=*)
1536 __gitcomp
"$(__git_refs)" "" "${cur##--reuse-message=}"
1538 add
,--reedit-message=*|append
,--reedit-message=*)
1539 __gitcomp
"$(__git_refs)" "" "${cur##--reedit-message=}"
1542 __gitcomp
'--file= --message= --reedit-message=
1549 __gitcomp
'--dry-run --verbose'
1554 case "${COMP_WORDS[COMP_CWORD-1]}" in
1558 __gitcomp
"$(__git_refs)"
1567 __git_complete_strategy
&& return
1569 local cur
="${COMP_WORDS[COMP_CWORD]}"
1573 --rebase --no-rebase
1574 $__git_merge_options
1575 $__git_fetch_options
1580 __git_complete_remote_or_refspec
1585 local cur
="${COMP_WORDS[COMP_CWORD]}"
1586 case "${COMP_WORDS[COMP_CWORD-1]}" in
1588 __gitcomp
"$(__git_remotes)"
1593 __gitcomp
"$(__git_remotes)" "" "${cur##--repo=}"
1598 --all --mirror --tags --dry-run --force --verbose
1599 --receive-pack= --repo=
1604 __git_complete_remote_or_refspec
1609 local cur
="${COMP_WORDS[COMP_CWORD]}" dir
="$(__gitdir)"
1610 if [ -d "$dir"/rebase-apply
] ||
[ -d "$dir"/rebase-merge
]; then
1611 __gitcomp
"--continue --skip --abort"
1614 __git_complete_strategy
&& return
1617 __gitcomp
"$__git_whitespacelist" "" "${cur##--whitespace=}"
1622 --onto --merge --strategy --interactive
1623 --preserve-merges --stat --no-stat
1624 --committer-date-is-author-date --ignore-date
1625 --ignore-whitespace --whitespace=
1631 __gitcomp
"$(__git_refs)"
1636 local subcommands
="show delete expire"
1637 local subcommand
="$(__git_find_on_cmdline "$subcommands")"
1639 if [ -z "$subcommand" ]; then
1640 __gitcomp
"$subcommands"
1642 __gitcomp
"$(__git_refs)"
1646 __git_send_email_confirm_options
="always never auto cc compose"
1647 __git_send_email_suppresscc_options
="author self cc bodycc sob cccmd body all"
1651 local cur
="${COMP_WORDS[COMP_CWORD]}"
1655 $__git_send_email_confirm_options
1656 " "" "${cur##--confirm=}"
1661 $__git_send_email_suppresscc_options
1662 " "" "${cur##--suppress-cc=}"
1666 --smtp-encryption=*)
1667 __gitcomp
"ssl tls" "" "${cur##--smtp-encryption=}"
1671 __gitcomp
"--annotate --bcc --cc --cc-cmd --chain-reply-to
1672 --compose --confirm= --dry-run --envelope-sender
1674 --in-reply-to --no-chain-reply-to --no-signed-off-by-cc
1675 --no-suppress-from --no-thread --quiet
1676 --signed-off-by-cc --smtp-pass --smtp-server
1677 --smtp-server-port --smtp-encryption= --smtp-user
1678 --subject --suppress-cc= --suppress-from --thread --to
1679 --validate --no-validate"
1691 __git_config_get_set_variables
()
1693 local prevword word config_file
= c
=$COMP_CWORD
1694 while [ $c -gt 1 ]; do
1695 word
="${COMP_WORDS[c]}"
1697 --global|
--system|
--file=*)
1702 config_file
="$word $prevword"
1710 git
--git-dir="$(__gitdir)" config
$config_file --list 2>/dev
/null |
1723 local cur
="${COMP_WORDS[COMP_CWORD]}"
1724 local prv
="${COMP_WORDS[COMP_CWORD-1]}"
1727 __gitcomp
"$(__git_remotes)"
1731 __gitcomp
"$(__git_refs)"
1735 local remote
="${prv#remote.}"
1736 remote
="${remote%.fetch}"
1737 __gitcomp
"$(__git_refs_remotes "$remote")"
1741 local remote
="${prv#remote.}"
1742 remote
="${remote%.push}"
1743 __gitcomp
"$(git --git-dir="$
(__gitdir
)" \
1744 for-each-ref --format='%(refname):%(refname)' \
1748 pull.twohead|pull.octopus
)
1749 __git_compute_merge_strategies
1750 __gitcomp
"$__git_merge_strategies"
1753 color.branch|color.
diff|color.interactive|\
1754 color.showbranch|color.status|color.ui
)
1755 __gitcomp
"always never auto"
1759 __gitcomp
"false true"
1764 normal black red green yellow blue magenta cyan white
1765 bold dim ul blink reverse
1770 __gitcomp
"man info web html"
1774 __gitcomp
"$__git_log_date_formats"
1777 sendemail.aliasesfiletype
)
1778 __gitcomp
"mutt mailrc pine elm gnus"
1782 __gitcomp
"$__git_send_email_confirm_options"
1785 sendemail.suppresscc
)
1786 __gitcomp
"$__git_send_email_suppresscc_options"
1789 --get|
--get-all|
--unset|
--unset-all)
1790 __gitcomp
"$(__git_config_get_set_variables)"
1801 --global --system --file=
1802 --list --replace-all
1803 --get --get-all --get-regexp
1804 --add --unset --unset-all
1805 --remove-section --rename-section
1810 local pfx
="${cur%.*}."
1812 __gitcomp
"remote merge mergeoptions rebase" "$pfx" "$cur"
1816 local pfx
="${cur%.*}."
1818 __gitcomp
"$(__git_heads)" "$pfx" "$cur" "."
1822 local pfx
="${cur%.*}."
1825 argprompt cmd confirm needsfile noconsole norescan
1826 prompt revprompt revunmerged title
1831 local pfx
="${cur%.*}."
1833 __gitcomp
"cmd path" "$pfx" "$cur"
1837 local pfx
="${cur%.*}."
1839 __gitcomp
"cmd path" "$pfx" "$cur"
1843 local pfx
="${cur%.*}."
1845 __gitcomp
"cmd path trustExitCode" "$pfx" "$cur"
1849 local pfx
="${cur%.*}."
1851 __git_compute_all_commands
1852 __gitcomp
"$__git_all_commands" "$pfx" "$cur"
1856 local pfx
="${cur%.*}."
1859 url proxy fetch push mirror skipDefaultUpdate
1860 receivepack uploadpack tagopt pushurl
1865 local pfx
="${cur%.*}."
1867 __gitcomp
"$(__git_remotes)" "$pfx" "$cur" "."
1871 local pfx
="${cur%.*}."
1873 __gitcomp
"insteadOf pushInsteadOf" "$pfx" "$cur"
1880 apply.ignorewhitespace
1882 branch.autosetupmerge
1883 branch.autosetuprebase
1886 color.branch.current
1897 color.diff.whitespace
1902 color.interactive.header
1903 color.interactive.help
1904 color.interactive.prompt
1909 color.status.changed
1911 color.status.nobranch
1912 color.status.untracked
1913 color.status.updated
1920 core.deltaBaseCacheLimit
1924 core.fsyncobjectfiles
1926 core.ignoreCygwinFSTricks
1928 core.logAllRefUpdates
1929 core.loosecompression
1931 core.packedGitWindowSize
1933 core.preferSymlinkRefs
1936 core.repositoryFormatVersion
1938 core.sharedRepository
1941 core.warnAmbiguousRefs
1944 diff.autorefreshindex
1950 diff.suppressBlankEmpty
1963 format.subjectprefix
1972 gc.reflogexpireunreachable
1976 gitcvs.commitmsgannotation
1977 gitcvs.dbTableNamePrefix
1988 gui.copyblamethreshold
1992 gui.matchtrackingbranch
1993 gui.newbranchtemplate
1994 gui.pruneduringfetch
1995 gui.spellingdictionary
2011 i18n.logOutputEncoding
2016 imap.preformattedHTML
2025 interactive.singlekey
2038 mergetool.keepBackup
2041 pack.deltaCacheLimit
2054 receive.denyCurrentBranch
2056 receive.denyNonFastForwards
2059 repack.usedeltabaseoffset
2062 sendemail.aliasesfile
2063 sendemail.aliasesfiletype
2067 sendemail.chainreplyto
2069 sendemail.envelopesender
2071 sendemail.signedoffbycc
2072 sendemail.smtpencryption
2074 sendemail.smtpserver
2075 sendemail.smtpserverport
2077 sendemail.suppresscc
2078 sendemail.suppressfrom
2083 status.relativePaths
2084 status.showUntrackedFiles
2086 transfer.unpackLimit
2098 local subcommands
="add rename rm show prune update set-head"
2099 local subcommand
="$(__git_find_on_cmdline "$subcommands")"
2100 if [ -z "$subcommand" ]; then
2101 __gitcomp
"$subcommands"
2105 case "$subcommand" in
2106 rename|
rm|show|prune
)
2107 __gitcomp
"$(__git_remotes)"
2110 local i c
='' IFS
=$
'\n'
2111 for i
in $
(git
--git-dir="$(__gitdir)" config
--get-regexp "remotes\..*" 2>/dev
/null
); do
2125 __gitcomp
"$(__git_refs)"
2130 __git_has_doubledash
&& return
2132 local cur
="${COMP_WORDS[COMP_CWORD]}"
2135 __gitcomp
"--merge --mixed --hard --soft --patch"
2139 __gitcomp
"$(__git_refs)"
2144 local cur
="${COMP_WORDS[COMP_CWORD]}"
2147 __gitcomp
"--edit --mainline --no-edit --no-commit --signoff"
2151 __gitcomp
"$(__git_refs)"
2156 __git_has_doubledash
&& return
2158 local cur
="${COMP_WORDS[COMP_CWORD]}"
2161 __gitcomp
"--cached --dry-run --ignore-unmatch --quiet"
2170 __git_has_doubledash
&& return
2172 local cur
="${COMP_WORDS[COMP_CWORD]}"
2176 $__git_log_common_options
2177 $__git_log_shortlog_options
2178 --numbered --summary
2183 __git_complete_revlist
2188 __git_has_doubledash
&& return
2190 local cur
="${COMP_WORDS[COMP_CWORD]}"
2193 __gitcomp
"$__git_log_pretty_formats $(__git_pretty_aliases)
2194 " "" "${cur##--pretty=}"
2198 __gitcomp
"$__git_log_pretty_formats $(__git_pretty_aliases)
2199 " "" "${cur##--format=}"
2203 __gitcomp
"--pretty= --format= --abbrev-commit --oneline
2204 $__git_diff_common_options
2214 local cur
="${COMP_WORDS[COMP_CWORD]}"
2218 --all --remotes --topo-order --current --more=
2219 --list --independent --merge-base --no-name
2221 --sha1-name --sparse --topics --reflog
2226 __git_complete_revlist
2231 local cur
="${COMP_WORDS[COMP_CWORD]}"
2232 local save_opts
='--keep-index --no-keep-index --quiet --patch'
2233 local subcommands
='save list show apply clear drop pop create branch'
2234 local subcommand
="$(__git_find_on_cmdline "$subcommands")"
2235 if [ -z "$subcommand" ]; then
2238 __gitcomp
"$save_opts"
2241 if [ -z "$(__git_find_on_cmdline "$save_opts")" ]; then
2242 __gitcomp
"$subcommands"
2249 case "$subcommand,$cur" in
2251 __gitcomp
"$save_opts"
2254 __gitcomp
"--index --quiet"
2256 show
,--*|drop
,--*|branch
,--*)
2259 show
,*|apply
,*|drop
,*|pop
,*|branch
,*)
2260 __gitcomp
"$(git --git-dir="$
(__gitdir
)" stash list \
2261 | sed -n -e 's/:.*//p')"
2272 __git_has_doubledash
&& return
2274 local subcommands
="add status init update summary foreach sync"
2275 if [ -z "$(__git_find_on_cmdline "$subcommands")" ]; then
2276 local cur
="${COMP_WORDS[COMP_CWORD]}"
2279 __gitcomp
"--quiet --cached"
2282 __gitcomp
"$subcommands"
2292 init fetch clone rebase dcommit log find-rev
2293 set-tree commit-diff info create-ignore propget
2294 proplist show-ignore show-externals branch tag blame
2295 migrate mkdirs reset gc
2297 local subcommand
="$(__git_find_on_cmdline "$subcommands")"
2298 if [ -z "$subcommand" ]; then
2299 __gitcomp
"$subcommands"
2301 local remote_opts
="--username= --config-dir= --no-auth-cache"
2303 --follow-parent --authors-file= --repack=
2304 --no-metadata --use-svm-props --use-svnsync-props
2305 --log-window-size= --no-checkout --quiet
2306 --repack-flags --use-log-author --localtime
2307 --ignore-paths= $remote_opts
2310 --template= --shared= --trunk= --tags=
2311 --branches= --stdlayout --minimize-url
2312 --no-metadata --use-svm-props --use-svnsync-props
2313 --rewrite-root= --prefix= --use-log-author
2314 --add-author-from $remote_opts
2317 --edit --rmdir --find-copies-harder --copy-similarity=
2320 local cur
="${COMP_WORDS[COMP_CWORD]}"
2321 case "$subcommand,$cur" in
2323 __gitcomp
"--revision= --fetch-all $fc_opts"
2326 __gitcomp
"--revision= $fc_opts $init_opts"
2329 __gitcomp
"$init_opts"
2333 --merge --strategy= --verbose --dry-run
2334 --fetch-all --no-rebase --commit-url
2335 --revision $cmt_opts $fc_opts
2339 __gitcomp
"--stdin $cmt_opts $fc_opts"
2341 create-ignore
,--*|propget
,--*|proplist
,--*|show-ignore
,--*|\
2342 show-externals
,--*|mkdirs
,--*)
2343 __gitcomp
"--revision="
2347 --limit= --revision= --verbose --incremental
2348 --oneline --show-commit --non-recursive
2349 --authors-file= --color
2354 --merge --verbose --strategy= --local
2355 --fetch-all --dry-run $fc_opts
2359 __gitcomp
"--message= --file= --revision= $cmt_opts"
2365 __gitcomp
"--dry-run --message --tag"
2368 __gitcomp
"--dry-run --message"
2371 __gitcomp
"--git-format"
2375 --config-dir= --ignore-paths= --minimize
2376 --no-auth-cache --username=
2380 __gitcomp
"--revision= --parent"
2392 while [ $c -lt $COMP_CWORD ]; do
2393 i
="${COMP_WORDS[c]}"
2396 __gitcomp
"$(__git_tags)"
2406 case "${COMP_WORDS[COMP_CWORD-1]}" in
2412 __gitcomp
"$(__git_tags)"
2418 __gitcomp
"$(__git_refs)"
2430 local i c
=1 command __git_dir
2432 if [[ -n ${ZSH_VERSION-} ]]; then
2437 while [ $c -lt $COMP_CWORD ]; do
2438 i
="${COMP_WORDS[c]}"
2440 --git-dir=*) __git_dir
="${i#--git-dir=}" ;;
2441 --bare) __git_dir
="." ;;
2442 --version|
-p|
--paginate) ;;
2443 --help) command="help"; break ;;
2444 *) command="$i"; break ;;
2449 if [ -z "$command" ]; then
2450 case "${COMP_WORDS[COMP_CWORD]}" in
2463 *) __git_compute_porcelain_commands
2464 __gitcomp
"$__git_porcelain_commands $(__git_aliases)" ;;
2469 local completion_func
="_git_${command//-/_}"
2470 declare -f $completion_func >/dev
/null
&& $completion_func && return
2472 local expansion
=$
(__git_aliased_command
"$command")
2473 if [ -n "$expansion" ]; then
2474 completion_func
="_git_${expansion//-/_}"
2475 declare -f $completion_func >/dev
/null
&& $completion_func
2481 if [[ -n ${ZSH_VERSION-} ]]; then
2486 __git_has_doubledash
&& return
2488 local cur
="${COMP_WORDS[COMP_CWORD]}"
2489 local g
="$(__gitdir)"
2491 if [ -f "$g/MERGE_HEAD" ]; then
2497 $__git_log_common_options
2498 $__git_log_gitk_options
2504 __git_complete_revlist
2507 complete
-o bashdefault
-o default
-o nospace
-F _git git
2>/dev
/null \
2508 || complete
-o default
-o nospace
-F _git git
2509 complete
-o bashdefault
-o default
-o nospace
-F _gitk gitk
2>/dev
/null \
2510 || complete
-o default
-o nospace
-F _gitk gitk
2512 # The following are necessary only for Cygwin, and only are needed
2513 # when the user has tab-completed the executable name and consequently
2514 # included the '.exe' suffix.
2516 if [ Cygwin
= "$(uname -o 2>/dev/null)" ]; then
2517 complete
-o bashdefault
-o default
-o nospace
-F _git git.exe
2>/dev
/null \
2518 || complete
-o default
-o nospace
-F _git git.exe
2521 if [[ -n ${ZSH_VERSION-} ]]; then
2524 if [ $# -ne 2 ]; then
2525 echo "USAGE: $0 (-q|-s|-u) <option>" >&2
2533 echo "$0: invalid option: $2" >&2
2537 -q) setopt |
grep -q "$option" ;;
2538 -u) unsetopt
"$option" ;;
2539 -s) setopt
"$option" ;;
2541 echo "$0: invalid flag: $1" >&2