completion: add format-patch options to send-email

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Felipe Contreras committed Oct 16, 2012 at 02:21 UTC 2f65494d84fa9d250595e6c02d9e977c512cc09c
2 files changed +23 -17
contrib/completion/git-completion.bash
+18 -17
@@ -1116,6 +1116,14 @@ _git_fetch ()
1116 __git_complete_remote_or_refspec
1117 }
1118
1119 +__git_format_patch_options="
1120 + --stdout --attach --no-attach --thread --thread= --output-directory
1121 + --numbered --start-number --numbered-files --keep-subject --signoff
1122 + --signature --no-signature --in-reply-to= --cc= --full-index --binary
1123 + --not --all --cover-letter --no-prefix --src-prefix= --dst-prefix=
1124 + --inline --suffix= --ignore-if-in-upstream --subject-prefix=
1125 +"
1126 +
1127 _git_format_patch ()
1128 {
1129 case "$cur" in
@@ -1126,21 +1134,7 @@ _git_format_patch ()
1134 return
1135 ;;
1136 --*)
1129 - __gitcomp "
1130 - --stdout --attach --no-attach --thread --thread=
1131 - --output-directory
1132 - --numbered --start-number
1133 - --numbered-files
1134 - --keep-subject
1135 - --signoff --signature --no-signature
1136 - --in-reply-to= --cc=
1137 - --full-index --binary
1138 - --not --all
1139 - --cover-letter
1140 - --no-prefix --src-prefix= --dst-prefix=
1141 - --inline --suffix= --ignore-if-in-upstream
1142 - --subject-prefix=
1143 - "
1137 + __gitcomp "$__git_format_patch_options"
1138 return
1139 ;;
1140 esac
@@ -1554,6 +1548,12 @@ _git_send_email ()
1548 __gitcomp "ssl tls" "" "${cur##--smtp-encryption=}"
1549 return
1550 ;;
1551 + --thread=*)
1552 + __gitcomp "
1553 + deep shallow
1554 + " "" "${cur##--thread=}"
1555 + return
1556 + ;;
1557 --*)
1558 __gitcomp "--annotate --bcc --cc --cc-cmd --chain-reply-to
1559 --compose --confirm= --dry-run --envelope-sender
@@ -1563,11 +1563,12 @@ _git_send_email ()
1563 --signed-off-by-cc --smtp-pass --smtp-server
1564 --smtp-server-port --smtp-encryption= --smtp-user
1565 --subject --suppress-cc= --suppress-from --thread --to
1566 - --validate --no-validate"
1566 + --validate --no-validate
1567 + $__git_format_patch_options"
1568 return
1569 ;;
1570 esac
1570 - COMPREPLY=()
1571 + __git_complete_revlist
1572 }
1573
1574 _git_stage ()
t/t9902-completion.sh
+5
@@ -288,4 +288,9 @@ test_expect_failure 'complete tree filename with metacharacters' '
288 EOF
289 '
290
291 +test_expect_success 'send-email' '
292 + test_completion "git send-email --cov" "--cover-letter " &&
293 + test_completion "git send-email ma" "master "
294 +'
295 +
296 test_done