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

[PATCH v2 0/7] completion bash: add more options and commands

From
Ccornelius.weig@tngtech.com <cornelius.weig@tngtech.com>
Date
Feb 3, 2017, 11:01 UTC
Message-ID
<20170203110159.377-1-cornelius.weig@tngtech.com>
From: Cornelius Weig <cornelius.weig@tngtech.com>
This is the re-roll of patch series <20170122225724.19360-1-cornelius.weig@tngtech.com>.

This patch series adds all long-options that are mentioned in the synopsis of the man-page for the respective git-command. There are only a few exceptions, as discussed in the above thread. For example, no unsafe options should be completed. Furthermore, the patches add subommand option completion for git-submodule and git-remote.

Changes wrt first submission:
 - improve completion for git-remote set-head & set-branches
 - remove completion of unsafe options
 - improve commit messages
 - added sign-off :)
 - rebase to current master
Cornelius Weig (7):
  completion: teach submodule subcommands to complete options
  completion: add subcommand completion for rerere
  completion: improve bash completion for git-add
  completion: teach ls-remote to complete options
  completion: teach replace to complete options
  completion: teach remote subcommands to complete options
  completion: recognize more long-options
 contrib/completion/git-completion.bash | 139 ++++++++++++++++++++++++++++-----
 1 file changed, 118 insertions(+), 21 deletions(-)
Interdiff since first iteration:
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 87d3d2c..3545f6a 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -936,7 +936,7 @@ _git_apply ()
 			--apply --no-add --exclude=
 			--ignore-whitespace --ignore-space-change
 			--whitespace= --inaccurate-eof --verbose
-			--recount --directory= --unsafe-paths
+			--recount --directory=
 			"
 		return
 	esac
@@ -1459,7 +1459,7 @@ _git_ls_remote ()
 {
 	case "$cur" in
 	--*)
-		__gitcomp "--heads --tags --refs --get-url"
+		__gitcomp "--heads --tags --refs --get-url --symref"
 		return
 		;;
 	esac
@@ -2415,9 +2415,18 @@ _git_remote ()
 		;;
 	add,*)
 		;;
+	set-head,--*)
+		__gitcomp "--auto --delete"
+		;;
+	set-branches,--*)
+		__gitcomp "--add"
+		;;
 	set-head,*|set-branches,*)
 		__git_complete_remote_or_refspec
 		;;
+	update,--*)
+		__gitcomp "--prune"
+		;;
 	update,*)
 		__gitcomp "$(__git_get_config_variables "remotes")"
 		;;
@@ -2494,7 +2503,7 @@ _git_rm ()
 {
 	case "$cur" in
 	--*)
-		__gitcomp "--cached --dry-run --ignore-unmatch --quiet --force"
+		__gitcomp "--cached --dry-run --ignore-unmatch --quiet"
 		return
 		;;
 	esac
-- 
2.10.2
Next: cornelius.weig@tngtech.com
Message 1 of 10 in “completion bash: add more options and commands”
  1. 0/7 completion bash: add more options and commandscornelius.weig@tngtech.com, Feb 3, 2017
  2. 3/7 completion: improve bash completion for git-addcornelius.weig@tngtech.com, Feb 3, 2017
  3. 4/7 completion: teach ls-remote to complete optionscornelius.weig@tngtech.com, Feb 3, 2017
  4. 7/7 completion: recognize more long-optionscornelius.weig@tngtech.com, Feb 3, 2017
  5. 5/7 completion: teach replace to complete optionscornelius.weig@tngtech.com, Feb 3, 2017
  6. 6/7 completion: teach remote subcommands to complete optionscornelius.weig@tngtech.com, Feb 3, 2017
  7. 1/7 completion: teach submodule subcommands to complete optionscornelius.weig@tngtech.com, Feb 3, 2017
  8. 2/7 completion: add subcommand completion for rererecornelius.weig@tngtech.com, Feb 3, 2017
  9. Junio C HamanoFeb 6, 2017
  10. Johannes SixtFeb 7, 2017

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.