git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v2] completion: use builtin completion for format-patch

From
Denton Liu <liu.denton@gmail.com>
Date
Oct 30, 2018, 06:38 UTC
Message-ID
<72331ce9275ce995009fe8dd3d586bb9d71f2cbf.1540881141.git.liu.denton@gmail.com>
In-Reply-To
<xmqqbm7c2n0i.fsf@gitster-ct.c.googlers.com>

This patch offloads completion functionality for format-patch to __gitcomp_builtin. In addition to this, send-email was borrowing some completion options from format-patch so those options are moved into send-email's completions.

Signed-off-by: Denton Liu <liu.denton@gmail.com>
---

I ran t9902-completion.sh on this patch and it seems to pass. Thus, this should address the concerns about losing some completion options in send-email.

---
 contrib/completion/git-completion.bash | 34 +++++++++++---------------
 1 file changed, 14 insertions(+), 20 deletions(-)
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index d63d2dffd..cb4ef6723 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -1531,15 +1531,6 @@ _git_fetch ()
 	__git_complete_remote_or_refspec
 }
 
-__git_format_patch_options="
-	--stdout --attach --no-attach --thread --thread= --no-thread
-	--numbered --start-number --numbered-files --keep-subject --signoff
-	--signature --no-signature --in-reply-to= --cc= --full-index --binary
-	--not --all --cover-letter --no-prefix --src-prefix= --dst-prefix=
-	--inline --suffix= --ignore-if-in-upstream --subject-prefix=
-	--output-directory --reroll-count --to= --quiet --notes
-"
-
 _git_format_patch ()
 {
 	case "$cur" in
@@ -1550,7 +1541,7 @@ _git_format_patch ()
 		return
 		;;
 	--*)
-		__gitcomp "$__git_format_patch_options"
+		__gitcomp_builtin format-patch
 		return
 		;;
 	esac
@@ -2080,16 +2071,19 @@ _git_send_email ()
 		return
 		;;
 	--*)
-		__gitcomp "--annotate --bcc --cc --cc-cmd --chain-reply-to
-			--compose --confirm= --dry-run --envelope-sender
-			--from --identity
-			--in-reply-to --no-chain-reply-to --no-signed-off-by-cc
-			--no-suppress-from --no-thread --quiet --reply-to
-			--signed-off-by-cc --smtp-pass --smtp-server
-			--smtp-server-port --smtp-encryption= --smtp-user
-			--subject --suppress-cc= --suppress-from --thread --to
-			--validate --no-validate
-			$__git_format_patch_options"
+		__gitcomp "--all --annotate --attach --bcc --binary --cc --cc= --cc-cmd
+			--chain-reply-to --compose --confirm= --cover-letter --dry-run
+			--dst-prefix= --envelope-sender --from --full-index --identity
+			--ignore-if-in-upstream --inline --in-reply-to --in-reply-to=
+			--keep-subject --no-attach --no-chain-reply-to --no-prefix
+			--no-signature --no-signed-off-by-cc --no-suppress-from --not --notes
+			--no-thread --no-validate --numbered --numbered-files
+			--output-directory --quiet --reply-to --reroll-count --signature
+			--signed-off-by-cc --signoff --smtp-encryption= --smtp-pass
+			--smtp-server --smtp-server-port --smtp-user --src-prefix=
+			--start-number --stdout --subject --subject-prefix= --suffix=
+			--suppress-cc= --suppress-from --thread --thread= --to --to=
+			--validate"
 		return
 		;;
 	esac
-- 
2.19.1
Previous: Denton LiuNext: Junio C Hamano
Message 4 of 13 in “completion: use builtin completion for format-patch”
  1. completion: use builtin completion for format-patchDenton Liu, Oct 29, 2018
  2. Junio C HamanoOct 30, 2018
  3. Denton LiuOct 30, 2018
  4. completion: use builtin completion for format-patchDenton Liu, Oct 30, 2018
  5. Junio C HamanoOct 30, 2018
  6. Duy NguyenOct 30, 2018
  7. Junio C HamanoNov 1, 2018
  8. Duy NguyenNov 1, 2018
  9. Junio C HamanoNov 1, 2018
  10. Duy NguyenNov 3, 2018
  11. Denton LiuNov 3, 2018
  12. Duy NguyenNov 3, 2018
  13. Junio C HamanoNov 3, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.