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

Re: [PATCH v2 1/3] completion: complete "unstuck" `git push --recurse-submodules`

From
Junio C Hamano <gitster@pobox.com>
Date
Jul 22, 2014, 20:23 UTC
Message-ID
<xmqqr41df8hu.fsf@gitster.dls.corp.google.com>
In-Reply-To
<8303c95dd3e3ee8d77d4b994bb2d33b6a155a17f.1406053442.git.john@keeping.me.uk>
John Keeping <john@keeping.me.uk> writes:
Show 27 quoted lines
> Since the argument to `--recurse-submodules` is mandatory, it does not
> need to be stuck to the option with `=`.
>
> Signed-off-by: John Keeping <john@keeping.me.uk>
> ---
> Change since v1:
>     - Fix typo --recurse{_ => -}submodules
>     - Dropped previous patch 1/4 adding ";;" at the end of the "--repo" case
>
>  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 7a6e1d7..bed3665 100644
> --- a/contrib/completion/git-completion.bash
> +++ b/contrib/completion/git-completion.bash
> @@ -1624,6 +1624,10 @@ __git_push_recurse_submodules="check on-demand"
>  _git_push ()
>  {
>  	case "$prev" in
> +	--recurse-submodules)
> +		__gitcomp "$__git_push_recurse_submodules"
> +		return
> +		;;
>  	--repo)
>  		__gitcomp_nl "$(__git_remotes)"
>  		return

If you mimick the order they are handled in the case on "$cur", it would also let us sneak in the missing-optional ";;" to case/esac to keep symmetry between the two ;-)

In other words, like this, perhaps?
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 019026e..b27f385 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -1617,6 +1617,11 @@ _git_push ()
 	--repo)
 		__gitcomp_nl "$(__git_remotes)"
 		return
+		;;
+	--recurse-submodules)
+		__gitcomp "$__git_push_recurse_submodules"
+		return
+		;;
 	esac
 	case "$cur" in
 	--repo=*)
-- 
2.0.2-892-g223db29
Previous: John KeepingNext: John Keeping
Message 14 of 18 in “completion: add missing terminator in case statement”
  1. 1/4 completion: add missing terminator in case statementJohn Keeping, Jul 19, 2014
  2. 2/4 completion: complete "unstuck" `git push --recurse-submodules`John Keeping, Jul 19, 2014
  3. Johannes SixtJul 19, 2014
  4. John KeepingJul 19, 2014
  5. 3/4 completion: add some missing options to `git push`John Keeping, Jul 19, 2014
  6. 4/4 completion: complete `git push --force-with-lease=`John Keeping, Jul 19, 2014
  7. Junio C HamanoJul 21, 2014
  8. Junio C HamanoJul 21, 2014
  9. John KeepingJul 22, 2014
  10. Junio C HamanoJul 22, 2014
  11. 1/3 completion: complete "unstuck" `git push --recurse-submodules`John Keeping, Jul 22, 2014
  12. 2/3 completion: add some missing options to `git push`John Keeping, Jul 22, 2014
  13. 3/3 completion: complete `git push --force-with-lease=`John Keeping, Jul 22, 2014
  14. Junio C HamanoJul 22, 2014
  15. John KeepingJul 22, 2014
  16. Junio C HamanoJul 22, 2014
  17. John KeepingJul 23, 2014
  18. Junio C HamanoJul 23, 2014

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.