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

[PATCH] contrib/completion: complete options that take refs for format-patch

From
Denton Liu <liu.denton@gmail.com>
Date
Sep 17, 2020, 08:04 UTC
Message-ID
<6b5eac1d20781eecbadf3c3b0c0e34b7cf57134b.1600329854.git.liu.denton@gmail.com>

The completion for format-patch currently suggests --base=, --interdiff= and --range-diff= as options. However, with these `=` forms of the options, there is no space and we'd enter the `--*` case which means we don't call the __git_complete_revlist() at the end.

Teach _git_format_patch() to complete refs in the case of --base=, --interdiff= and --range-diff=.

Signed-off-by: Denton Liu <liu.denton@gmail.com>
---
 contrib/completion/git-completion.bash | 4 ++++
 1 file changed, 4 insertions(+)
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 9147fba3d5..8be4a0316e 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -1784,6 +1784,10 @@ _git_format_patch ()
 			" "" "${cur##--thread=}"
 		return
 		;;
+	--base=*|--interdiff=*|--range-diff=*)
+		__git_complete_refs --cur="${cur#--*=}"
+		return
+		;;
 	--*)
 		__gitcomp_builtin format-patch "$__git_format_patch_extra_options"
 		return
-- 
2.28.0.618.gf4bc123cb7
Message 1 of 1 in “contrib/completion: complete options that take refs for format-patch”
  1. contrib/completion: complete options that take refs for format-patchDenton Liu, Sep 17, 2020

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.